OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Morglor9 on 16 Apr 2005, 23:12:25
-
i am adding an action to search a desk to find the codepaper for Blanco's beta Codepad dialog. i was wondering how to change the distance for the action, because, (as anyone whose ever added an action before would know) actions that are added usually have a range of about 10-15m.
anyone know how to do this?
-
Yes, you can change the distance of the action but it requires a script with a loop. That is what I've used for the planholder in my timebomb script. (modified for your desk-example)
In the init of your desk : [this] exec "thisscript.sqs"
thisscript.sqs
_unit = _this select 0
_checkarray = []
_radius = 5
#loop
?!codefound && player == vehicle player && player distance _unit < _radius && !(_unit in _checkarray): act = _unit addaction ["Search desk","codefound.sqs"]; _checkarray = _checkarray + [_unit]
?!codefound && player == vehicle player && (player distance _unit) > _radius && (_unit in _checkarray): _unit removeaction act;_checkarray = _checkarray - [_unit]
~1
?codefound == 1 OR !alive player : exit
goto "loop"
codefound.sqs
(_this select 0) removeaction (_this select 2)
(_this select 1) switchmove "combattoputdown"
~2
codefound = true
hint "You have found a code"
exit
Not tested!