Accum Target Changing


(csocsi96) #1

Hi there,

I’ve been working on a turret which people can use to breach some gate doors. You need to select which gate door you would like to destroy with a button and then fire. There is a little problem. The turret only shoots once, and only the gate1 will breach. When I try to change target and push the fire button again, nothing happens and the console just keep telling me: entity 109 already in desired state. Could you please help me?

I have (triggers)func_invisible_user targetting the target_script_trigger which targets some events like: fire , change …
So they are my buttons.
The gates are script_movers (solid) and of course they have their own origin in the middle of them.

I show you my script.


game_manager
{
	spawn
	{
		wait 50
		remapshaderflush
		accum 0 set 0 // Accum 0 - Which target am I aiming at?
	}
}

turret
{
	spawn
	{
		wait 50
	}

	trigger fire // When I push the button it triggers fire
	{
		accum 0 trigger_if_equal 0 gate1 breach
		accum 0 trigger_if_equal 1 gate2 breach
		accum 0 trigger_if_equal 2 gate3 breach
	}
}

target_changer
{
	spawn
	{
		wait 50
	}

	trigger change // When I push the target changer button it triggers change
	{
		accum 0 inc 1 // Increases the accum 0 by 1
	}
}

gate1
{
	spawn
	{
		wait 50
	}

	trigger breach
	{
		alertentity gate1_expl
		setstate gate1 invisible
	}
}

gate2
{
	spawn
	{
		wait 50
	}

	trigger breach
	{
		alertentity gate2_expl
		setstate gate2 invisible
	}
}

gate3
{
	spawn
	{
		wait 50
	}

	trigger breach
	{
		alertentity gate3_expl
		setstate gate3 invisible
	}
}

Could you tell me what’s the problem?


(-SSF-Sage) #2

I did not notice quickly reading other problems, but I immidiately noticed you use accum over separate scriptblocks. Use globalaccum instead. Accum works only in inside one scriptblock. :slight_smile:

edit. Of you can move all the accum command into one scriptblock, such as game_manager if you don’t want globalaccum.


(Mateos) #3

Good morning,

When is triggered the fire part? There should be “trigger turret fire” somewhere?

Edit: What said Sage x) Nice one