Home   Help Search Login Register  

Author Topic: parachute script  (Read 2052 times)

0 Members and 2 Guests are viewing this topic.

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
parachute script
« on: 03 Jun 2005, 18:19:54 »
Hello,

im trying to make a script that waits untill a parachute has landed, then switchmoves the driver into a animation
Ive tried many different things but i cant get it to work, could sombody help me by making it,

thanks

Offline 456820

  • Contributing Member
  • **
Re:parachute script
« Reply #1 on: 03 Jun 2005, 18:45:08 »
well could you say some ways that youve tried so we dont suggest the same thing

Grendel

  • Guest
Re:parachute script
« Reply #2 on: 03 Jun 2005, 19:25:46 »
You need a loop checking the para's height, and when he lands then play the anim.

I've got this to work for another project already, so heres the way the code should look either incorporated into the eject script or activated by it... (it would help to know what method you are using to have the unit(s?) eject)


#altcheck
~1
_pos=getpos paranamehere
_alt=_pos select 2
?(_alt>.5): goto "altcheck"
~1

paranamehere playmove(or switchmove) "animationnamehere"

-Grendel



Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:parachute script
« Reply #3 on: 03 Jun 2005, 19:50:52 »
ok here is the script im using, it dosent need an eject part because the parachute starts in the air

_unit = _this select 0
_para = vehicle _unit
#loop
~1
_height = (getpos _unit select 2)

?_height < 1: goto"update"

goto "loop"

#update

_unit action ["EJECT",_para]

#loop2
_unit setpos getpos _para
?(getpos _unit select 2) < 1: goto "update2"
~.01
goto "loop2"



#update2
~1
_unit switchmove"paraland"
exit

« Last Edit: 03 Jun 2005, 19:51:10 by penguinman »

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:parachute script
« Reply #4 on: 03 Jun 2005, 19:53:47 »
I also tried just ejecting him and then doing it like so

_unit = _this select 0
_para = vehicle _unit
#loop
~1
_height = (getpos _unit select 2)

?_height < 1: goto"update"

goto "loop"

#update

_unit action ["EJECT",_para]


~1
_unit switchmove"paraland"
exit


the reason im ejecting him from his parachute is that normaly when it lands the man plays an animation already, right after the parachute disapeers

« Last Edit: 03 Jun 2005, 19:55:20 by penguinman »

Offline 456820

  • Contributing Member
  • **
Re:parachute script
« Reply #5 on: 03 Jun 2005, 20:02:25 »
what about

Quote
#loop
~1
;detects if paratrooper is 0 or less than 0 metres underground
? _height <= 0 : goto "anim"
~1
goto "loop"
#anim
;an extra test to make sure hes at ground level
? !_height >= 0 : goto "loop"
<put the rest of the script here eg play move anim name and so on>

Syntax not guranteed

Grendel

  • Guest
Re:parachute script
« Reply #6 on: 03 Jun 2005, 20:22:06 »
correct me if i'm wrong, but isn't the default animation the unit plays when it lands, "paraland" or are you trying to play a custom animation...

-grendel

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:parachute script
« Reply #7 on: 04 Jun 2005, 00:32:06 »
no, its an animation i made :)

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:parachute script
« Reply #8 on: 04 Jun 2005, 01:10:18 »
oh, its close,

w/ your script it does the animation after he does the default one, i also found out that he can play my animation while he is still in the parachute, so if you can find a way to keep the parachute from being deleted.

Offline 456820

  • Contributing Member
  • **
Re:parachute script
« Reply #9 on: 04 Jun 2005, 08:56:38 »
whos script is this that almost works if mine try deleting the parachute when hes about 1 or less metres from the ground then he will fall without hurting himself then perform the animation

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:parachute script
« Reply #10 on: 04 Jun 2005, 22:05:20 »
how would i delete the parachute without deleting the unit, and eject wont work because it makes him play another default anim.


Offline 456820

  • Contributing Member
  • **
Re:parachute script
« Reply #11 on: 05 Jun 2005, 09:37:23 »
the only way to do that is move the player into a parachute so if there already in a chopper and then disembarks then it wont work but try
playerp
like
bmpd for the driver of a bmp that might talk about the parachute but if the player starts at a certain height you have to move him in a parachute by creating the soldier and create a parachute then you can name the parachute.
then to delete it would be
deletevechille parachute_name

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:parachute script
« Reply #12 on: 06 Jun 2005, 03:59:04 »
ok il try it :)

Quote
deletevechille parachute_name

I think you mean deletevehicle ;)

thanks

Offline 456820

  • Contributing Member
  • **
Re:parachute script
« Reply #13 on: 06 Jun 2005, 19:16:44 »
erm probaly i can never seem to spell it no matter how hard i try thats whyi have to copy and paste it so its reconised as a command lol.
also i think i know a way this can work but it will cause alot of lag well might depending on the mission until youve landed ill put it down anyway
Code: [Select]
#loop
;detects if paratrooper is 0.1 or less than 0.1 metres from the ground
? _height <= 0.1 : goto "anim"
~0.1
goto "loop"
#anim
;an extra test to make sure hes at ground level
? !_height >= 0.1 : goto "loop"
<put the rest of the script here eg play move anim name and so on>
? _height == 0 : goto "exit"
#exit
exit

have a go with that you can change the loop time and height and so on until it works but it depends on how you did the paradrop if you moved him in the parachute instead of that script use this

Code: [Select]
#loop
;detects if paratrooper is 0.1 or less than 0.1 metres from the ground
? _height <= 0.1 : goto "delete"
~0.1
goto "loop"
#delete
;an extra test to make sure hes at ground level
? !_height >= 0.1 : goto "loop"
deletevechile paracute_name
~0.5
player playmove <anim name>
?_height == 0 : goto "exit"
#exit
exit
that should instead of play the anim delete the parachute and then play the anim wich might be a bit more smoother than the first but anyway just have a play around with either of these two scripts
good luck
« Last Edit: 06 Jun 2005, 19:20:07 by 456820 »

UNN

  • Guest
Re:parachute script
« Reply #14 on: 07 Jun 2005, 02:09:08 »
Not sure this method is what your after, but you can avoid loops using eventhandlers.

In this case I'm adding the para chute myself. But the trouble is, it looks like you have to use CamCreate rather than CreateVehicle for the chute, so I'm not sure how it will work in MP. But if your guy is jumping out of a plane, then it should not be a problem, aslong as you modify the scripts to use another GetOut event on the aircraft.

Code: [Select]
_Man=_This Select 0

_Chute=ObjNull

_Pos=GetPos _Man

_Chute="ParachuteWest" CamCreate [_Pos Select 0,_Pos Select 1,100]

_Man AssignAsDriver _Chute
_Man MoveInDriver _Chute

@!(IsNull (Driver _Chute))

_Chute AddEventHandler ["GetOut",{_This Exec "GetOut.sqs"}]

GetOut.sqs:

Code: [Select]
_Driver=Driver (_This Select 2)

_Driver SwitchMove "Stand"

UnassignVehicle _Driver

As soon as he hits the ground he will use the Stand anim, you will probably have to add more code depending on what your anim is. As the guy still moves around because of the getout action, you might have to secure him in place with SetPos or something?