Jump to content
Sign in to follow this  
Taurus

init-line = crash, unit put in truck = stuck

Recommended Posts

As some might know I'm trying to make a reinforce-kind of script.

5t truck = MYTRUCK(vehicle lock: default)

game logic = SOMEPOS

This is run locally on the client:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"soldierWB" createUnit [getPos SOMEPOS, group player,"this moveInCargo MYTRUCK",0.5, "private"];

This crashes the server.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"soldierWB" createUnit [getPos SOMEPOS, group player,"",0.5, "private"];

Works, as in "server not crashing", but the unit isn't placed in the truck(ofc)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"soldierWB" createUnit [getPos SOMEPOS, group player,"",0.5, "private"];

_newUnit = ((units group player) select ((count (units group player))-1); //to get the newly created unit.

_newUnit moveInCargo MYTRUCK;

This works, the unit is placed in the truck

BUT!

I can't order him to disembark... confused_o.gif

1:4 Disembark!

4: Rodger.

But nothing happens,he is stuck.

I've tried "script kicking him" with:

unassignVehicle _x;

_x action ["GETOUT", MYTRUCK];

_x action ["EJECT", MYTRUCK];

(using forEach crew MYTRUCK)

but nothing works.

When being a remote client he just sits there sad_o.gif

When I am running a "local host", I can command my units, but the remote clients can not command theirs.

Anyone got any ideas why this happens?

help.gif

Share this post


Link to post
Share on other sites

_newUnit = "soldierWB" createUnit [getPos SOMEPOS, group player,"",0.5, "private"];

_newUnit moveInCargo MYTRUCK;

and

_newUnit leaveVehicle MYTRUCK

But...

if you want to use the variable with the soldier later you have to use a global variable which does not get destroyed.

so just use newunit instead of _newunit.

good luck

Share this post


Link to post
Share on other sites

Schwab

Unfortunatly createUnit doesn't return anything.

createUnit

I tried to be sure the wiki to be correct and indeed

_newUnit returns null.

And

_newUnit leaveVehicle MYTRUCK;

didn't do the trick either.

Share this post


Link to post
Share on other sites
Schwab

Unfortunatly createUnit doesn't return anything.

createUnit

I tried to be sure the wiki to be correct and indeed

_newUnit returns null.

And

_newUnit leaveVehicle MYTRUCK;

didn't do the trick either.

You know about the wiki, so use it, these basic things are nicely explained there.

createUnit array does return the created unit.

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  

×