Jump to content
Sign in to follow this  
Taurus

My units disembark from truck?

Recommended Posts

This code is executed local at the player

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_newunit = _tmpGroup createUnit ["SoldierWB", getPos GAMELOGIC, [], 0, "FORM"];

_newunit assignAsCargo MYTRUCK;

_newunit moveInCargo MYTRUCK;

orderGetIn true doesn't work I need to "moveInCargo" them else they wont board the truck.

I get the new units in my group alright, and I see the little "boarded to truck"-icon on them.

Then server side I have the truck moving, and when it reaches the area

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

if(_x == (DRIVER MYTRUCK))then{

}else{

sleep 0.6;

unAssignVehicle _x;

_x leaveVehicle MYTRUCK;

_x action ["GETOUT", MYTRUCK];

_x action ["EJECT", MYTRUCK];

[_x] orderGetIn false;

};

}forEach crew MYTRUCK;

And the units are still sitting in the truck...

I can not order them to disembark using, nor could I use "action eject" the action command is grayed out.

It seems I do not "own" my own units, and apparently nobody else does either?

This works ofc in "singel player"(preview) but beeing a remote client it fails.

help.gif

Share this post


Link to post
Share on other sites

This is a typical story but you could set the truck damage to like .8 and when they get out set it back to 0 in the same script.

Share this post


Link to post
Share on other sites

Op4 BuhBye

I tried that.

Well not in a scripted way, but hammering on it with my .50 cal, and the only unit who disembarked was the driver.

My units sat there, complaining they were injured, but they didn't disembark sad_o.gif

Share this post


Link to post
Share on other sites

ok, I got insane.

I discarded the hope of beeing able to transport the newly created units in the truck as I can not get control over them even tho' they are IN my group!

Neither could I "disembark" them using all possible ways using scripts.

So...

I spawned new units by the truck when it arrived at the position, and joined them directly to my group(and the other players)

Script executed locally and everything, no worries, or atleast that was what I thought...

Worked when I was the remote client on a dedicated server.

It didn't work for a remote client when I was hosting a "local server"

*sigh*

And the whole thing is because the script I was having to begin with didn't work because the truck got stuck in some areas, or not finding the path between cities.

(pathing...)

Does anyone has a MP-safe re-inforcement script that sends units in a truck and then disembark them from the truck and lastly add the new units to the player group?

I'm not very keen on downloading some mod or huge script-library in order to make such a simple thing working.

Share this post


Link to post
Share on other sites

Getting insane has its benefits obviously!

My computer table and my calculator had a furious conversation and they persuaded me to try another thing.

Namely:

Disembarking the driver from the truck so the players could enter and THEN making the player OWN their units again, hotfix or not, it works!

So, if anyone is interested, PM me and I'll send you my findings regarding ferrying troops by a truck, which are spawned dynamically, the troops that is.

In the meantime I'm getting more and more obsessed with the number three as Tesla was.

3*2 = hehe

Share this post


Link to post
Share on other sites

Ok, as my insanity has settled to a controllable level, I start by apologizing for reviving this thread.

This because I have another question about this.

See this scenario:

MyTruck is placed in the editor.

NOTE:

When I refer to MP i'm talking about remote clients(dedicated host and others joining local server)

then upon a certain event I want to reinforce the players.

This is done from a script, which check player locality

