Forum Jump :

Author Message


Posts: 115
Rank:


Level: Member

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

 
#1 Posted at 2016-10-12 21:43        
     
I'm trying to make a scrip that checks if a unit is dead, and if he is, then a trigger will activate that's synced to a waypoint which will make a truck move in as reinforcements. In the trigger condition box that's synced to the trucks waypoint I put
_value = 1;
Then I placed a trigger that activates when blufor enters set to execute my movement script called "Movement.sqf" in that .sqf file I have this
_value = 0;
_target = target;

while {[_value = 0] && [alive _target]} do {
	waitUntil {!alive _target};
		_value = 1;
};

target is the name of the unit that I wan't to check if he is dead.

When the trigger activates in editor a black box with a message pops up saying this script has a generic error.


Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 21
In-game name: Wak

 
#2 Posted at 2016-10-12 22:48        
     
_value = 1;
This is an assignment, not a comparison. Comparison is done with 2 equals signs '==', and there is no need to use 1s and 0s, sqf has true and false values.

_value is a private variable, so it won't carry across other scripts (or triggers), remove the underscore and make the name of it more descriptive. Something like move_truck.

So your condition field should be like this:
move_truck

Other trigger:
I don't know why you have sharp brackets around your conditions, that turns them into arrays when they're supposed to be booleans.
Also I think you want to use an if, not a while

move_truck = false;
_target = target;

if (!move_truck && alive _target) then {
    waitUntil {!alive _target};
    move_truck = true;
};

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Advertisement


Author Message


Posts: 115
Rank:


Level: Member

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

 
#3 Posted at 2016-10-13 01:13        
     
Thanks that worked. If you change the if/then statement to a while/do statement it still works though. But I'm just sticking with your if statement. *THUMBS UP*