[script] event when map ends ?


(dwe_flame) #1

well i was trying to make some event happen when the map ends, but not really certain how i should do this.

at first i was thinking of making a “wait” function, but when some admin makes the map last longer or less, this will no longer work in the right way.

so is there some way to trigger some script when the map ends ?
and if so, how ?


(Destroy666) #2

You need to add your triggers behind wm_endround in script.
Add into map info_player_intermission in place where the action happens.


(CoD4Fun) #3

no need to make it complicated. there is a certain event which will be triggered by the script_multiplayer at the end. i dunno remember it though, but it belongs to that entity for sure. search for it :slight_smile:


(dwe_flame) #4

[QUOTE=Destroy666;224271]You need to add your triggers behind wm_endround in script.
Add into map info_player_intermission in place where the action happens.[/QUOTE]

yea i understand how to make a script event for the winning team, that is just after the last objective has been destroyed.

but how to make it get triggerd when the map time runs out, but the objective for that attacking team has not been done,
in that case a “wm_endround” does not get triggerd

** edit **
searching for “wm_endround” in the splashdamage wiki has not even a result


(-SSF-Sage) #5
trigger timelimit_hit

Is triggered in game_manager, if you have wm_setwinner set to a team (0/1). After that you can set it -1 and do what you need to do.


(dwe_flame) #6

so like this ?


game_manager
{
	spawn
	{
		wm_axis_respawntime	10
		wm_allied_respawntime	10
		wm_set_round_timelimit	35
		wm_number_of_objectives 1

		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	1

		// Winner on expiration of round timer (0=Axis, 1=Allies, -1=Nobody)
		wm_setwinner 1
		trigger timelimit_hit

		
		wait 100
		
		setautospawn "First Spawn" 0
		setautospawn "Ship Spawn" 1
		
		setstate axis_spawn2 invisible
		setstate axis_spawn3 invisible
	}
	trigger timelimit_hit
	{
wm_announce "from here i can run some custom stuff that will happen in the background of the intermission?? "
	}
{

so when i put the endround in the timelimit_hit,
all the other stuff will happen in the background of the intermission when i set the camera on it ?


(dwe_flame) #7

ok never mind,
after you mentioned the Trigger timelimit_hit i was able to find it back in the Oasis script, and now understand where to put it:

	trigger timelimit_hit
	{
		trigger end_boom_north check_0
		trigger end_boom_south check_1
	}

just somewhere inside the game_manager.
so i understand no i dont need to call it at a certain other part in my script.
i always get called at the end of the map :slight_smile:

thanx {SSF}Sage


(CoD4Fun) #8

and me ? :smiley:


(-SSF-Sage) #9

Yeah basicly, you can also check who has bigger score and set the winning team accordingly if needed.

And remove trigger timelimit_hit from here:


	spawn
	{
		wm_axis_respawntime	10
		wm_allied_respawntime	10
		wm_set_round_timelimit	35
		wm_number_of_objectives 1

		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	1

		// Winner on expiration of round timer (0=Axis, 1=Allies, -1=Nobody)
		wm_setwinner 1
		/////////////////////////////////////////////////////////////////////////////////////////trigger timelimit_hit

		
		wait 100
		
		setautospawn "First Spawn" 0
		setautospawn "Ship Spawn" 1
		
		setstate axis_spawn2 invisible
		setstate axis_spawn3 invisible
	}


(dwe_flame) #10

yea you too :cool:

[QUOTE={SSF}Sage;224288]Yeah basicly, you can also check who has bigger score and set the winning team accordingly if needed.

And remove trigger timelimit_hit from here:


	spawn
	{
		wm_axis_respawntime	10
		wm_allied_respawntime	10
		wm_set_round_timelimit	35
		wm_number_of_objectives 1

		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	1

		// Winner on expiration of round timer (0=Axis, 1=Allies, -1=Nobody)
		wm_setwinner 1
		/////////////////////////////////////////////////////////////////////////////////////////trigger timelimit_hit

		
		wait 100
		
		setautospawn "First Spawn" 0
		setautospawn "Ship Spawn" 1
		
		setstate axis_spawn2 invisible
		setstate axis_spawn3 invisible
	}

[/QUOTE]

this i dont understand what and how you mean this. =)
looking at that code i see nothing to check for scores or such ?

i needed that timelimit_hit so i can make a event happen in the background when the map has ended. so i dont think that is a other way that this timelimit hit


(-SSF-Sage) #11

It is not a valid command. The one I marked /////////////////////… The trigger gets executed automatically if wm_setwinner is 0 or 1. You have to write the rest of the script yourself. Depends on what you need. For example you can play with accums, and in the timelimit_hit check the result and trigger the winner/intermission action by that.


(CoD4Fun) #12

cookies ? :smiley:

and about score. i think sage will explain that :slight_smile: you need to increase and decrease accums.

accum n inc -1 //decrease
accum n inc 1 //increase

gl


(mortis) #13

Just some quick tips on wait states in the initial and engame script blocks. Autospawns need to be set within the first three server frames (150ms) or else bad things can happen based on the active TWOs (think Supplydepot without my script fix). A lot of the stock maps (fuel dump comes to mind) had excessively long wait states in the final script block…this resulted in wacky things like the console printout and the screen displaying different winners (aka one might say “Axis” and the other “allied” depending on how much of the script block was slow to execute) if the dynamite was placed with around 30 seconds remaining.