OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Barbolani on 13 Nov 2011, 13:21:31

Title: Respawn in boat, disembark....
Post by: Barbolani on 13 Nov 2011, 13:21:31
Hello all!

I have not encountered problems with this yet, but the thing is I need my code optimized because the mission I'm planning is huge in terms of amount of units and AI enhacement.

What I want to do is, a typical boat landing and beach head mission with this procedure.

Player and its group starts in a boat. Boat reaches the shore, group disembarks.

Boat goes back to the LST

Boat gets filled of Infantry of random types (with some logic, it must be impossible to fill it with 4 medics, for example)

Boat goes back to the shore

Cargo diembarks and after it, joins group player

If boat gets killed, runs out of fuel, whatever, another boat is spawned with some penalty delay

In my limited scripting skills, the problem is to give routs and waypoints to newly created groups.

And also, If I make my typical sqs with 250 lines, won't be very optimized.

So, do you know any premade script that fits on most of the idea so I can tweak it easily?

Thanks ind advance, as allways!!!
Title: Re: Respawn in boat, disembark....
Post by: savedbygrace on 01 Jan 2012, 10:27:06
SQF gurus could help you better if you provided your script in sqs. Otherwise, what you're wanting to do is fairly simple if you knew the right commands. Check out the comref and browse through it. You'd be amazed at what is there and how simple it would be to do something like this, even with sqs and still be efficient.

Looks like a few of the commands that would help you right of the bat are///
CreateVehicle (http://www.ofpec.com/COMREF/index.php?action=details&id=86&game=All) or CreateUnit (http://www.ofpec.com/COMREF/index.php?action=details&id=85&game=All) will help you create the units (http://www.ofpec.com/COMREF/index.php?action=read&id=209) and move them into (http://www.ofpec.com/COMREF/index.php?action=details&id=222&game=All) the boat once the boat gets back to the ship. You could also remove all of their weapons (http://www.ofpec.com/COMREF/index.php?action=details&id=264&game=All) and add new ones (http://www.ofpec.com/COMREF/index.php?action=details&id=13&game=All) as you create them. Check out the weapon lists (http://www.ofpec.com/COMREF/index.php?action=read&id=210) in our comref too. Once you have all boat slots filled, send it back to the shore by adjusting a global variable that will allow a waypoint to complete, letting it continue. At that next waypoint, it could be transport unload where the boat auto unloads it's cargo. When it does that, the waypoint completes and you could insert a join (http://www.ofpec.com/COMREF/index.php?action=details&id=175&game=All) command ( or joinsilent (http://www.ofpec.com/COMREF/index.php?action=details&id=612&game=All))for each of those created units by slow looping that creation script until their vehicle is not (http://www.ofpec.com/COMREF/index.php?action=details&id=231&game=All) equal (http://www.ofpec.com/COMREF/index.php?action=details&id=854&game=All) OR (not equal (http://www.ofpec.com/COMREF/index.php?action=details&id=824&game=All)) to the boats name.
Use setfuel  (http://www.ofpec.com/COMREF/index.php?action=details&id=302&game=All)to keep it fueled up and setcaptive (http://www.ofpec.com/COMREF/index.php?action=details&id=289&game=All) to prevent it from coming under enemy fire. Of if you prefer the reality of fire, setdammage (http://www.ofpec.com/COMREF/index.php?action=details&id=292&game=All) to keep it alive.
Hope it helps pal. Happy editing.