Home   Help Search Login Register  

Author Topic: Adding actions  (Read 1240 times)

0 Members and 1 Guest are viewing this topic.

Victor1234

  • Guest
Adding actions
« on: 16 Jul 2006, 20:40:05 »
So, I've got a regular plane with opening rear cargo door, but no way to eject paratroopers effectively. From using the C47 addon, I've noticed that they have actions for ejecting paratroopers and supplies in a really neat way, even if the door is closed. Unfortunately, I have no clue how the code works for actions, besides the fact that it's in the config file of the pbo..so my question is, how to add an action to a plane with already functioning rear door, so that any units except pilot and gunner are ejected one at a time with a small interval in between each jump so the paratroopers don't tangle in each other's chutes and die.....and how to make it work even if the door is closed(ie, script opens the door, then ejects passengers).

Offline remcen

  • Contributing Member
  • **
  • a.k.a. hottentotten_mike
    • IM:UC
Re: Adding actions
« Reply #1 on: 18 Jul 2006, 00:28:58 »
this is rather a scripting problem than a config/addon problem IMO...

ok, from my limited knowledge of scripting:
you can have your plane executed a script with an init-eventhandler in the config by adding this to its cfgvehicle subclass:
Code: [Select]
class EventHandlers
    {
    Init="[_this select 0] exec ""\path\initscript.sqs"";";
    };

this initscript.sqs should work about like this:
check if the plane has passengers. do this by adding the crew to an array and substract driver (=pilot) and gunner. count this array (count command). loop the script to the start if this value is 0. otherwise you commence with adding an action (addaction command) to the plane. with this action you link a second script in which you add everyone in the plane to an array, substract driver and gunner and have it the units in this array parachuted (see simple paradrop scripts in the editors depot)
in the first script you count the units in the plane again, substract driver and gunner and when the value is 0 you remove the previous added action. now you loop it again to the beginning...

sorry that i cannot write down a finished script
we're looking for members: IM:UC MOD