(obviously this isn't run at all if the player group is at full strenght)

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

if(local player)then { //Don't have 1.06 for isServer

_trukVehcl = _this select 0; //The truck MyTruck

_ShouldSize = _this select 1; //Preset size

_oldGroup = (group player);

_grpUCount = _grpUCount = {alive _x} count (units _oldGroup);

_newUGroup = createGroup west;

//Re-structure group, place player as first again!

[player] join _newUGroup;

(units _oldGroup) join player;

//reinforce!

for [{_i = 0}, {_i < (_ShouldSize - _grpUCount)}, {_i = _i + 1}] do{

_newSpawnU = [_newUGroup,"SoldierWB",_trukVehcl] call spwnNewUn;

_newSpawnU moveInCargo _trukVehcl;

sleep 0.3;

};

};

This works in MP but the player IS NOT allowed to order the units to disembark(the reason to why I posted this thread to begin with)

Now I got bold and thought

"Maybe I can't order them to disembark because they are not assigned and then moving into the vehicle as they would normally?"

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

if(local player)then { //Don't have 1.06 for isServer

_trukVehcl = _this select 0; //The truck MyTruck

_ShouldSize = _this select 1; //Preset size

_oldGroup = (group player);

_grpUCount = _grpUCount = {alive _x} count (units _oldGroup);

_newUGroup = createGroup west;

//Re-structure group, place player as first again!

[player] join _newUGroup;

(units _oldGroup) join player;

//reinforce!

for [{_i = 0}, {_i < (_ShouldSize - _grpUCount)}, {_i = _i + 1}] do{

_newSpawnU = [_newUGroup,"SoldierWB",_trukVehcl] call spwnNewUn;

_newSpawnU assignAsCargo _trukVehcl;

[_newSpawnU] orderGetIn true;

sleep 0.3;

};

};

Nope, didn't work!, even in SP

Troops not loading into truck.

Because, "Why in the name of <something> would I, the supreme player and rule of my troops order them by a script when I can "command" them from my menu?"

And putting a waitUntil{_newSpawnU in _trukVehcl}

In the for-loop had its problems as the truck began to move, and you can't expect a simple soldier to outrun and "James bond"-jump into the truck...

Please have in mind that I just tried this briefly and it was done 5 AM this morning.

As I can't dynamically count player group number from the server, what to do?

Sure I could sleep the "move truck" script for 30 minutes to be sure that all players and their reinforcements are done, but it shouldn't be needed, or that is what I hope.

So...

Then I thought

"ok, so maybe I should spawn them into the truck drivers group?, because the AI leader always waits for their units to load!"

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

if(local player)then { //Don't have 1.06 for isServer

_trukVehcl = _this select 0; //The truck MyTruck

_ShouldSize = _this select 1; //Preset size

_oldGroup = (group player);

_grpUCount = _grpUCount = {alive _x} count (units _oldGroup);

_newUGroup = createGroup west;

//Re-structure group, place player as first again!

[player] join _newUGroup;

(units _oldGroup) join player;

_truckGroup = (group (driver _trukVehcl));

//reinforce!

for [{_i = 0}, {_i < (_ShouldSize - _grpUCount)}, {_i = _i + 1}] do{

_newSpawnU = [_truckGroup,"SoldierWB",_trukVehcl] call spwnNewUn;

_newSpawnU assignAsCargo _trukVehcl;

[_newSpawnU] orderGetIn true;

sleep 0.3;

};

};

_tmpGroup = (units _truckGroup) - [(units _truckGroup) select 0];

//Wait for them to get in, or else it would be as the second example

//as they don't get the chance to load

{

waitUntil{_x in _trukVehcl};

}forEach _tmpGroup;

//Remove driver from group

_tmpGroup join player;

This works in SP

BUT in MP they units will not load into the truck...

However they do spawn, but stand stupidly next to the truck.

And obviously I wont get my troops as the "waitUntil" wont be true.

(still wants some BIS developer to explain why on earth they are sadistically enough to put us mission makers through all this pain because they(BIS) have these locality issues)

As you all know, testing/debugging MP is a pain and very tiredsome as you need to wait for ever to load the mission when running a dedicated server, and counting in the CPU load of the poor computer will make the game when you DO get on to it, very very choppy...

If you still are with me and has read to this line.

Conclusion:

The truck is local to the server.

moveInCargo

Works!, even tho the truck is local to the server confused_o.gif

It shouldn't IMHO as:

_unit assignAsCargo _truck;

[_unit] orderGetIn true;

Does not!

Now, my last questions to those who knows about locality, something I will never get hold of...

Can this be done in some way, other than having to struggle with actually assigning the player to a group on the playable unit in the editor, and then getting bald with selecting which group that player is in as we do not have "playersInGame select 0" to get the players.

And then publicVariable the new group?

OR

Sleeping the "move truck" script for a great while of time?

AND

Why, just why, aren't I allowed to order my groups to disembark if I am NOT the driver(leader) of the truck?

ps: hopefully this will be my first unedited post, re-read it 10 times, grammar lessons not paid for.

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  

×