Jump to content
pierremgi

AI VEHICLE RESPAWN script, an alternative for BI module

Recommended Posts

On 9/27/2019 at 12:19 AM, pierremgi said:

 

Yes, the script checks for marker(s) first, then "start" as string parameter. So if a marker is named 'start", this one will be used.
What you can do is:

- mark the initial position by a marker like "veh1Start" and specify this marker in your command line : 0 = [[veh1],["veh1Start"],10,true,false] spawn MGI_fnc_VehicleRespawn;

- change my script (command line included) to read "startVeh" as string anytime you read "start". This way,(if you don't have any marker already named "startVeh", this string will operate and the true position at start will be used.

 

NOTE: There are some remaining problems, respawning on a carrier, and when UAV  has remaining waypoints, choosing the start position. I'll check that.

 

 

Just realized I did what you suggested wrong.

 

I changed the script line to:   if (_position == 'startVeh' or (_x getVariable ['emptyVeh',false])) exitWith {_pos = getPos _veh};

 

"change my script (command line included) to read "startVeh" as string anytime you read "start".    I'm a little confused about what you say here. Am I to change command line too?

 

My command line now is like this:   0 = [[veh1],["veh1Start"],10,true,false] spawn MGI_fnc_VehicleRespawn;

 

veh1Start is marker name placed at UAV position.

 

Or should I be using startVeh?

 

Thanks.

Share this post


Link to post
Share on other sites

Formerly, in these scripts, "start" is used as a string different from any marker, saying you want to use the initial position for respawning. "death" is also a specific string for respawning where the vehicle was destroyed/crashed.

 If your mod/script uses "start" as marker name, not my bad, the vehicle will respawn at this marker just because my script checks for any marker before other possibilities.

So, if you have a marker named "start" and you want to respawn at initial position, the simplest workaround is to modify the script for reading another string, no matter which one, but you must be consistent, so change "start" by "anyNameYouLike" everywhere in the script.

The result will be the same. If you read the "notice", a simple "anyNameYouLike" as parameter will be efficient for any vehicle to be respawned on its initial place.

"start" (or "anyNameYouLike") and "death" are generic. No need to refer at one vehicle. Read the explanation.

 

 

 

Share this post


Link to post
Share on other sites

Maybe I'm getting lost here... is the issue of the carrier deck height spawn resolved?

Share this post


Link to post
Share on other sites

Ahh, there's an issue with spawn height?

 

I've gotten my UAV to spawn in original position on carrier deck but not at right height.

 

I tested spawning on land and everything else seems to work fine like having same skin and loadout...

Share this post


Link to post
Share on other sites
21 hours ago, pazuzu said:

Ahh, there's an issue with spawn height?

 

I've gotten my UAV to spawn in original position on carrier deck but not at right height.

 

I tested spawning on land and everything else seems to work fine like having same skin and loadout...

Same here. I have a FLY mission out, and it's set up on the carrier...I had to use the vanilla module to be able to get the jets/choppers spawning on the deck. On the same mission, but based on a land airport, the script works flawlessly. 

Share this post


Link to post
Share on other sites
On 10/3/2019 at 11:26 AM, zagor64bz said:

Same here. I have a FLY mission out, and it's set up on the carrier...I had to use the vanilla module to be able to get the jets/choppers spawning on the deck. On the same mission, but based on a land airport, the script works flawlessly. 

 

Did you try using a marker for respawn on carrier?

Share this post


Link to post
Share on other sites
Just now, pazuzu said:

 

Did you try using a marker for respawn on carrier?

 

Marker is a bad idea. I implemented that just in case you don't want to respawn at start or death positions. I'm about to fix this problem without extra workaround but I discover that ditching disabled helo (say a stationary Huron fired by a single Titan AA MPRL) don't fire the MEH "entityKilled" when the Huron sinks and becomes wreck. It's weird. Working around (one more time!) on a specific Arma behavior.

Share this post


Link to post
Share on other sites
15 hours ago, pazuzu said:

Did you try using a marker for respawn on carrier?

Nope... I use the "START" option since I need them to re-spawn at theyr "parking" spots.

But as @pierremgi stated, we need to be patient.. he's working on it. 

 

Share this post


Link to post
Share on other sites

Corrected for spawning vehicles on carrier at sea.

+ some improvements like helo ditching and in flight edited aircraft (already flying at mission's start).

All feedback welcome. Some difficulties for respawning at death position an aircraft colliding with the ground (no previous damage). The solution needs some extra tests.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you,  pierremgi.

 

I tested it on a Sentinel I have on carrier.

 

The Sentinel respawned on deck but did not have same loadout, skin or option to use dynamic loadout addaction.

 

I used the 2nd script with this command line:   0 = [[veh1,veh2],["startpos"],10,true,false] spawn MGI_fnc_VehicleRespawn;

 

veh1 is a tank I have for defense at base and respawns perfectly with crew and same skin.

 

veh2 is the Sentinel.

 

startpos is the start position string I changed from "start" in 2 lines of the script:

 

if (_position == 'startpos' or (_x getVariable ['emptyVeh',false])) exitWith {_pos = getPosASL _veh};

 

if (_position != "startpos" && !(_x getVariable ["emptyVeh",false])) then {

 

Not sure how this command line is supposed to work:   0 = [vehicles,vehicles apply {"start"},10,true,false] spawn MGI_fnc_VehicleRespawn // here start position applies on each vehicle.

 

I appreciate your hard work.

Share this post


Link to post
Share on other sites

Thanks for your feedback.

The skin and loadout problem should be solved now. That was due to some blowing "at once" vehicles and my new performance saving EH. Please Try it now.

 

When you write: 0 = [[veh1,veh2],["startpos"],10,true,false] spawn MGI_fnc_VehicleRespawn  (I know you changed "start" for "startPos" everywhere, due to your scenario), that means veh1 will respawn on its start position, but veh2 will respawn by default on its death position. (unless you're writing ["startPos","startPos"])

 

So, 0 = [vehicles,vehicles apply {"start"},10,true,false] spawn MGI_fnc_VehicleRespawn  just means  that you apply to the array of vehicles, an array of "start" as parameter, with the same number of elements in array.

You can even write something like:

_arrayOfVeh = vehicles select {_x isKindOf "landVehicle"}+vehicles select {_x isKindOf "air"};

_arrayOfpos = (vehicles select {_x isKindOf "landVehicle"}) apply {"death"}+ (vehicles select {_x isKindOf "air"}) apply {"start"};

0 = [_arrayOfVeh,_arrayOfPos,10,true,false] spawn MGI_fnc_VehicleRespawn

if you want to respawn planes and helos on death positions and ground vehicles on start ones.

 

Don't forget, spawned vehicles are not taken into account with this kind of line. You must do a loop or use side parameter for that (or use my advanced module, to be corrected soon).

  • Like 1

Share this post


Link to post
Share on other sites
Quote

When you write: 0 = [[veh1,veh2],["startpos"],10,true,false] spawn MGI_fnc_VehicleRespawn  (I know you changed "start" for "startPos" everywhere, due to your scenario), that means veh1 will respawn on its start position, but veh2 will respawn by default on its death position. (unless you're writing ["startPos","startPos"])

 

So for every vehicle added  I have to add "startpos" to the string line to get every vehicle to respawn at start position?

 

I'll test it again and let you know how it goes.

 

Thanks.

  • Like 1

Share this post


Link to post
Share on other sites

Ok, I tested again with this command line:   0 = [[veh1,veh2],["startpos","startpos"],10,true,false] spawn MGI_fnc_VehicleRespawn;

 

I tested in editor and on my server.

 

When I blow stationary Sentinel it respawns with same skin and loadout but the dynamic loadout script does not work. I get option in action menu but loadout menu does not work (shows no selection). Also, when I scroll through action menu the highlighted part disappears as though it's selecting an invisible option...if that makes sense...)

 

If I fly the Sentinal and crash it, it respawns in original position but is traveling fast and just crashes at other side of carrier and keeps doing that.

 

I'm going to try to find out what dynamic loadout script xeno uses (it may be his own), I know it's not GOM but maybe that will help to figure that part out.

Share this post


Link to post
Share on other sites

I can't reproduce that. Check for startPos eveywhere again.

If sentinel takes velocity, that's because it's not touching ground (i.e. the deck). Check the positioning of your UAV by isTouchingGround command. (out of map cursorObject is always null, use cursorTarget or vehicle name).

 

Normally, you can recover addAction on respawn because I scripted for that. I don't know (and I don't care) if it's compatible with other mods playing with menus. I'm scripting for Vanilla (+ vehicles mods like CUP or RHS), but in any case for ACE or exotic mods altering menus. I don't know if it's your case. It's just an info.

 

I spent hours to test sentinel on carrier or ashore, with different pylons, so, except if you have a reproducible mission (or uploaded file), I can't help anymore.

Share this post


Link to post
Share on other sites

Well, I must be doing something wrong so I'll just keep working on it.

 

Thanks for the help.

  • Like 1

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

×