Home   Help Search Login Register  

Author Topic: Eject script  (Read 1289 times)

0 Members and 4 Guests are viewing this topic.

KyleSarnik

  • Guest
Eject script
« on: 18 Jun 2003, 02:51:03 »
How do I make a script that adds an "Eject" action to a vehicle (plz don't ask why)

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Eject script
« Reply #1 on: 18 Jun 2003, 03:45:01 »
put in da init of da vehicle

this addaction ["Eject","eject.sqs"]

now da script wil b

eject.sqs

Code: [Select]
_man = _this select 0
_veh = _this select 1

unassignvehicle _man
[_man] ordergetin false

but da script may not eject da unit from da veh - i donno cuz i cant test it w/ ur veh :P ;)

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

KyleSarnik

  • Guest
Re:Eject script
« Reply #2 on: 18 Jun 2003, 04:35:41 »
that does nothing. I need to make a script where  I can add an Eject action to the player unit. I want it to act like a real eject action. It should remove the action after he ejects or gets out or when he is on the ground (its for a chopper)

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Eject script
« Reply #3 on: 18 Jun 2003, 11:31:38 »
dont chopers have eject action usualy ?

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

KyleSarnik

  • Guest
Re:Eject script
« Reply #4 on: 18 Jun 2003, 18:40:53 »
Yea but with DKMs Comanche you cant eject. I think this is because you can't dissembark unless the doors are open.

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Eject script
« Reply #5 on: 18 Jun 2003, 19:59:24 »
make a trigger which checks for the player being in the chopper:

player in choppername

then on activation

eject = player addaction ["Eject", "eject.sqs"]

now use this script:

Code: [Select]

player action ["EJECT", choppername]
unassignvehicle player

player removeaction eject
exit

that should work
« Last Edit: 18 Jun 2003, 19:59:54 by Messiah »
Proud Member of the Volunteer Commando Battalion

KyleSarnik

  • Guest
Re:Eject script
« Reply #6 on: 18 Jun 2003, 20:51:32 »
Thx messiah. Works perfectly  ;D

Now im going to try to get it to remove the eject action when the chopper is on the ground.

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Eject script
« Reply #7 on: 18 Jun 2003, 21:07:15 »
make another trigger with condition:

(choppername getpos select 2 == 0)

and then onactivation:

player removeaction eject

not sure about the first line - off the top of my head, but its worth a try  :D


Proud Member of the Volunteer Commando Battalion

Offline Black_Feather

  • Former Staff
  • ****
  • I'll never forget you Daisey.
Re:Eject script
« Reply #8 on: 18 Jun 2003, 22:49:16 »
it should be this messiah

getpos choppername select 2 <=1

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Eject script
« Reply #9 on: 18 Jun 2003, 23:48:08 »
 :-[
Proud Member of the Volunteer Commando Battalion

Offline Grinning_Giant

  • Members
  • *
  • Do not let them get away with it!
Re:Eject script
« Reply #10 on: 19 Jun 2003, 00:22:50 »
Why do AddActions sometimes disapear when you board a vehicle?

And then u get out and they are back again  :-\

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Eject script
« Reply #11 on: 19 Jun 2003, 00:25:38 »
hmmm... ive noticed that in reverse...

if u have an addaction added to an object, and u get into a vehicle nearby with that action still in your menu, then the action will remain with you as far as ud rive the vehicle - even if u r no where near the object the action was added to...

ofp bug i think.
Proud Member of the Volunteer Commando Battalion

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Eject script
« Reply #12 on: 19 Jun 2003, 03:06:33 »
When a unit boards a vehicle, as far as some things go (eg. actions), the units position remains at the point where it boarded the vehicle.

This is why you have to add actions to a vehicle if you want the player to be able to use them ;)
Also, as far as OFP is concerned the player is still near the object which had the action (which presumably was back where you boarded), so the action remains in your action menu...

If you're killed while riding in a vehicle, do you sometimes notice that the death cam will focus on the position where you boarded the vehicle? It's the same sort of thing ;)

Offline Grinning_Giant

  • Members
  • *
  • Do not let them get away with it!
Re:Eject script
« Reply #13 on: 20 Jun 2003, 12:37:19 »
 :D Oh, Classic...

So you just add the action to the empty vehicle?

I'm gonna give it a whirl  ::)

Offline Grinning_Giant

  • Members
  • *
  • Do not let them get away with it!
Re:Eject script
« Reply #14 on: 20 Jun 2003, 12:57:49 »
Hmm, seems to work fine...

But there is no pleasing some people. lol

If I wanted to make the action appear only when the player is in the vehicle I guess I would have to use this script right?

Code: [Select]
;Init: [Jeep] exec "Action.sqs"

_Jeep = _this select 0
_Unit = Player

#Start
#Loop
?_Unit in _Jeep : Goto "Action"
~0.5
goto "Loop"

#Action
_Jeep addAction ["Hello", "hello.sqs"]  

#LoopB
?!(_Unit in _Jeep) : Goto "RemoveAction"
~0.5
goto "LoopB"

#RemoveAction
_Jeep removeAction 0

Goto "Start"


Wahoooo!! I tested it and it works perfick!!  8)  ;D  8)

Please advise me of my scripting errors, I'm still learning.

P.S. How do I use the @ command instead of using stupid Loops

« Last Edit: 20 Jun 2003, 13:32:44 by Grinning_Giant »

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Eject script
« Reply #15 on: 20 Jun 2003, 13:29:38 »
Yeah... either that or use a trigger... though:

@? (Player in _Jeep) : Goto "Action"

Should be just:

@ player in _Jeep

and similarily for the next line using @
The @ will wait for the condition specified to be true before moving on to the next line. You shouldn't be using a ? in there ;)

If you wanted to use a trigger, it would look something like this:

Trigger

Radius: 0,0
Condition: none (repeatedly)
Condition Field: (vehicle player) != player
OnActivation Field: (vehicle player) = veh; veh addaction addAction ["Hello", "hello.sqs"]  
OnDeactivation Field: veh removeaction 0

Offline Grinning_Giant

  • Members
  • *
  • Do not let them get away with it!
Re:Eject script
« Reply #16 on: 20 Jun 2003, 13:37:39 »
ah, hehe just noticed this reply... I edited my post

I tried afew combinations with the @ symbol and it didnt work.

I'd like to keep my scripts as small and tidy as possible, does anybody know of a good tutorial? I have used Johan Gustafsson's which taught me everything I know (almost) and Comrefs are very brief.