OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Artak on 24 Jun 2003, 18:18:55

Title: Drop command acting up in MP?
Post by: Artak on 24 Jun 2003, 18:18:55
Hello folks,

I've made this little script to enhance an mp mission which is all about flying in the air..

Code: [Select]
#start

AAfire = 1
_c = 1
_color = [[0,0,0,0.85],[0,0,0,0.9],[0,0,0,0.4], [0, 0, 0,0]]
_size = [10,30]
_lifetime = 60
_timer = 60
_vel = [1,1,1]
_plane = _this select 0
_AApos = _this select 1

#loop

?!(alive _plane): exit
?_plane distance _AApos > 650: AAfire = 0; exit

~random(1)+0.2

_bearing = random(360)
_distance = random(40)+50
_ypos = (getpos _plane select 2) + (random(25)-random(25))

?(local server): _shell1 = "mortarshell" createvehicle [(getpos _plane select 0) + sin (getdir
_plane + _bearing) * _distance, (getpos _plane select 1) + cos (getdir _plane + _bearing) * _distance, _ypos]

_pos = getpos _shell1
_x = _pos select 0
_y = _pos select 1
_z = _pos select 2

drop ["cl_basic", "", "Billboard", _lifetime, _timer, [_x, _y, _z], _vel, 0, 0.2, 0.157, 1, _size, _color, [0], 0, 0, "", "", ""]

?(local server): _shell11 = "mortarshell" createvehicle [getpos _shell1 select 0,getpos _shell1 select 1,(getpos _shell1 select 2)]

_bearing = 0
_distance = 0
goto "loop"

Works like a charm for me but now for the others connected to a game hosted by me!
They say it gives a "genric error" from the drop command, but I don't see it.

Thus I can see the drop created little smoke cloud, but the others can't which isn't funny  :P


Why?  :o
Title: Re:Drop command acting up in MP?
Post by: Artak on 24 Jun 2003, 19:05:43
hmpf g'daem I went and solved the bugger on my own  :P ;D

The problem was that I was creating the two mortar shells locally, but the drop command was naturally set to go off globally.
Now because the drop command took it's coordinates from the locally created shell, it couldn't take them on anywhere else than on the server machine thus giving the genric error message.
Title: Re:Drop command acting up in MP?
Post by: Chris Death on 25 Jun 2003, 11:59:44
Quote
_bearing = random(360)
_distance = random(40)+50
_ypos = (getpos _plane select 2) + (random(25)-random(25))


You might also get different results on each machine with
the random's above.

You should create the random value local on server and then
publicVariable 'em as global variable.

~S~ CD
Title: Re:Drop command acting up in MP?
Post by: Tactician on 25 Jun 2003, 12:33:56
Those three random variables are only used ?(local Server) so there's no place for discrepance.  Still they could be skipped by clients to reduce overhead :)

Looking again, I see that a random number after a ~ could be trouble.  But the peanut gallery is debugging Artak's scripts for him!
Title: Re:Drop command acting up in MP?
Post by: Chris Death on 25 Jun 2003, 13:17:14
uh - yeah i can see now they're only used serverside,
but created global.

OK, then they don't cause more than just the clients to be
busy without the need to be  ;D

~S~ CD
Title: Re:Drop command acting up in MP?
Post by: Artak on 26 Jun 2003, 10:17:05
Uh.. You're right guys. Thanks for the hint  ;)