Jump to content
  • 0

How to create a replay? use While?


MultiGamer

Question

Hello everyone.
How to create a continuous redo?

i use: while {true} do {code?};
but this redo is have limit on 10000 loops.

How to make more?

p.s I check for vehicle damage.
 

    while { true } do {
        if ( cursorTarget isKindOf "AllVehicles" ) then {   
            if( damage cursorTarget > 0 ) then {
                systemChat format ["damage value - [%1]", damage cursorTarget];
            };
        };
    };
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

#1.

That limit is only existent if You call the Code, where the while loop is in.

http://killzonekid.com/arma-scripting-tutorials-loops/

#2.

while { true } do {     waitUntil { cursorTarget isKindOf "AllVehicles" };       if( damage cursorTarget > 0 ) then {                systemChat format ["damage value - [%1]", damage cursorTarget];     };};

Here I do not understand how to correctly use isKindOf?.

For example:

if ( _x isKindOff "AllVehicles") then { _x setDamage 1; };

But it doesn't work...

Link to comment
Share on other sites

  • 0

#1.

That full quote makes You look retarded.

#2.

There is a typo:

IsKindOf not isKindOff

#3.

"_x" is a "magic varable", used in "count" and "forEach" loops.

Greez KiloSwiss

Okay.

while { true } do { if ( _x isKindOff "AllVehicles" ) then { _x setDamage 1; }; };

doesn't work...

maybe i'm don't understand...

Link to comment
Share on other sites

  • 0

_x is the current object when doing a forEach loop, if you are putting the loop in the middle of your code make sure it's initiated with spawn or execVM to avoid blocking other processes.  

 

I would still be tempted to separate that check loop with a spawn, ensure it exits at some point and doesn't cause unnecessary load when running.

 

Kzk,s blog is a wealth of good information.

Link to comment
Share on other sites

  • 0

_x is the current object when doing a forEach loop, if you are putting the loop in the middle of your code make sure it's initiated with spawn or execVM to avoid blocking other processes.  

 

I would still be tempted to separate that check loop with a spawn, ensure it exits at some point and doesn't cause unnecessary load when running.

 

Kzk,s blog is a wealth of good information.

Thanks for help! i'm understand.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...