Jump to content
Sign in to follow this  
=Matt=

Createvehics in mp

Recommended Posts

hi, im still noob with editing...

i created a mission where with an interface u can select diffrent types of car. the button runs this script:

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

_vt = _this Select 0

_Upos= GetPos player

_car =_vt CreateVehicle _Upos

_car SetDir Getdir player

player MoveInDriver _car

_car Lock FALSE

_car SetPos _Upos

in single player works great...

now, i would bring this to multiplayer, but i need to make the CreateVehicle command only on the server machine, but in mp, this script is executed only by clients... :|

plz help me out

Share this post


Link to post
Share on other sites
One way to get around this is to use the network services from CoC.  Check the CoC Unified Documentation, http://www.thechainofcommand.com/docs/

then see a thread at our forums which may help hooking up NS

Just to comment this.

as I haven't read all of the documentation on your site.

So you've made an mod just to be able to handle serverside/clientside things?

Becuase this can not be accomplished in "original" OFP?

CoCn looks abit complicated, but I will surely give it a try.

Share this post


Link to post
Share on other sites

Matt, why do you need the createvehicle command to work only on the server? If the vehicle is created client-side, then it will work as well. Are there other actions that need to be added to the cars that everyone should see as well?

Share this post


Link to post
Share on other sites
Matt, why do you need the createvehicle command to work only on the server?  If the vehicle is created client-side, then it will work as well.  Are there other actions that need to be added to the cars that everyone should see as well?

I'm aware that I'm not him.

The problem is that vehicles spawned on the client if you run MP will add one vehicle to each client.

i.e.

4 clients will make 4 vehicles.

Share this post


Link to post
Share on other sites

i thought i HAD to spawn vehics only on server...

when i tryed the mission on our ded.server, it made it crash, and all the players too, no multiple spawn, because clients do it only forthemselves, but when ppl create cars, it crashes...

if i put out this script, all the rest works perfect...

@ bmgarcangel, thx yes biggrin_o.gif

Share this post


Link to post
Share on other sites

this is what the anderson gunship deathmatch thing used to create vehicles from the action menu

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

_Upos= GetPos _Unit;

_Heli="M2staticMGE" CreateVehicle _Upos;

_Heli SetDir GetDir _Unit;

_Unit MoveInDriver _Heli;

_Heli Lock FALSE;

_Heli addrating (-(rating _Heli) - 100000);

@GetDammage _Heli>= 0.7;

~30

deletevehicle _Heli;

exit;

Share this post


Link to post
Share on other sites
Are there other actions that need to be added to the cars that everyone should see as well?

yep,

u chose car during intro, just at end, i do

[vehicle pl1] exec {vrs.sqs}

pl2... and so

and that was causing the crash, at least, i suppose...

but vrs.sqs has to be launched by server...

maybe i should do a kind of list of active players on server, and apply it to them...

Share this post


Link to post
Share on other sites
One way to get around this is to use the network services from CoC. Check the CoC Unified Documentation, http://www.thechainofcommand.com/docs/

then see a thread at our forums which may help hooking up NS

Just to comment this.

as I haven't read all of the documentation on your site.

So you've made an mod just to be able to handle serverside/clientside things?

Becuase this can not be accomplished in "original" OFP?

CoCn looks abit complicated, but I will surely give it a try.

Not just to do that, but it will do that yes. It also sends arrays for example. smile_o.gif

Share this post


Link to post
Share on other sites

just put this in before the createvehicle

?!(local server):EXIT

and place a gamelogic named server in the map, and yes if you don't create only serverside it will make 1 vehicle for every player.

Share this post


Link to post
Share on other sites
just put this in before the createvehicle

?!(local server):EXIT

and place a gamelogic named server in the map, and yes if you don't create only serverside it will make 1 vehicle for every player.

Only problem is: he says all the clients run his code and the server does not smile_o.gif

You've gotta listen to the customers.. tounge_o.gif (even if they are wrong)

Share this post


Link to post
Share on other sites

tnx everyone for the help, i resolved biggrin_o.gif

the crash cause wansnt the createvehic, i can do it client only and it works perfect, but a script executed on null obj... crazy_o.gif

so finally,

OfpRacePack coming very soon.... ;)

Share this post


Link to post
Share on other sites

I found this thread by searching for server AND crash. I'm getting random crashes in my CTI map and I wondered what generally can cause this.

Just storing a bad element in an array isn't enough to cause the crash right? Will a crash happen if I attempt to execute a script on a bad element and what consitutes a bad element?

One thing I've found caused a crash was running a drop command on a null object. This happened pretty easily when attaching smoke/fire scripts to a vehicle when it died. If the script ran too long, at some point the object disappeared (my respawn script probably) and boom. Now I always use position only for my drop command. [OFFTOPIC]: to ensure your fire is actually on a dead vehicle (beacause sometimes they move when you shoot them) wait a second then check if speed is zero and set it to zero if necessary. Then pass the position of the vehicle (not the object directly) to your drop script. In the drop command the last parameter would be "" where the object usually goes.[/OFFTOPIC]

I'll compile a list of other things I see in my search:

using createvehicle to create non-vehicle/non-building units (including gamelogic) instead of createunit can have unpredictable behavior. It was reported that a unit created using createvehicle will crash the server when it dies.

Are there other common mistakes that can be made in code which will cause a crash? Will a typo in vehicle type when creating a vehicle crash? I guess I'll do some simple tests and see what my client does. I'm running 1.96 client and server btw.

I'm trying to figure out what to look for but need some guidance in order to run my tests.

thanks,

Plaz

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  

×