Home   Help Search Login Register  

Author Topic: Blown out of a vehicle script.  (Read 1620 times)

0 Members and 1 Guest are viewing this topic.

Offline eegore

  • Members
  • *
Blown out of a vehicle script.
« on: 07 Sep 2009, 09:14:41 »

  I've been looking for but can't find a thread that had a script where an explosion blacks out the screen and ejects the player from the vehicle. 

  I've tried making my own but I have terrible scripting skills, I can barely make the camera focus on where the player is teleported to a game logic.  Does anyone know of a script similar to this? 

  All I need is the screen to go blank, and the player ends up outside, but near a ural. 

  Thanks

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Blown out of a vehicle script.
« Reply #1 on: 07 Sep 2009, 14:28:40 »
The first thing to decide is how to detect damage done to the vehicle. If it's destroyed, chances are the player is too. If it's hit by small-arms fire, chances are the player won't need to bail. Thus a hit event handler might involve too much detection of the type of 'hit' to be practical.

The next option is a slowly looping script which detects whether the vehicle canMove. If it can't, the damage is sufficient to force the player to abandon the vehicle even if it's not destroyed.

So. Call using vehicle_name exec "check_vehicle.sqs"

Code: (check_vehicle.sqs) [Select]
; variable passed to script
   _vehicle = _this

; slow loop
   #loop
   ~5
   ? (canMove _vehicle) : goto "loop"

; vehicle is sufficiently damaged

; black out
   cuttext[" ", "black out", 2]
   ~3

; all black, stop the vehicle momentum (to prevent player dying on eject)
   _vehicle setvelocity [0,0,0]

; get the player out
   unassignvehicle player
   player action["eject", _vehicle]

; black in again
   cuttext[" ", "black in", 3]

; all done
   exit


Naturally the script is only of any use when the player is actually in the vehicle calling the script. That should be enough to get you on the right track though.

Offline eegore

  • Members
  • *
Re: Blown out of a vehicle script.
« Reply #2 on: 07 Sep 2009, 16:37:39 »

  Thanks for that info.  I'll play with it. 

  I guess the script will be set off by a location trigger.  The plan is that 3 urals are driving on a road with the player in the last.  When the lead vehicle gets hit (dofire trigger) the script goes off making the screen go blank, and the player appears outside the vehicle at a Game Logic just off the road. 

  Now is there a way to make the player lay down?  Then regain control so they can stand up and get a weapon?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Blown out of a vehicle script.
« Reply #3 on: 07 Sep 2009, 19:59:28 »
See attached.
« Last Edit: 07 Sep 2009, 20:03:35 by bedges »

Offline eegore

  • Members
  • *
Re: Blown out of a vehicle script.
« Reply #4 on: 08 Sep 2009, 15:24:13 »

  Thanks for the sample mission.  With just a few tweaks on the script I got exactly what I wanted. 

  I've never used getposmarker before.  Much easier than the GL teleportation.

  Nothing beats a good sample mission, I'll have to stop talking bad about you when you aren't around Bedges. 

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: Blown out of a vehicle script.
« Reply #5 on: 20 Sep 2009, 06:29:40 »
Don't do that. He wouldn 't feel loved if we didn't talk about him.