OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: penguinman on 18 Dec 2004, 20:53:05
-
hello,
how do you get all the units in the cargo pos of an aircraft and then make them eject like one at a time, for a script
im doing this because, there are a lot of paratrooper scripts but none just automaticly get the cargo men of the helo.
they all need the groups to be entered in the activation field and i want to do a mass paradrop but dont have the time to enter every single group.
-
_plane = _this select 0
_delay = _this select 1
;eliminates all possible non-cargo units
_cargo = (crew _plane) - [driver _plane,commander _plane,gunner _plane]
_cargocount = (count _cargo) - 1
_i = -1
#loop
?_i == _cargocount:exit
_i = _i + 1
_man = _cargo select _i
_man action ["eject",_plane]
unassignvehicle _man
~_delay
goto "loop"
so you exec the script with the plane and the delay you want between each unit parachuting:
[plane1,2] exec "eject.sqs"
-
;D perfect, nice
thanks soo much this is the most usefull and robust and easy to use thing im suprised u havent entered it in the editors depot because alot of the parachute scripts in there do the same thing but are much more complicated to use. I really think you should enter it, because once people find out how much easier it is then they will all get it.
i willl make a demo mission for it if u want to enter it.
once again thanks
also, r u ever gona finish helping me with the
pythagorin theorum and it aplication to scripting,
-
one thing though
im probably wrong because u r much more experienced than me but in.
_cargo = (cargo _plane) - [driver _plane,commander _plane,gunner _plane
wouldnt
_plane
be changed to plane
i thought the _ was only used when doing the this select 0 part
-
nope, the _ defines it as a local variable, whereas if i had only put
planeit would be looking for a global variable called
plane
by using the underscore, you keep everything within the script (local). this allows for many things, one being you can run as many scripts as you want with that local variable in it, but each will retain its own value
-
about the math thing, you haven't replied on that thread
this one (http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=20788;start=45)
if you want we can talk about it over pm or you can start a thread, or we can continue on the one above, your choice
-
i just found a problem from when i typed that in :o, there was some code that didn't drop down to the next line, i fixed it, so if you tested it and it didn't work, thats why
::)
-
I really need to post everything in one post, instead of 4
i willl make a demo mission for it if u want to enter it.
sure, could you give me a link to where these other ones are so i can see just how different they are? (i don't want to look through all of the scripts their trying to find a few ejection scripts, unless its in an obvious place, which i will go check now)
I see what you mean, this kind of script isn't in there, probably because it is such an easy script, if you really think i should submit it.... :P
-
well the reason i started this topic in the first place was because i need it for a mission but now i would be happy to have this mission be the demo for your script, it is about a paratroop special assignment to take out some guns on a beach before an invasion. NO addons needed of course but if u want my old version which needs only one addon but also makes the mission better just tell me, its all up to u. il IM it to u when its finished, im just about done so u can submit. :)
sooo,
Yes i think you should submit it it is so usefull :P
EDIT: well i guess u cant put files in an IM il attach it in a post on this topic.,
ANOTHER EDIT ;)
im just about done so u can submit. :)
i mean wait till im finished making it of course
-
ok ;)
-
hmm, odd, i cant get it to work,
it gives a big error message having to do w/ the part that checks the driver,gunner and stuff.
-
can you see where the |#| is?
can you post the message?
-
ok i will rite now plz dont go to bed
-
ok it is
(cargo |#|_plane) - [driver _plane,,
thats where the |#| is
-
I think that the only possible error here would be if there is an invalid array given. Which I don't think that there is.
-
(cargo |#|_plane) - [driver _plane,,)
Whats cargo? Thats not a valid OFP command!
Your probably looking for crew
-
Yulp, he's right. Such silly mistakes.
-
:P d**n :P
-
would this be it then
_plane = _this select 0
_delay = _this select 1
;eliminates all possible non-cargo units
_crew = (crew _plane) - [driver _plane,commander _plane,gunner _plane]_crewcount = (count _crew) - 1
_i = -1
#loop
?_i == _cargocount:exit
_i = _i + 1
_man = _cargo select _i
_man action ["eject",_plane]
~_delay
goto "loop"
exit
-
it still gives an error message, this time the "|#| is here
_crew = (crew _plane) - [driver _plane,commander _plane,gunner _plane]|#|_crewcount = (count _crew) - 1
^
^
there is the |#| in the error message
-
_crew = (crew _plane) - [driver _plane,commander _plane,gunner _plane]; _crewcount = (count _crew) - 1
Planck
-
actually, that is the line i fixed previously, i had it on the next line, shouldn't matter though
-
hey it works, thanks
but this brings up a new problem,
when i try to use it on the c-130 addon which already has a para script in the action menu when in it then when i activate any other para script besides the one that came w/ c-130 addon it messes somthing up and the men are ejected and then 2 secs later there parachutes are created but not with the unit inside the parachute so basicly
they are ejected w/ out a parachute. it gets very messy. how would i fix this.
-
hmm sry that wasent very clear.
c-130 addon comes with a parachute script
when i try to use any other parachute script besides the c-130 one then the men are ejected w/ out parachutes
-
uhh.. open up the addon and see if it has any way off turning off that script, check the readme and even post the script if you can
-
oh i deleted the script from the addon and now it works
thanks.
by the way triggerhappy
i finished the mission for the script so i dont know how i should send it to u
just tell me :)
-
email, but i believe we've talked about this already
-
sry yes i had posted that before we talked