Little checkpoint map, script not working (solved)


(TFate) #1

Hey all.

I have a nice little checkpoint map with 4 flags… the only problem is that the round does not end when the Axis/Allies capture all 4 flags. I run g_scriptdebug and it tells me everything works fine until “accum 0 abort_if_not_equal 4” is called for. It seems that accum 0 never increases (or does not increase properly) when the Axis capture a flag. The same goes for the Allies and accum 1. Here is my script, if anyone would be kind enough to take a look at it. The script is commented for easiness of use. :cool:

game_manager
{
	spawn
	{
		//RULES
		wait 50
		wm_axis_respawntime 20
		wm_allied_respawntime 20
		wm_set_round_timelimit 30
		wm_set_defending_team 0
	}

	trigger allies_win
	{
		accum 1 abort_if_not_equal 4

		wm_setwinner 1
		wait 100
		wm_endround
	}

	trigger axis_win
	{
		accum 0 abort_if_not_equal 4
		
		wm_setwinner 0
		wait 100
		wm_endround
	}
}

//*****************************
//***Checkpoint scripts V2.1***
//*****************************
//****************By Gatekeeper
//Original version redone due
//to too many accums!
//
//Note: This script does not work

wolf_checkpoint_bunker
{
	spawn
	{
		accum 0 set 0 //Number of Axis flags
		accum 1 set 0 //Number of Allied flags
		accum 2 set 2 //Who owns this flag? 0=Axis, 1=Allies, 2=No One
	}

	trigger allied_capture
	{
		accum 2 abort_if_equal 1 //Allies already have the flag!

		wait 10

		accum 2 set 1 //Allies now own this flag
		accum 1 inc 1 //Allies gain a flag

		trigger wolf_checkpoint bunker allied_capture_2

		wm_announce "Allies capture the Bunker Flag!"

		trigger game_manager allies_win
	}

	trigger axis_capture
	{
		accum 2 abort_if_equal 0 //Axis already have the flag!

		wait 10

		accum 2 set 0 //Axis now own this flag
		accum 0 inc 1 //Axis gain a flag
	
		trigger wolf_checkpoint_bunker axis_capture_2

		wm_announce "Axis capture the Bunker Flag!"

		trigger game_manager axis_win
	}

	trigger wolf_checkpoint_bunker allied_capture_2
	{
		accum 2 abort_if_equal 2 //If no one has the flag, no one's losing the flag

		wait 10

		accum 0 inc -1 //Axis lose a flag
	}

	trigger wolf_checkpoint_bunker axis_capture_2
	{
		accum 2 abort_if_equal 2 //If no one has the flag, no one's losing the flag

		wait 10

		accum 1 inc -1 //Allies lose a flag
	}
}

wolf_checkpoint_eastvillage
{
	spawn
	{
		accum 3 set 2 //Who owns this flag? 0=Axis, 1=Allies, 2=No One
	}

	trigger allied_capture
	{
		accum 3 abort_if_equal 1 //Allies already have the flag!

		wait 10

		accum 3 set 1 //Allies now own this flag
		accum 1 inc 1 //Allies gain a flag

		trigger wolf_checkpoint_eastvillage allied_capture_2

		wm_announce "Allies capture the East Village Flag!"

		trigger game_manager allies_win
	}

	trigger axis_capture
	{
		accum 3 abort_if_equal 0 //Axis already have the flag!

		wait 10

		accum 3 set 0 //Axis now own this flag
		accum 0 inc 1 //Axis gain a flag
	
		trigger wolf_checkpoint_eastvillage axis_capture_2

		wm_announce "Axis capture the East Village Flag!"

		trigger game_manager axis_win
	}

	trigger wolf_checkpoint_eastvillage allied_capture_2
	{
		accum 3 abort_if_equal 2 //If no one has the flag, no one's losing the flag

		wait 10

		accum 0 inc -1 //Axis lose a flag
	}

	trigger wolf_checkpoint_eastvillage axis_capture_2
	{
		accum 3 abort_if_equal 2 //If no one has the flag, no one's losing the flag

		wait 10

		accum 1 inc -1 //Allies lose a flag
	}
}

wolf_checkpoint_westvillage
{
	spawn
	{
		accum 4 set 2 //Who owns this flag? 0=Axis, 1=Allies, 2=No One
	}

	trigger allied_capture
	{
		accum 4 abort_if_equal 1 //Allies already have the flag!

		wait 10

		accum 4 set 1 //Allies now own this flag
		accum 1 inc 1 //Allies gain a flag

		trigger wolf_checkpoint_westvillage allied_capture_2

		wm_announce "Allies capture the West Village Flag!"

		trigger game_manager allies_win
	}

	trigger axis_capture
	{
		accum 4 abort_if_equal 0 //Axis already have the flag!

		wait 10

		accum 4 set 0 //Axis now own this flag
		accum 0 inc 1 //Axis gain a flag
	
		trigger wolf_checkpoint_westvillage axis_capture_2

		wm_announce "Axis capture the West Village Flag!"

		trigger game_manager axis_win
	}

	trigger wolf_checkpoint_westvillage allied_capture_2
	{
		accum 4 abort_if_equal 2 //If no one has the flag, no one's losing the flag

		wait 10

		accum 0 inc -1 //Axis lose a flag
	}

	trigger wolf_checkpoint_westvillage axis_capture_2
	{
		accum 4 abort_if_equal 2 //If no one has the flag, no one's losing the flag

		wait 10

		accum 1 inc -1 //Allies lose a flag
	}
}

wolf_checkpoint_southvillage
{
	spawn
	{
		accum 5 set 2 //Who owns this flag? 0=Axis, 1=Allies, 2=No One
	}

	trigger allied_capture
	{
		accum 5 abort_if_equal 1 //Allies already have the flag!

		wait 10

		accum 5 set 1 //Allies now own this flag
		accum 1 inc 1 //Allies gain a flag

		trigger wolf_checkpoint_southvillage allied_capture_2

		wm_announce "Allies capture the South Village Flag!"

		trigger game_manager allies_win
	}

	trigger axis_capture
	{
		accum 5 abort_if_equal 0 //Axis already have the flag!

		wait 10

		accum 5 set 0 //Axis now own this flag
		accum 0 inc 1 //Axis gain a flag
	
		trigger wolf_checkpoint_southvillage axis_capture_2

		wm_announce "Axis capture the South Village Flag!"

		trigger game_manager axis_win
	}

	trigger wolf_checkpoint_southvillage allied_capture_2
	{
		accum 5 abort_if_equal 2 //If no one has the flag, no one's losing the flag

		wait 10

		accum 0 inc -1 //Axis lose a flag
	}

	trigger wolf_checkpoint_southvillage axis_capture_2
	{
		accum 5 abort_if_equal 2 //If no one has the flag, no one's losing the flag

		wait 10

		accum 1 inc -1 //Allies lose a flag
	}
}

(Ifurita) #2

use a globalaccum to store flag #'s

Your current accums are spread across multiple scriptblocks, so never truely accumulate


(TFate) #3

Yep, worked perfectly. :smiley: Thanks!


(Ifurita) #4

\o/


(Oxygen - o2) #5

whats the difference? how do you change between global and non global?


(Ifurita) #6

globalaccum vs accum

accum only registers within a block of script. This means that you can have accum 0 set 1 in game_manager that tracks a different set of events than the accum 0 set 1 in forward_flag

globalaccum registers across scriptblocks which means that both scriptblocks read globalaccum 0 set 1 as the same value


(TFate) #7

Oxygen, “accum 1 inc -1” would be “globalaccum 1 inc -1”

You treat them the same way. :slight_smile: