Script problem


(nudels) #1

I have a scriptproblem for a ET map were AXIS is the attacker. and Allies defends. I want the forward spawn to become Axis after they have blown a gate. Like in oasis old city but quit the oposit. And i cant get the damn thing to work, anyone has a tutorial for this? this is my latest test.

// ================================================
// FORWARD FLAG CONSTRUKTEB. GATE SCRIPT
// ================================================
forward_flag
{
spawn

{
accum 0 set 1 // Who owns flag: 0-Axis, 1-Allied, 2-Nobody
}



trigger axis_capture // Touched by an Axis player
{
accum 0 abort_if_equal 0 // do Axis own flag?
accum 0 trigger_if_equal 1 forward_flag axis_reclaim // Reclaimed from Allies
accum 0 set 0 // Axis own the flag
wm_announce "^3Axis have captured the Forward Flag!"
setstate forward_wobj default
}



trigger axis_reclaim
{
alertentity forward_wobj // Switch command map marker
}



trigger allied_capture // Touched by an allied player
{
accum 0 abort_if_equal 1 // do Allies own flag?
accum 0 set 1 // Allied own the flag
wm_announce "^3Allies have captured the Forward Flag!"
setstate forward_wobj default
alertentity forward_wobj // Switch command map marker
}

trigger force_axis 
	{
	accum 1 abort_if_equal 0	//Abort if allies own

	accum 1 set 0


	setstate forward_wobj default
	setstate forward_flag default
}

trigger kill
{
	remove
}

}

// =================================================
// SIDEGATE
// ================================================
sidegate
{
spawn
{
wait 300
constructible_class 3 // 2=satchel 3=dyna
}

death
{
	wm_objective_status 1 0 1
	wm_objective_status 1 1 2
	trigger forward_flag force_axis
	trigger forward_flag kill
	alertentity sidegate_bits
	trigger sidegate_toi remove


	wm_announce "The Axis have destroyed the Sidegate!"
}

}

sidegate_toi
{
trigger remove
{
remove
}
}

What the hell is wrong?


(TomTom7777) #2

Do you want the players to auto spawn at the flag? Because if so you need to set the autospawn string that is associated (by description field) with the team_WOLF_objective.
setautospawn “DESC” team_number

where “DESC” is the team_WOLF_objective description field (quotes needed).

If the flag merely makes the spawnpads available then you leave the autospawn strings alone.

Your trigger

