Jump to content
Sign in to follow this  
CarlGustaffa

Problems using setVelocity in multiplayer

Recommended Posts

Hi

I have an artillery script going which looks nice in singleplayer, but only looks nice to the guy calling the artillery in multiplayer. The relevant stuff goes something like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

sleep 1;

_releaseheight=20+random 20;

_temppos = [_artiltargetx,_artiltargety,_releaseheight];

_dummyobj="Bomb" createVehicle [0,0,0];

_device="G_40mm_HE" createVehicle [0,0,0];

_dummyobj setpos [_temppos select 0,_temppos select 1,(_temppos select 2)-0.02];

_device setpos [_temppos select 0,_temppos select 1,_temppos select 2];

sleep 1;

deleteVehicle _dummyobj;

deleteVehicle _device;

for [{_j=0}, {_j<25}, {_j=_j+1}] do

{

_deg = 14.4*_j;

_sx = sin _deg;

_sy = cos _deg;

_Bomb="G_30mm_HE" CreateVehicle [(_temppos select 0)+_sx, (_temppos select 1)+_sy, (_temppos select 2)-4];

_Bomb setVelocity [_sx*random 20,_sy*random 20,5*random 5];

sleep 0.01;

};

If I watch as bystander, these ICM bomblets (also affects my smoke airburst delivery system) are created in a circle and drops to the ground, but setVelocity fails to do its business.

There is this AL logo on the wiki setVelocity page, but I'm not sure what that is supposed to tell me. How can I make setVelocity affect my bomblets on all computers without too much fuzz?

Or should I just fall in and create them at random positions?

Share this post


Link to post
Share on other sites

To make setVelocity affect your bomblets on all computers you need to execute the command only there were your bomblets are local.

AL means the argument for the script must be local.

EG means the effects of the command are global (everyone will see the same effects derived from the command).

Share this post


Link to post
Share on other sites

Well, all "parameters" dealing with setvelocity is local to that script, obvious with the _name stuff. So this should be local enough, right?

Also, only one unit starts and processes the setfire script, which in turn starts this script dealing with this particular munition. So, it is performed on his computer only, right?

That's why I don't understand why it doesn't work. The effect seem local to me, not global... Smoke canisters look good on the computer calling the script, and just a circle of canisters on anything else.

Share this post


Link to post
Share on other sites

Nope.

"_whatever" is a local variable, what counts for the command is the content of these variables.

lets say _whatever = chopper1, then the question is: is chopper1 local to the server? is chopper1 local to the client where player PeterPan is playing?

As general for vehicles and units in MP:

- A vehicle is local to the PC where its driver is local.

- A player is local to its own PC.

- An AI soldier is local to the PC where its group leader is local.

- An AI group leader is local to the server.

- Empty vehicles are local to the server.

- Static objects are local everywhere.

- Gamelogics are local to the server.

You may use local command to check whether a unit or vehicle is local or not.

Share this post


Link to post
Share on other sites

Check my signature for MP Editor Guide.

@Mandoble; might be cool if you added some of your previous post onto the Editor Guide in my sig?

This might benefit others too

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  

×