OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: BAD ASS JACK on 26 Jun 2003, 17:49:44

Title: addactions and distance
Post by: BAD ASS JACK on 26 Jun 2003, 17:49:44
ok where do i start...?

hi, im trying to set up a trigger system that uses distance from player the exec script, but using distance from wasent accurent enough and you could use the addaction on the other side of the wall! ::)

so now i got a trigger set up so if player is in place addaction an addaction apears, and when u are out of place the addaction disapears, and if u go back into the trigger it comes back again, now the problem is making it removeaction again?, which it wont do  ??? and because it wont remve action but can keep adding them your action list can get pretty screwed up with all the actions :-\

any help would be great  ;D
Title: Re:addactions and distance
Post by: Knut Erik on 27 Jun 2003, 13:36:15
About your second Qs. You'll have to give the action an ID. Like this..

MyActionID = Player addaction ["BlahBlah","Blah.sqs"]

And then in the deActivation field

Player RemoveAction MyActionID

The first Qs.
I dunno...  :P
Title: Re:addactions and distance
Post by: max_killer_payne on 28 Jun 2003, 10:09:00
Something along the lines of this, of course you would need to edit it for your own purposes.

_unit = _this select 0
_player = _this select 1
?runonce: goto "whenadd"
actionnumber = 0

this means at 5m the addaction will come on, and when you leave 5m, it will come off

#whenadd
?(_player distance _unit < 5): goto "action"
~0.3
goto "action"

#action
runonce=true
action = _player AddAction ["Do Thingy","thingy.sqs"]
;here I am IDing the action, to a name which is action, so when you use the action in the game OFP will recognise you just used 'action'
~0.3
goto "start"

#start
?nameofthisscript: goto "whathappens"
?(_player distance _unit) < 5: goto "start"
_player RemoveAction (action)
actionnumber = (actionnumber + 1)
goto "action"

#whathappens
titletext["Yes! We got it","plain",2]
;or whateva u want to happen here
goto "nomore"

#nomore
nameofurscript=false
_player removeaction action
actionnumber = (actionnumber + 1)
exit

Title: Re: addactions and distance
Post by: Kommiekat on 26 Aug 2011, 10:40:29
So, where exactly does that code go?
Into a Triggers On Act field??

Thx