So... still combating my "double spawn" issue. I tried making an affector that killed any other flags, but it was essentially killing ALL the flags, even with using ignore and conditional tests... frustrating to say the least... but for the most part, the rest of it works well.
I use a neutral_goat prespawned into the map for initial spawning of the flag (he's perched on a cliff over the flag area for constant vision of your flag), and then use that as the "predefined location" to spawn additional flags after scoring and whatnot.
goat spawn ability:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<ability
name="Ability_SpawnFlags"
actiontype="self_position"
icon="/items/powerups/speed/icon.tga"
>
<onspawn>
<compare a="team" b="source_team" op="eq">
<compare a="team" b="1" op="eq">
<setent0 name="legionBase"/>
<spawnunit name="Powerup_Damage" target="ent0" offset="0 250" pushentity="true" />
</compare>
<else>
<setent1 name="hellbourneBase"/>
<spawnunit name="Powerup_MoveSpeed" target="ent1" offset="0 250" pushentity="true" />
</else>
</compare>
</onspawn>
</ability>
flag entity (as a powerup, there's a different unit for each team, but you can imagine that they correspond to each other, but opposite)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<powerup
name="Powerup_Damage"
icon="icon.tga"
portrait="icon.tga"
model="/items/powerups/damage/model.mdf"
skin=""
passiveeffect="/items/powerups/damage/effects/passive.effect"
spawneffect="/items/powerups/damage/effects/spawn.effect"
respawneffect=""
selectsound=""
orderconfirmedsound=""
preglobalscale="1.7"
modelscale="1"
effectscale="0.9"
boundsheight="32"
boundsradius="16"
selectionradius="32"
targetoffset="0 0 16"
immunity="GadgetImmunity"
attacktype="none"
combattype="Ranged"
corpsetime="300"
corpsefadetime="0"
deathtime="0"
touchtargetscheme="all_heroes"
touchsound=""
>
<ontouched>
<compare a="team" b="target_team" op="eq">
<!-- if you have the flag, you score -->
<condition test="hasstate State_HasFlagHell" target="target_entity">
<expirestate name="State_HasFlagHell" target="target_entity"/>
<!-- now reset the enemy flag -->
<compare a="team" b="1" op="eq">
<setent0 name="hellbourneBase"/>
<spawnunit name="Powerup_MoveSpeed" target="ent0" offset="0 -250" team="2"/>
</compare>
<else>
<setent1 name="legionBase"/>
<spawnunit name="Powerup_Damage" target="ent1" offset="0 250" team="1"/>
</else>
</condition>
<!-- spawn the flag again -->
<spawnunit name="Powerup_Damage" target="this_position" fixedposition="true"/>
</compare>
<else>
<!-- pick up the enemy flag -->
<applystate name="State_HasFlagLeg" duration="-1" />
</else>
</ontouched>
<modifier key="dropped" >
<ontouched>
<compare a="team" b="target_team" op="eq">
<!-- teleport your ally flag back to your base -->
<compare a="team" b="1" op="eq">
<setent0 name="legionBase"/>
<spawnunit name="Powerup_Damage" target="ent0" offset="0 250" pushentity="true" />
<deactivatemodifierkey entity="stack_entity" name="dropped" />
</compare>
</compare>
<else>
<!-- pick up the enemy flag -->
<applystate name="State_HasFlagLeg" duration="-1" />
</else>
</ontouched>
</modifier>
</powerup>
states applied to flag carriers
Code:
<?xml version="1.0" encoding="UTF-8"?>
<state
name="State_HasFlagLeg"
icon="/items/powerups/damage/icon.tga"
passiveeffect="/items/powerups/damage/effects/state.effect"
silenced="true"
perplexed="true"
revealed="true"
effecttype=""
>
<oninflict>
<printdebuginfo />
</oninflict>
<ondeath>
<!-- to calculate the opposite team, do 3-1=2 or 3-2=1 -->
<setvar0 a="3" b="team" op="sub"/>
<spawnunit name="Powerup_Damage" target="source_position" team="var0" pushentity="true"/>
<activatemodifierkey name="dropped" entity="stack_entity"/>
</ondeath>
</state>
Still not picking up why a second flag spawns on the first <ontouch> activation of each flag. Thinking of adding an initial charge to it, where after the first, it loses a charge and then spawns a new flag, hopefully to fix the double spawn on first contact issue, but if anyone has any other ideas or explanations as to why it happens, feel free to give me your input.