Jump to content
Sign in to follow this  
gopgop

What is wrong with this code? popup targets + this code makes my game lag

Recommended Posts

_rtarget = _this select 0;
_j = 0;
while (_j<5) {
if (_rtarget animationPhase "terc" > 0.1) then {
_rtarget animate["terc", 1];
_j = _j+1;
};};

i have a target that initiates with this animate["terc",1];

then when you get close to it using a trigger it calls target animate["terc",0] then calls this script

like so: _nil = target execVM "target.sqf";

all i want to happen is that after the target comes up when the player shoots it it will stay down. after i shoot it it goes down then back up...

and it lags the game..

Share this post


Link to post
Share on other sites

private ["_j","_rtarget"];
_rtarget = _this select 0;
_j = 0;
while {_j<=5} do {
if (_rtarget animationPhase "terc" > 0.1) then {
_rtarget animate["terc", 1];
_j = _j+1;
sleep 1;//change to whatever delay you need, this is 1 second.
};
};

Lots of Syntax errors - corrected.

Also do you need a sleep in there or it executes too fast? Not sure why it would cause significant lag as it only executes 5X (unless it was syntax errors?), you might have something wrong somewhere else?

Edited by PELHAM

Share this post


Link to post
Share on other sites

private ["_j","_rtarget"];
_rtarget = _this select 0;
_j = 0;
while {_j<=5} do {
if (_rtarget animationPhase "terc" > 0.1) then {
_rtarget animate["terc", 1];
_j = _j+1;
sleep 1;//change to whatever delay you need, this is 1 second.
};
};

can someone just make this that when it is executed using a trigger then if the target goes down, then it will stay down...

Share this post


Link to post
Share on other sites

Try

private ["_j","_rtarget"];

nopop=true;

_rtarget = _this select 0;
_j = 0;
while {_j<=5} do {
if (_rtarget animationPhase "terc" > 0.1) then {
_rtarget animate["terc", 1];
_j = _j+1;
sleep 1;//change to whatever delay you need, this is 1 second.
};
};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×