OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: penguinman on 18 Dec 2004, 20:53:05

Title: cargos for paradropping
Post 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.
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 02:24:19
Code: [Select]
_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"
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 03:00:57
 ;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,
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 03:05:57
one thing though
im probably wrong because u r much more experienced than me but in.
Quote
_cargo = (cargo _plane) - [driver _plane,commander _plane,gunner _plane

wouldnt

Code: [Select]
_plane
be changed to
Code: [Select]
plane
i thought the
Code: [Select]
_ was only used when doing the this select 0 part
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 03:56:52
nope, the _ defines it as a local variable, whereas if i had only put
Code: [Select]
planeit would be looking for a global variable called
Code: [Select]
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
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 04:00:21
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
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 04:03:37
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
 ::)
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 04:53:11
I really need to post everything in one post, instead of 4

Quote
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
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 05:45:37
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 ;)


Quote
im just about done so u can submit. :)
i mean wait till im finished making it of course
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 06:07:59
ok  ;)
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 06:16:28
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.
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 06:46:59
can you see where the |#| is?
can you post the message?
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 07:09:39
ok i will rite now plz dont go to bed
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 07:16:33
ok it is

(cargo |#|_plane) - [driver _plane,,


thats where the |#| is

Title: Re:cargos for paradropping
Post by: Bluelikeu on 19 Dec 2004, 09:34:02
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.
Title: Re:cargos for paradropping
Post by: Korax on 19 Dec 2004, 09:40:35
(cargo |#|_plane) - [driver _plane,,)

Whats cargo? Thats not a valid OFP command!
Your probably looking for crew
Title: Re:cargos for paradropping
Post by: Bluelikeu on 19 Dec 2004, 09:56:20
Yulp, he's right. Such silly mistakes.
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 15:51:26
 :P d**n :P
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 19:30:59
would this be it then

Code: [Select]
_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
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 21:16:59
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
Title: Re:cargos for paradropping
Post by: Planck on 19 Dec 2004, 21:27:17
Code: [Select]
_crew = (crew _plane) - [driver _plane,commander _plane,gunner _plane]; _crewcount = (count _crew) - 1


Planck
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 21:57:00
actually, that is the line i fixed previously, i had it on the next line, shouldn't matter though
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 22:44:14
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.
Title: Re:cargos for paradropping
Post by: penguinman on 19 Dec 2004, 22:45:55
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
Title: Re:cargos for paradropping
Post by: Triggerhappy on 19 Dec 2004, 22:58:45
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
Title: Re:cargos for paradropping
Post by: penguinman on 20 Dec 2004, 01:12:52
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 :)
Title: Re:cargos for paradropping
Post by: Triggerhappy on 20 Dec 2004, 04:23:50
email, but i believe we've talked about this already
Title: Re:cargos for paradropping
Post by: penguinman on 21 Dec 2004, 04:49:06
sry yes i had posted that before we talked