Jump to content
dreadpirate

Jebus - Just Editor Based Unit Spawning

Recommended Posts

On 2/18/2018 at 2:43 PM, avibird 1 said:

How does your script do with spawning units on the second floors or rooftops ?

 

@avibird 1

With @dreadpirate's help I got this working pretty well. However what the AI do after they spawn cannot be depended upon (walking off roofs, walking away from intended position to form up on the group leader etc).

My favourite go to code was:

0 = [this, "CACHE=", 105, "PAUSE=", 100, "LIVES=", 1, "INIT=", "_proxyThis setPos [4829.398,19374.543,13.587], _proxyThis disableAI 'PATH', _proxyThis setUnitPos 'middle', _proxyThis doWatch object_1"] spawn jebus_fnc_main;

In this example the AI (singular) will spawn at 105m (pausing <=100m), will have 1 life, will spawn at position [X,Y,Z], will not move but can track targets, will kneel, and will watch an object called object_1 when it spawns.

 

Here's another if you want an AI to spawn on a turret that may be on a floor of a building:

1.Place and name empty turret, e.g. kord_1
2.Place AI on ground
3.AI init:
0 = [this, "LIVES=", 1, "CACHE=", 600, "INIT=", "_proxyThis moveinturret [kord_1, [0]]"] spawn jebus_fnc_main;

 

  • Thanks 2

Share this post


Link to post
Share on other sites

Yeah, easiest way is to put them in the 3d editor garrisoned, and in the fn_main in jebus add a line to get the posworld of every unit, then send that to a new script that will setposworld them after uncaching them or spawning them, you should disable AI path too

 

I actually have a cqb script i use for my garrisoned units that auto set-dir them to player units so they will always be facing you when you enter a room, make room clearance and urban fighting really hard even if it's a little AI cheating

 

I really like this script because it's clear to use and you can modify it to suit your needs because of how tidy the actual scripting is

Share this post


Link to post
Share on other sites

@fyci can you provide a demo mission of your CQB script that you use. I would like to see it and possible use it in this mission I am always done with.

 

@anfo thank you I will check that out. 

Share this post


Link to post
Share on other sites

@

Is there a way to turn off the CACHE once it trigger. I am working a mission and I want to use your script but I don't want the units to despawn once they are on the map. I am using this for  a CQB in a building that is around 20 by 10. I am calling the units in with this 0 = [this,"CACHE=", 20, "GAIA_FORTIFY=", "B1"] spawn jebus_fnc_main;

 

Works fine but if the players back away to regroup the units despawn! I can't have that in this mission.

Share this post


Link to post
Share on other sites
13 hours ago, avibird 1 said:

Is there a way to turn off the CACHE once it trigger. I am working a mission and I want to use your script but I don't want the units to despawn once they are on the map.

You wouldn't want to use CACHE or REDUCE in this case because the units will hide/unhide indefinitely until they use up LIVES (in your code example unlimited).

Consider syncing a trigger with the AI group instead and they will remained spawned regardless. Be mindful to add a LIVES parameter otherwise they will respawn indefinitely once all group members die.

Maybe change code to following:

0 = [this, "LIVES=", 1, "GAIA_FORTIFY=", "B1"] spawn jebus_fnc_main
  • Thanks 1

Share this post


Link to post
Share on other sites

Hello, 

 

Could you help me just for a little line ?  I try to spwan a patrol when I activate a trigger, but I have a problem.

 

I Use this line in my SquadLeader ... : 

 

Code line: 0 = [this, "PAUSE=", 0]spawn "jebus.sqf";

 

Do you have the correct line juste for this simple thing ? 

 

PS: Sorry I'm a beginner in script and sorry for mistakes I'm french :p 

 

Sayker

Share this post


Link to post
Share on other sites
2 hours ago, Sayker said:

Hello, 

 

Could you help me just for a little line ?  I try to spwan a patrol when I activate a trigger, but I have a problem.

 

I Use this line in my SquadLeader ... : 

 

Code line: 0 = [this, "PAUSE=", 0]spawn "jebus.sqf";

 

Do you have the correct line juste for this simple thing ? 

 

PS: Sorry I'm a beginner in script and sorry for mistakes I'm french :p 

 

Sayker

 

0 = [this, "PAUSE=", 0 ] spawn  jebus_fnc_main;

 

You also need to synchronise the squad leader to the trigger. 

  • Like 1

Share this post


Link to post
Share on other sites

