Author Topic: Zones and VCE  (Read 460 times)

Im trying to make an auto turret using the onenterzone. It is meant to shoot the team that is enemy to the ship (This is for a space battle game). I started by doing:

 onvehicleenterzone    driver(player)    vceifvariable    <var:cl:teamName> = CIS

 onvariabletrue    NamedBrick    firerelay
                           Clonesturret

I was pretty confident that this would work so i edited the turret bricks events:

(DELAY 400) Onrelay    self    firerelay

onrelay    self    spawnhomingprojectile    radiowave    closestvehicle(activeplayer maybe?)

(DELAY 3000)onrelay    self    seteventsenabled    0 1  OFF

(DELAY 6000)onrelay    self    seteventsenabled    0 1  ON

What this would do is rapid fire bullets aimed at the closest player. I don't think closest enemy or active player would work. If you know please tell. Anyway, after 3 seconds the turret would have a 3 second cool down to let the enemy escape. After testing this I found no sign of it working. I decided to change the:

 onvehicleenterzone    driver(player)    vceifvariable    <var:cl:teamName> = CIS

To:

 onvehicleenterzone    driver(player)    vceifvariable    TEAM = CIS

Then I went to the CIS team's spawns and did:

Onplayerteam2touch(Team 2=CIS)    Player    vcemodvariable    TEAM    set    CIS

This, I thought, would make it so when the Cis entered the zone, it would trigger the onvehicleenterzone    Driver(player) event to sense the VCE: TEAM to be CIS. This would then trigger the event onvariabletrue    namedbrick    firerelay   
                                                    Clonesturret

This still didnt work and has left me confused. Anyone got an easier way of making a homing turret that could perhaps go for the team you want it to? Closest player is not efficient as if a team member is on the ship and is closer to the turret after a CIS triggered it, the turret would aim for it's ally. Please help I really need this!
                                                                                Thanks! - Cat In Heaven

when you're on team CIS, click a brick with onactivate>client>chatmsg[team:<var:cl:team> teamname:<var:cl:teamname>]
use whichever one of them gives a value in the ifs, as I think <var:cl:team> should be 2 and <var:cl:teamname> might be CIS

when doing input>client>vce_ifvariable, put in the variable name, not the variable replacer
ie, input>client>vce_ifvariable[duck][==][6], not [<var:cl:duck>][==][6]
if you want to use the replacer, use input>self>vce_ifvalue[<var:cl:duck>][==][6]

(DELAY 400) Onrelay    self    firerelay

onrelay    self    spawnhomingprojectile    radiowave    closestvehicle(activeplayer maybe?)

(DELAY 3000)onrelay    self    seteventsenabled    0 1  OFF

(DELAY 6000)onrelay    self    seteventsenabled    0 1  ON

these two events will never be called, when a new relay is called it cancels all of the old onrelay events and triggers them again

(DELAY 400) Onrelay    self    firerelay

onrelay    self    spawnhomingprojectile    radiowave    closestvehicle(activeplayer maybe?)

(DELAY 3000)onrelay    self    seteventsenabled    0 1  OFF

(DELAY 6000)onrelay    self    seteventsenabled    0 1  ON
to mimic this, try doing
[200]onrelay>self>firerelay
onrelay>self>vce_modvariable[timer][+][1]
onrelay>self>vce_ifvariable[timer][<=][15][3 4]
onvariabletrue>self>spawnhomingprojectile
onvariablefalse>self>vce_ifvariable[timer][>=][30][5 5]
onvariabletrue>self>vce_modvariable[timer][set][0]
onrelay>self>toggleeventsenabled[3]