Home   Help Search Login Register  

Author Topic: addaction  (Read 461 times)

0 Members and 1 Guest are viewing this topic.

AE7THSF

  • Guest
addaction
« on: 17 Jan 2003, 09:26:05 »
im making a mission  where u have to kill this officer and he has a map of the area,to see the map u have to use action menu but i dont want u to see the action till u get 4 feet from him.


ty in advanced

Offline uiox

  • Contributing Member
  • **
Re:addaction
« Reply #1 on: 17 Jan 2003, 13:35:30 »
If you really want 4 feet you can't use addaction to objects, cause the detect area is biggest than 4 ft.

A method:
U need :

In init.sqs

ObjectBodyvar addEventHandler ["killed",{_this exec "detectScript.sqs"}]



DetectScript.sqs

runScript = true
ActionIsInstall = false
Onarea = false

#Loop
~0.001
? !(runscript) : exit
if (ObjectBodyvar distance player < 4) then {Onarea = true} else {Onarea = false}
? Onarea &&  !(ActionIsInstall ) : ActionIsInstall = true;_ID = player addaction ["Take map", "Map.sqs"]
? !(Onarea) && ActionIsInstall :ActionIsInstall = false; player removeAction _ID
Goto "Loop"

Map.sqs
player removeAction _This select 2
hint "Yep! a map!"
runscript = false
showMap true

Not test.
« Last Edit: 17 Jan 2003, 13:43:31 by uiox »