Jump to content
Sign in to follow this  
Taurus

Checking locality?

Recommended Posts

TST_1=

{

waitUntil {(call compile _this) != objNull};

_myVar = (call compile _this);

// More stuff you need to execute

};

which you can spawn with:

"car1" spawn TST_1;

(Make sure before executing this, "car1" is either an object or objNull)

That code gave me an headache until I realized its a script not put in a file biggrin_o.gif

So that would make the "content" of _myVar visible all over the server?

Another thing is... when you use functions and setVehicleInit, you can work without naming things smile_o.gif

I don't see how, but I figure it out I guess wink_o.gif

I use functions to return stuff for me to use in other scripts like

_formatTime = [362] call formatToMinsSec;

(this reminds me of a pitfall I fell into the other day/night/morning)

having a for-loop which uses _i = 0 and etc, which calls upon a function/script which also uses a for-loop defined in the same way, VERY interesting results returns I might add biggrin_o.gif or :cry: rather.

I solved this by making sure I used private on variables which has the same name.

I dunno why it should be needed as variables defined with them little underscores should be "script local" confused_o.gif

car1 = "hmmwv" createVehicle [0,0];

car1 setVehicleInit "player moveInCargo this";

processInitCommands;

(and alike) could save a lot of pains with naming units and getting things done on different clients etc.

Ye, but will the server know which "player" to put into the car?

BTW, I solved my "fill ammocrate with stuff on clients" using a similar thing, I need to put in some dedications in my scripts me thinks wink_o.gif

In my time I learned that I tried things way way way too complicated... With a little thinking here and there, you can execute nearly everything on the server, which makes things already a lot more easy. And on the other hand you can make a lot of effects and things simply local on every client.. In usual situations you do not have to public/global var too much.

Thats the evolution of game and script-knowledge.

The more you learn, the more you can optimize it, and along the way you go

banghead.gif WHY didn't I think of this BEFORE!!??

The setVehicleInit and processInitCommands, are not only to execute something once, or at the very beginning. You can use setVehicleInit all over the whole match, and use it to execute code over the network.

Will I need to use it more than ones?

Description:

Process statements stored using setVehicleInit. The statements will only be executed once even if processInitCommands is called multiple times.

I think I don't know exactly what the text above is trying to tell me.

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  

×