scripting trouble


(error 404) #1

hey i wrote a script to a map with a wall to breach and gold to capture. Wall is destroyable, gold captureable, but when allied secures the gold, the gam doesnt end, but it should i think. here is the script:

game_manager 
{ 
spawn 
{ 
} 
} 
		//Wall
		wall_script 
		{ 
		spawn 
		{ 
		wait 200 
		constructible_class 3 
		} 
		death 
		{ 
		wm_announce "Allies breached the wall!" 
		setstate wall invisible 
		} 
		}

//Gold 
axis_gold 
{ 
spawn 
{ 
wait 200 
setstate axis_gold_captured invisible 
} 


trigger stolen 
{ 
wm_announce 0 "Return the Axis gold to the getaway truck" 
wm_announce 1 "The Allied have stolen the Axis gold" 
} 


trigger returned 
{ 
wm_announce 1 "The Axis have retrieved the gold" 
wm_announce 0 "Gold returned! Protect the gold" 
} 

trigger captured 
{ 
wm_announce "The Allied have secured the Axis gold" 
setstate axis_gold_red invisible 
setstate axis_gold_captured default 
} 
} 

		axis_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity 
		{ 
		death 
		{ 
		trigger game_manager objectuve_counter 
		} 
		}
		trigger objective_counter //Counts allied objectives completed
		{
		accum 1 inc 1
		trigger game_manager checkgame
		trigger checkgame
		{
		accum 1 abort_if_not_equal 1
		wm_setwinner 1
		wait 1500
		wm_endround
		}
		}

is my script wrong or whats the problem?
thanks for all the answers


(Loffy) #2

Hi!
I want more info.
Do you get the text “The Allied have secured the Axis gold” on screen, when the gold is secured?

If yes, that would indicate that this section of the script is running fine:


trigger captured
{
wm_announce "The Allied have secured the Axis gold"
setstate axis_gold_red invisible
setstate axis_gold_captured default
} 

//Loffy


(Loffy) #3

Hm, also, I think you need to change the first part of the script, to something like this:


game_manager
{
spawn // This section of the script is run whenever the map starts.
{
accum 1 set 0 // Accums are counters, sort of  :-)  By writing accum 1 set 0 here, you have given accum number 1 the value of 0.
}
} 


(error 404) #4

yes you get the text on screen, oh thanks, will test the script


(Loffy) #5

OK, if that part is run, then you could add this:

  wm_setwinner 1
  wait 1500
  wm_endround

So, the section would lok like this:


trigger captured
{
wm_announce "The Allied have secured the Axis gold"
setstate axis_gold_red invisible
setstate axis_gold_captured default
wm_setwinner 1
wait 1500
wm_endround
}

Try it. If you like it, and it works, you can use it. But there are other ways to script that ending of your map.
Another mapper might want to comment below, to calirify/add/remove stuff.
//Loffy


(error 404) #6

ok
thanks for the comment near “accum” didnt know they are counters :slight_smile: this will work with my new idea for a map - Warsaw 1939
Allied forces are in the city. On their backs are 2 bridges over Wisla river. Axis must destroy theese bridges, to cut the way of Allied reinforcements.
If Allied survive with bridges, history will change. We will beat Hitler in Poland!

is it a good idea? thanks for answer
error [404]


(Loffy) #7

Hi again!
Glad to help.
Idea for map is super. Go for it! Two dynamitable bridges? That is an ideal objective for the attackers.
About scripting: There are some scripting commands (and explanations) here:
http://www.planetquake.com/simland/ldr1_1/appendix_a.htm

//L.


(error 404) #8

ye im from poland so thats my idea :stuck_out_tongue: hehe thanks


(error 404) #9

here comes the screen of the 1st section - bridges


(nUllSkillZ) #10

The following script will end the map if the wall is destroyed and the gold is captured.


game_manager
{
	spawn
	{
		accum 1 set 0
	}

	trigger objective_counter
	{
		accum 1 inc 1
		trigger game_manager checkgame
	}

	trigger checkgame
	{
		accum 1 abort_if_not_equal 2
		wm_setwinner 1
		wait 1500
		wm_endround
	}
}

//Wall
wall_script
{
	spawn
	{
		wait 200
		constructible_class 3
	}
	death
	{
		trigger game_manager objective_counter
		wm_announce "Allies breached the wall!"
		setstate wall invisible
	}
}

//Gold
axis_gold
{
	spawn
	{
	wait 200
	setstate axis_gold_captured invisible
	}

	trigger stolen
	{
		wm_announce 0 "Return the Axis gold to the getaway truck"
		wm_announce 1 "The Allied have stolen the Axis gold"
	}

	trigger returned
	{
		wm_announce 1 "The Axis have retrieved the gold"
		wm_announce 0 "Gold returned! Protect the gold"
	}

	trigger captured
	{
		wm_announce "The Allied have secured the Axis gold"
		setstate axis_gold_red invisible
		setstate axis_gold_captured default
	}
}

axis_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity
{
	death
	{
		trigger game_manager objective_counter
	}
}


(error 404) #11

thank you