Forum Jump :

Author Message


Posts: 16
Rank:


Level: Member

Country: ar
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2010-03-29 19:22        
     
Hallo all!
I'm having a trouble with "AND"...

I'm making a mission but first i must clear the 'Marker' subject to proceed with the rest of the mission. Everything worked out just fine! Exept one little thing :(:
I have a marker that should be always over the squad leader of a tank platoon, but when he dies, the 2nd in charge must 'inherit' the marker, being now the leader of the group.
I've made this:

#loop
if(alive M1A1) then {"M1" setmarkerpos getpos M1A1}
if!(alive M1A1) then {"M1" setmarkerpos getpos M1A2}
if!((alive M1A1) and (alive M1A2)) then {"M1" setmarkerpos getpos M1A3}
if!((alive M1A1) and (alive M1A2) and (alive M1A3)) then {"M1" setmarkerpos getpos M1A4}
if!((alive M1A1) and (alive M1A2) and (alive M1A3) and (alive M1A4)) then {deletemarker "M1"}
goto "loop"

There, it says that: if M1A1 is still alive then the marker named M1 will be following him at all times. Then: if M1A1 is no longer alive the marker M1 will be moved over M1A2 and will be following him at all times. Then: if M1A1 & M1A2 are no longer alive the marker M1 will be moved over M1A3 and will be following him at all times. Then: if M1A1 & M1A2 & M1A3 are no longer alive the marker M1 will be moved over M1A4 and will be following him at all times. Then: if the whole squad is dead (M1A1 & M1A2 & M1A3 & M1A4) the marker M1 will be deleted.

---Unless, that SHOULD happend---

I don't know why but, if M1A1 is no longer alive the marker M1 moves over M1A4 instead of M1A2! I meant: if any squad member dies the marker M1 will ALWAYS be moving over M1A4!!! And if i kill M1A4, indifferent wether the others are dead or not, the marker M1 gets deleted!
I'd really don't understand this! I've used the "AND" lots of times and i'd never ran into any trouble!

PS: i DID change the sequence and all.. This were my past tries: ?!(alive M1A1) and ?!(alive M1A2) and ?!(alive M1A3)) or if!(alive M1A1) and if!(alive M1A2) and if!(alive M1A3) or if!(alive M1A1) and (alive M1A2) and (alive M1A3) or if!((alive M1A1) and !(alive M1A2) and !(alive M1A3)) or the one shown above if!((alive M1A1) and (alive M1A2) and (alive M1A3)).

Really appreciate an answer!
Thanks all!


Author Message

Dead3yez  

I am evil


Posts: 3113
Rank:


Level: Member

Country: en
Location: North Yorkshire
Occupation: dead3yez
Age: 29
In-game name: dead3yez

 
#2 Posted at 2010-03-30 02:44        
     
All exist? M1A1-4 ?

#loop
if(alive M1A1) then {"M1" setmarkerpos getpos M1A1}
if(!alive M1A1) then {"M1" setmarkerpos getpos M1A2}
if((!alive M1A1) and (!alive M1A2)) then {"M1" setmarkerpos getpos M1A3}
if((!alive M1A1) and (!alive M1A2) and (!alive M1A3)) then {"M1" setmarkerpos getpos M1A4}
if((!alive M1A1) and (!alive M1A2) and (!alive M1A3) and (!alive M1A4)) then {deletemarker "M1"}
~1
goto "loop"

Try this. Put delay there otherwise CPU usage will be terrible.


Advertisement


Author Message


Posts: 16
Rank:


Level: Member

Country: ar
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2010-03-31 23:40        
     
Thanks you Dead3yez!
As always, it worked just fine ;)!