Jump to content
Sign in to follow this  
Zolner

Force Eject

Recommended Posts

Hello, I am looking for a way to force soldiers to eject without having a human manually command them to do it, I am trying to get some paradrops working. I saw the AI do it in the demo in the island-wide fight, what are the commands to do it in the editor? Does it need a script? I have tried everything that looks as it it might make them jump out like "get out, transport unload, unload" but they try to land, is all.

Thank you in advance.

Share this post


Link to post
Share on other sites

Just found a little script to do that the other day.

Paradrop.sqs

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

_heli = _this select 0

_jumper = _this select 1

_aunits=units _jumper

_i=0

_j=count _aunits

#HERE

(_aunits select _i) action["eject",_heli]

unassignvehicle (_aunits select _i)

_i=_i+1

~1

?_j>_i:goto "HERE"

exit

Put this in a trigger or waypoint's Onact section

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[Chopper_11, squad_11] exec "paradrop.sqs"

Where chopper_11 is the name of the chopper and Squad_11 is the name of the group to exit the chopper.

Share this post


Link to post
Share on other sites

How do you give a group a name? I can only name one unit, if i try to name a second unit squad_11 i get an error

Share this post


Link to post
Share on other sites

just as jackass888 said.. but instead of doing that on the hole squad.. just do it on the squad leader

Share this post


Link to post
Share on other sites
just as jackass888 said.. but instead of doing that on the hole squad.. just do it on the squad leader

There is a problem in multiplayer if you name groups like that (only in one unit's initialization field).

If the unit which has the "squad_11 = group this" on its initialization field does not end up into the mission (doesn't get selected in the multiplayer lobby to be either a human player or an AI unit) then the squad_11 variable will not be initialized and the mission will fail to work correctly.

So when editing multiplayer missions make sure the mission will not get broken if players will not select a unit to be in the mission.

Share this post


Link to post
Share on other sites

But it should still work for an AI-squad which is groupnamed in mp?

Share this post


Link to post
Share on other sites

Can you assign a group for MP by adding that init line for the group you are interested in? Like if you had 32 players on OPFOR and wanted them all grouped add this line for each of the player objects

"squad_11 = group this"

Would that solve the MP issue by not missing any?

Share this post


Link to post
Share on other sites
But it should still work for an AI-squad which is groupnamed in mp?

Well yes if the group is all-AI so that the players can't have any effect on if the AI unit with the variable initialization ends up into the mission. Ask yourself a question: will the unit with the variable initialization code be always present in the mission, regardless of what people choose in the multiplayer lobby? If the answer is positive, then you have no problem with this.

Can you assign a group for MP by adding that init line for the group you are interested in? Like if you had 32 players on OPFOR and wanted them all grouped add this line for each of the player objects

"squad_11 = group this"

Would that solve the MP issue by not missing any?

That should do it, yes. Even if there is only one player in the session, no matter which one of the units is selected by the player, the variable is always initialized.

Take in notice that there can also be a situation where players do not select any units from a group with playable units, and AI units are disabled. This would mean no units from that group is present in the mission, and your mission should still go on error-free. In other words, if you have multiple groups with playable units in a multiplayer mission, do not expect all of them to be present in the mission (one player is enough to start a multiplayer mission). If you absolutely must have a certain group present in the mission, you must somehow force the players to choose characters from that group. In such case you may need to prevent wrong logical behaviour of the mission by stopping the mission right after start and telling the players to choose the required characters in order to proceed with the mission.

Multiplayer mission editing has lots of gotchas like these, it's not even near as simple as single player mission editing.

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  

×