=(( no always the same issue they are already spawn... I need Jebus folder, init.sqf and description.txt ? 

Share this post


Link to post
Share on other sites
4 hours ago, Sayker said:

=(( no always the same issue they are already spawn... I need Jebus folder, init.sqf and description.txt ? 

There is an example of trigger activated spawning in the demo mission at the Kamino Firing Range. 

If your mission folder is set up in the same way as the demo mission, it should work. 

Share this post


Link to post
Share on other sites

G'day @dreadpirate

 

Still loving your script and I use it in pretty much every mission I make now.

I'm looking for advice on how to best use this script with vehicles; particularly tanks and jets/helicopters where players might destroy or disable the vehicle but the crew/pilot survives.  JEBUS won't respawn that unit until the players hunt down and kill all the crew correct?

 

A good example is jets; players might damage the enemy jet enough that the pilot ejects but unless the players then also kill the pilot, that jet would never respawn.

 

Share this post


Link to post
Share on other sites
7 hours ago, Imperator[TFD] said:

G'day @dreadpirate

 

Still loving your script and I use it in pretty much every mission I make now.

I'm looking for advice on how to best use this script with vehicles; particularly tanks and jets/helicopters where players might destroy or disable the vehicle but the crew/pilot survives.  JEBUS won't respawn that unit until the players hunt down and kill all the crew correct?

 

A good example is jets; players might damage the enemy jet enough that the pilot ejects but unless the players then also kill the pilot, that jet would never respawn.

 

Have a look at the aircraft in the demo mission. I have a function called jebus_pilot_kill that kills the crew when they bail out. Should work for any vehicle. 

  • Thanks 1

Share this post


Link to post
Share on other sites
5 hours ago, dreadpirate said:

Have a look at the aircraft in the demo mission. I have a function called jebus_pilot_kill that kills the crew when they bail out. Should work for any vehicle. 

 

Ripper!

Appreciate this greatly mate!

 

Additionally, within that function I've added a small sleep command on line 17 so that when the jet is respawned the pilots still have a chance to eject.  I found that without it the exact second a jet was found to be !canmove the pilot was killed which didn't allow him to eject.

Here's my tiny minor change.

 

This works a treat for tanks too which is fantastic. Actually I'll have to have a fiddle with this for tanks as the crew bails too quickly.

// Kills the crew of an aircraft when they decide to bail out
// Prevents long respawn waits when aircraft crash far from the battlefield
// [_proxyThis] call jebus_fnc_pilotKill
// Optional second parameter for debugging: [_proxyThis, 'DEBUG'] call jebus_fnc_pilotKill

_aircraft = vehicle (_this select 0);

if ("DEBUG" in _this) then { _debug = true;	};

_crew = crew _aircraft;

if (_debug) then { systemChat "Jebus Pilot Kill is active";	};

waitUntil {!canMove _aircraft};

if (_debug) then { systemChat "Killing crew"; };	
sleep 15; //added to give the pilot a chance to eject using the new Jets DLC eject feature - Imperator
{deleteVehicle _x} foreach _crew;

 

  • Like 2

Share this post


Link to post
Share on other sites

@dreadpirate

Thanks amillion for this script. I was using the show hide module for a while for performance,but this script really simplifies alot of the guess work for me and reduces my time in the editor oh so much.

 

Very much appreciated.

 

EDIT:

 

Is there something i can add to the init of a ground vehicle to make it respawn once the crew leave?

 

The effect i would like is a wave of tanks respawning,but alot of the time the crew bail and run away before being killed in the ensuing explosion...also is it possible in a future update to enable units to keep their set identity? ie...this setSpeaker  male01gre  etc?

Share this post


Link to post
Share on other sites
19 hours ago, redarmy said:

@dreadpirate

Thanks amillion for this script. I was using the show hide module for a while for performance,but this script really simplifies alot of the guess work for me and reduces my time in the editor oh so much.

 

Very much appreciated.

 

EDIT:

 

Is there something i can add to the init of a ground vehicle to make it respawn once the crew leave?

 

The effect i would like is a wave of tanks respawning,but alot of the time the crew bail and run away before being killed in the ensuing explosion...also is it possible in a future update to enable units to keep their set identity? ie...this setSpeaker  male01gre  etc?

 

See above comments and you can use that script to deal with the dismounting crew.  The damaged tank remains but the crew dies and respawns with a fresh tank.

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, Imperator[TFD] said:

 

See above comments and you can use that script to deal with the dismounting crew.  The damaged tank remains but the crew dies and respawns with a fresh tank.

cheers man i thought this was just relating to ejecting and jets,i will give it a whirl

 

 

got it working,awesome

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, redarmy said:

cheers man i thought this was just relating to ejecting and jets,i will give it a whirl

 

 

got it working,awesome

I love it when I check in on this thread to answer a query and someone has taken care of it already! :-)

 

Thanks @Imperator[TFD]

  • Like 1

Share this post


Link to post
Share on other sites

Hey all

 

im trying to respawn vehicles with the same loadout/vehicle skins that i place on them within editor,however upon respawn they revert back to the default models.

 

I exported a vehicle setup for the gorgon from Virtual garage and tried to incorporate it into a Jebus respawn line using the INIT="," but im having no luck,either what im writing is wrong,or it just wont work,can anyone look at this and spot any error? The editor is pointing out the error near the start of the code but upon many attempts to alter it(many...iv not got it to work.....

 


0 = [this, "INIT=", " [(vehicle _proxyThis),  ['showCamonetHull',0], ['showBags',1,'showBags2',1], ['showTools',1], ['showSLATHull',0]
] call BIS_fnc_initVehicle;"] "GAIA_MOVE=", "1", "START=", 1700, "DELAY=", [900,1100],  "LIVES=", [15,16]] spawn jebus_fnc_main;

 

thanks

 

@dreadpirate I looked at your example of the Orca in the mission and tried to adapt it via the above lines

Share this post


Link to post
Share on other sites

you need a , between initVehicle;"] and  "GAIA_MOVE=", "1",

 

should be 0 = [this, "INIT=", "[(vehicle _proxyThis),  ['showCamonetHull',0], ['showBags',1,'showBags2',1], ['showTools',1], ['showSLATHull',0]
] call BIS_fnc_initVehicle", "GAIA_MOVE=", "1", "START=", 1700, "DELAY=", [900,1100],  "LIVES=", [15,16]] spawn jebus_fnc_main;

Share this post


Link to post
Share on other sites
5 minutes ago, fycj said:

you need a , between initVehicle;"] and  "GAIA_MOVE=", "1",

 

should be 0 = [this, "INIT=", "[(vehicle _proxyThis),  ['showCamonetHull',0], ['showBags',1,'showBags2',1], ['showTools',1], ['showSLATHull',0]
] call BIS_fnc_initVehicle", "GAIA_MOVE=", "1", "START=", 1700, "DELAY=", [900,1100],  "LIVES=", [15,16]] spawn jebus_fnc_main;

Just tried that also,its still popping up with and error...missing ;

Share this post


Link to post
Share on other sites

maybe the ; in the end of initvehicle? hard to see, i'm not with my computer to check it

Share this post


Link to post
Share on other sites
3 minutes ago, fycj said:

maybe the ; in the end of initvehicle? hard to see, i'm not with my computer to check it

No,iv tried that too,thanks though

Share this post


Link to post
Share on other sites

I'll have a look when I get a chance.

 

Ideally, I'd like to update JEBUS to save the skin and other features, but there doesn't seem to be an easy solution. 

 

If anyone has any ideas, I'd be grateful. 

  • Like 2

Share this post


Link to post
Share on other sites

@dreadpirate

Hey dreadpirate. Thx for this great script! Really helps in creating dynamic missions.

 

There were a few drawbacks for vehicle placement (backpacks in cargo didn't work, fuel/health/hitpoints were not saved)

I changed the fn_main.sqf to allow for this. It works for my case, however I do not use all your functionality and hence am not sure if the changes affect anything else for the worse.

Here is the pastebin, if you'd like to check and possibly update your version accordingly:

 

https://pastebin.com/mppdV8TL

 

Edit:

@redarmy

New pastebin also including the Object Textures and Object Materials (not sure if this was meant when you requested skins):

https://pastebin.com/nEZP7b30

 

Didn't test it in multiplayer. In singleplayer it worked for my small test - however, beware: not extensively tested at all...

  • Thanks 1

Share this post


Link to post
Share on other sites

Updated to also allow additional stuff (bags, tools, camonets etc.):

https://pastebin.com/B0He3jwZ

 

Edit: just to clarify, with the changes you don't need the INIT parameter. You can basically just edit the vehicle in the editor (e.g. via "edit vehicle appearance") and in its basic init field. The stuff will be stored by the fn_main.sqf and pushed into the new spawned vehicle.

  • Like 1
  • Thanks 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

×