OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Hybrid on 31 Aug 2002, 04:58:53

Title: Mid Air Pickup????
Post by: Hybrid on 31 Aug 2002, 04:58:53
                                     Hi How yah.
Well ive got a question that ive been working on all day. Well.. What im doing is combining a Halo script with a script of my own to allow players to enter vehicles in mid air. Well it all works fine except one thing. You can enter the vehicle from any point on the map. I would like it to be so that you have to be within a certain distance Ex: 5 m of the chopper. Well i hope someone can answer this. Thanks.
Title: Re:Mid Air Pickup????
Post by: Cedaie on 31 Aug 2002, 05:18:49
in a script called getin.sqs write:

_x  = _this select 0
_x  = _this select 1
_x  = _this select 2
#loop
?(_x distance helo > 5):goto "pickup"
goto "loop"
#pickup
_x moveincargo helo
#check
? (_x in helo):goto "boom"
goto "Check"
#boom
Helo setdammage 1
~1
Cedaie setmimic "smile"
; ;D
 
in an init field, type the arrays of the people you want to enter ex:

{player,Bob,Bob2] exec "getin.sqs"
Title: Re:Mid Air Pickup???? :help:
Post by: Hybrid on 31 Aug 2002, 05:26:53
I want the player to be able to activate this by him/herself by using the action menu. What you described would not allow that i think. Any other suggestions.?????? :beat: :gunman: :help: :help: :help:
Title: Re:Mid Air Pickup????
Post by: Cedaie on 31 Aug 2002, 05:28:00
yeh here i go..

In players init field
[] exec "check.sqs"

In check.sqs
#loop
?not(player distance helo > 30):goto "run"
goto "loop"

#run
player addaction ["get in chopper","getin.sqs"]
exit
in getin.sqs write
#run2
"_x moveincargo helo" foreach units group player
?(player in helo):goto "final"
goto "run2"
#final
player removeaction 0
exit

Hope it works ;)
Title: Re:Mid Air Pickup????
Post by: Cedaie on 31 Aug 2002, 05:46:16
I wonder if you can arguement a label

[#labelname] exec "script.sqs"

ans somehow that would pass everything below it, that'd be cool, 5 sqs in one!
Title: Re:Mid Air Pickup????
Post by: Hybrid on 31 Aug 2002, 06:03:06
Sry but i cant get it to work. Well the player enters the chopper but he can do it from anywhere on the map not just when hes close to the bird itself. Any other suggestions. ???? ??? ???
Title: Re:Mid Air Pickup????
Post by: LCD on 31 Aug 2002, 06:04:25
@ Cedaie :
u can pass a special name 4 each labal nd check if somthin is da name like dat

_label = _this select 0

? _label == "home" : goto "home"
? _label == "work" : goto "work"

etc  ;D

LCD OUT
Title: Re:Mid Air Pickup????
Post by: Sui on 31 Aug 2002, 06:48:33
I wonder if you can arguement a label

[#labelname] exec "script.sqs"

ans somehow that would pass everything below it, that'd be cool, 5 sqs in one!

You sure can... I use this in every single mission I make... I generally have one script for all my cutscenes (including intro and outros), and one for all my radio chatter/special event scripting. They can generally get as large as 25kb!
The first part of the script looks something like this:

Code: [Select]
_call = _this select 0
goto _call
hint "Error in Radio.sqs"
exit

#boarding
unit1 sidechat "We're boarding now"
exit

#egress
(_this select 1) sidechat "We're getting out of here!"
exit

So using that as an example, I might have this line in the get in waypoint of unit1:
["boarding"] exec "Radio.sqs"

And this in the waypoint of a unit2, exiting the combat area:
["egress",unit2 ] exec "Radio.sqs"

Saves the need to have 50 or so scripts in a mission folder ;)
Title: Re:Mid Air Pickup????
Post by: Cedaie on 31 Aug 2002, 08:27:00
hehe, kewl! Sui!

and my script above DOES work, cuz I tested it, make sure the distance is 20 or more, otherwise it wont show

try distance of 60, 60 is best distance (change 30 to 60 ;))
Title: Re:Mid Air Pickup????
Post by: Hybrid on 31 Aug 2002, 16:16:28
Ok Ive got it working. But...... sometimes the player cant get out of the chopper or eject. And that could be  big problem. Any Ideas?

NVM I figured it out. I used 2 triggers to show the action and remove it and i shortened my script down to 1 line. Anyways thansk for the help.