trigger force_axis
{
accum 1 abort_if_equal 0 //Abort if allies own

accum 1 set 0

I note that the comment seems at odds with your described usage. Did you mean to use accum 0 instead? And you did not initialize accum 1 either! Better to do so.

I believe there is a tutorial in the standard Splash Damage stuff and some by others. Failing that I wrote this one on scripting in spawns for FritzBots


(nudels) #3

Dont bather the trigger values, i have tied any possible combination. the thing is that if you open for example supply, the code looks like this

trigger force_allied {
accum 0 abort_if_equal 1 //Abort if allies own

	accum 0 set 1

	//Commented out, possible cause of autospawn bug
	//setautospawn	"Axis Depot Spawn"	0
	//setautospawn	"Forward Bunker Spawn"	1

	alertentity forward_wobj
	alertentity forwardspawn
}

If you take braundorf the code looks like this:

trigger force_allied
{
accum 0 abort_if_equal 1 // Do Allied own the flag?
alertentity forwardflag_wobj
alertentity forward_spawn

	// Message to alert players
	wm_announce	"Allies permanently capture the factory district!"
	
	wm_teamvoiceannounce 0 "axis_hq_objective_lost"
	wm_teamvoiceannounce 1 "allies_hq_objective_captured"
			
	wm_objective_status 		4 0 2
	wm_objective_status 		4 1 1
}

so the most logical if you want to force Axis would be to change accum in the skcript to the oposit value right. Well that does not work…


(ailmanki) #4

these accums are more complicate to use…

accums are variabel holders
and afaik you can hold 9 locals, and 9 global…

so… you have accum 0,1,2…9
you have put into variabel holder 0 some value, and do later check for variabel holder 1 which can’t work.

If you do invert something, then be sure to invert everything… not just one value…
means accum 0 = allies, accum 1 = axis … and so on… else it will be a mess as it is partially inverted…

this could work, as I have not tested it, I dont know - could be that you have some other error which prevents it from working, but I guess the accum logic is correct now

/ ================================================
// FORWARD FLAG CONSTRUKTEB. GATE SCRIPT
// ================================================
forward_flag
{
	spawn

	{
		accum 0 set 0 // Who owns flag: 1-Axis, 0-Allied, 2-Nobody
	}

	trigger allied_capture // Touched by an allied player
	{
		accum 0 abort_if_equal 0 // do Allies own flag?
		accum 0 set 0 // Allied own the flag
		wm_announce "^3Allies have captured the Forward Flag!"
		setstate forward_wobj default
		alertentity forward_wobj // Switch command map marker
	}

	trigger axis_capture // Touched by an Axis player
	{	
		accum 0 abort_if_equal 1 // do Axis own flag?
		accum 0 trigger_if_equal 0 forward_flag axis_reclaim // Reclaimed from Axis
		accum 0 set 1 // Axis own the flag
		wm_announce "^3Axis have captured the Forward Flag!"
		setstate forward_wobj default
	}
	
	trigger axis_reclaim
	{
		alertentity forward_wobj // Switch command map marker
	}
	
	trigger force_axis
	{
		accum 0 abort_if_equal 1 //Abort if axis own
		
		setstate forward_wobj default
		setstate forward_flag default
	}
	
	trigger kill
	{
		remove
	}
}

// =================================================
// SIDEGATE
// ================================================
sidegate
{
	spawn
	{
		wait 300
		constructible_class 3 // 2=satchel 3=dyna
	}
	
	death
	{
		wm_objective_status 1 0 1
		wm_objective_status 1 1 2
		trigger forward_flag force_axis
		trigger forward_flag kill
		alertentity sidegate_bits
		trigger sidegate_toi remove


		wm_announce "The Axis have destroyed the Sidegate!"
	}
}

sidegate_toi
{
	trigger remove
	{
		remove
	}
}



(TomTom7777) #5

ailmanki’s script does look correct for the accums.

If you are still having problems check the location of your team_WOLF_objective. If like in oasis you don’t change the setautospawn values then you must place the team_WOLF_objective near to the forward spawn so that when those spawnpads are active (default) they will be filled first. And when the forward spawnpads are inactive (invisible) the players will spawn at the initial spawnpads (if left active).

For more complicated maps with multiple spawn points you may need to have multiple team_WOLF_objectives for one or both teams and then use the setautospawn command. Just rememberthe spawnpads must be active before you script a change in setautospawn. After changing the setautospawn in your script then you can turn off the old spawnpads.


(isbowhten) #6

in my opinion that script is mcuh too complex for that simple thing…
i would first imagine what you wanna do instead of looking into tutorials…

what you wanna do =
a flag captureable by both teams… -> 2 spawns, 1 for each team…
set the referring WOBJ entities default/invisible and alertentity the team_red/blueflag entites in the referring trigger_allied/axis capture events…

so then if something gets destroyed you wanna the flag to disappear like in oasis?
then just let it disappear!! that is not a big thing, it only needs the knowledge of the correct commands…

so you see … if you imagine what you wanna do then the script is easy if you know the commands.
if i have to look up a command i use
http://games.chruker.dk/enemy_territory/scripting_reference.php
the accums prevent that an event is executed again …
e.g. if axis hold flag they should not again get the flag as it could mess with spawn entities.


(nudels) #7

[QUOTE=isbowhten;182158]in my opinion that script is mcuh too complex for that simple thing…
i would first imagine what you wanna do instead of looking into tutorials…

what you wanna do =
a flag captureable by both teams… -> 2 spawns, 1 for each team…
set the referring WOBJ entities default/invisible and alertentity the team_red/blueflag entites in the referring trigger_allied/axis capture events…

so then if something gets destroyed you wanna the flag to disappear like in oasis?
then just let it disappear!! that is not a big thing, it only needs the knowledge of the correct commands…

so you see … if you imagine what you wanna do then the script is easy if you know the commands.
if i have to look up a command i use
http://games.chruker.dk/enemy_territory/scripting_reference.php
the accums prevent that an event is executed again …
e.g. if axis hold flag they should not again get the flag as it could mess with spawn entities.[/QUOTE]

Think you have a point there, I have been loking in to alternate solutions too, and making two spawn one for each team it´s alot easyer. so i think I go with that!