Members | Sign In
All Forums > Mission Scripting
avatar

Killing off crewmen

posted Jun 03, 2012 16:11:50 by name4026
I'm trying to create a script that can deal damage to Artemis's DamCon teams under certain situations. I couldn't find an officially supported way of doing that (like "Add -1 to property DamConTeams" or something), so I created this setup to try to emulate a similar thing:

  <event>
    <if_variable name="kill_crewman" comparator="EQUALS" value="1.0" />
    <if_damcon_members index="0" comparator="EQUALS" value="6" />
    <set_damcon_members value="5" team_index="0" />
    <set_variable name="kill_crewman" value="0.0" />
  </event>
  <event>
    <if_variable name="kill_crewman" comparator="EQUALS" value="1.0" />
    <if_damcon_members index="0" comparator="EQUALS" value="5" />
    <set_damcon_members value="4" team_index="0" />
    <set_variable name="kill_crewman" value="0.0" />
  </event>
  <event>
    <if_variable name="kill_crewman" comparator="EQUALS" value="1.0" />
    <if_damcon_members index="0" comparator="EQUALS" value="4" />
    <set_damcon_members value="3" team_index="0" />
    <set_variable name="kill_crewman" value="0.0" />
  </event>
 
  ... 

  <event>
    <if_variable name="kill_crewman" comparator="EQUALS" value="1.0" />
    <if_damcon_members index="0" comparator="EQUALS" value="0" />
    <if_damcon_members index="1" comparator="EQUALS" value="6" />
    <set_damcon_members value="5" team_index="1" />
    <set_variable name="kill_crewman" value="0.0" />
  </event>
  <event>
    <if_variable name="kill_crewman" comparator="EQUALS" value="1.0" />
    <if_damcon_members index="0" comparator="EQUALS" value="0" />
    <if_damcon_members index="1" comparator="EQUALS" value="5" />
    <set_damcon_members value="4" team_index="1" />
    <set_variable name="kill_crewman" value="0.0" />
  </event>
  
  ...


I've omitted some of the steps to avoid boring repetition, but included enough so you can probably follow the gist. In full, there should be 18 events, one for each member of the DamCon teams.

My intent was that it would work like this: you set the variable kill_crewman to 1 any time you want a Damcon member to die, and that triggers one (and only one) of the above events, depending on how many crewmen are still alive in each team. These events kill off DamCon team members in order, first depleting team 0, then once they're all dead, team 1 and so on.

Unfortunately, it doesn't seem to work. It'll kill off the first team member of DamCon team 0 fine, but then it just keeps triggering the first event, over and over again, setting the size of team 1 to 5 each time, despite team 1 already having only 5 members.

Can anyone spot some obvious mistake with my logic here? Have I totally misunderstood if_damcon_members and set_damcon_members?
page   1
2 replies
avatar
DwayneShaffer said Jun 04, 2012 14:24:55
This code snippet might help you out


http://www.artemis.eochu.com/?page_id=28#/20111224/code-snippets-1128430/page2/
Dwayne Shaffer C.O.
Vidar GSR 3701
C.D.F. 7th Fleet
http://vidar-gsr-3701.webs.com/
avatar
name4026 said Jun 04, 2012 16:36:08
Aha! Oddly, I'd browsed that forum thread before, but your link back there made me go through the code more carefully, and I spotted my mistake. In my code (which has been generated by the otherwise excellent Artemis Mission Editor), the if_damcon_members condition uses an "index" parameter instead of the correct "team_index".

I guess this is a bug with the Mission Editor. I'll go report it, and correct my code...
Login below to reply: