OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Major Draper on 31 May 2005, 15:31:20

Title: attaching vehicles, adding proximity
Post by: Major Draper on 31 May 2005, 15:31:20
Im am adapting the attaching vehicles script, in editors depot, to be activated by a guy on the ground by activating it in an action, so far it works. the only problem is that i can be any where and hit the action and it attaches on the chopper.

How can i make it not attach if the chopper is not hovering above it?
Title: Re:attaching vehicles, adding proximity
Post by: bedges on 31 May 2005, 16:09:59
hmmm... this is only a hunch, but try a trigger, doesn't have to have any size, but set it to repeating. in the 'condition' field put

Code: [Select]
not (player distance chopper_name <5)
and in the 'on activation' field put

Code: [Select]
player removeaction action_name
that assumes you've added the action using

Code: [Select]
action_name = player addaction ["This is an action","action_script.sqs"]


alternatively, at the top of your vehicle attach script, put

Code: [Select]
?not (player distance chopper_name <5):hint "The chopper isn't close enough";exit

like i say, just a hunch ;)
Title: Re:attaching vehicles, adding proximity
Post by: Major Draper on 01 Jun 2005, 00:01:46
Going off sugestion 4 i added this, this is what the add action leads to to activate script

?not ("M113a" distance aCarrier <5):hint "The chopper isn't close enough";exit

[aCarrier,M113a] exec "attachvech/1.sqs"

exit

then goes to attach vech

_carrier   = _this select 0
_cargo      = _this select 1

endCargoSession = false

goto debug

#nochmal

_x = (getPos _carrier) select 0
_y = (getPos _carrier) select 1
_z = (getPos _carrier) select 2

_cargo setPos [_x, _y, _z - 5]
_cargo setDir (getDir _carrier)

~.01

? (!endCargoSession) : goto "nochmal"

exit

i changed the player to the name of the vech, since thats what i want to have a certain distance from each other.

However in that line i get an error...    "aCarrier <|#| 5):hint"

What im trying to do is not have he person in the chopper load it but a man on the ground hits the action to attach it to the vehicle (Multiplayer, srry probably should have put it in there).
Title: Re:attaching vehicles, adding proximity
Post by: Major Draper on 02 Jun 2005, 00:10:46
Ok i think i figured a way to do it but i need to know how to get a script to switch in this...

1?not ("M113a" distance aCarrier <5):hint "The chopper isn't close enough";

2[aCarrier,M113a] exec "attachvech/1.sqs"

exit

If the chopper is withen 5 meters away then it goes to the number 2 wher the script works but if its not true then it goes to exit and not the execution
Title: Re:attaching vehicles, adding proximity
Post by: Planck on 02 Jun 2005, 00:15:44
Try this one:

?!("M113a" distance aCarrier <5): goto "exit"

[aCarrier,M113a] exec "attachvech/1.sqs"
exit

#exit
hint "The chopper isn't close enough"
exit

Edit: Are you allowed to have a '/' in the script name?
Or should it be a '\'?


Planck
Title: Re:attaching vehicles, adding proximity
Post by: Major Draper on 02 Jun 2005, 00:28:04
woot never mind i did it, case closed.... i guess i can do this stuff