OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: NightJay0044 on 25 Apr 2008, 21:12:24
-
Hi I'm creating a mission where I want to use the addaction command. I know how to put it in the trigger, but the thing is do you need an an external sqs script to use the addaction command?
What I'm trying to do, I'm trying to make it so when the player close to a truck the addaction will appear, like he's a certain distance away from the truck, say like 3 feet, or 5 feet, whichever. It's basically a script with 2 objects, one being the player and the other being an East Side Ural truck and the action will occur when the player is close to the truck.
Any help with this, that would be appreciated, thank you..
-
For adding the action you do not need a script itself, however you will need a script to run as a consequence of the addaction.
Code for adding an action:
actionID = playername addaction ["textdisplayed","script.sqs"
if you need any more help, just ask.
-=GC=-Fungus1999
-
Yes actually thanks, in an sqs script from the addaction command. How do you make an action appear when the player is a certain amount of distance from a truck?
Like say if the player 5ft from the truck the action will appear for the player to use..
-
Try this:
#check
_dis = aP distance truck1
~0.1
?(_dis > 5): goto "check"
actionID = aP addaction ["actionname","script.sqs"]
#check2
_dis = aP distance truck1
~0.1
?(_dis < 5): goto "check2"
aP removeaction actionID
goto "check"
I haven't checked it myself, and it may have some flaws/spelling mistakes but from what I can see it should work.
You can just run this from the start, not on a trigger as it will continuously loop and check itself.
-=GC=-Fungus1999
-
It works great, a lot of work just to get the game to recognize the player 5ft from the truck, lol...
-
It's not a huge script, and only took me 5 mins to make :P
Anyway, good luck with your mission. :)
-=GC=-Fungus1999
-
Indeed, if you know what your doing, scripts reduce there work load by half or more. But I'll make sure upon completion of the mission to announce your help of the small script in the read me file or intro...
:check: :)
-
Could it also be done with a 5 x 5 trigger placed over the truck, activated by player present, activates once, and this is on activation..
actionID = aP addaction ["actionname","script.sqs"]
Then have another trigger in the same location 5 x 5, activated by player not present, activates once, with this on activation...
aP removeaction actionID
:dunno:
-
Greetings,
Could I please have a little more help with this script of yours, GcFungus?
I want the player to activate the object, using a console only when they are inside the radius.
They will set up some coordinates and the Radar Telescope will "Pitch and Yaw" into position to pick up signals.
The Player will see the console early in the game with Radio command, but I want it "crippled" some how.
Just don't know how to do it.
Trigger is:
On Act: ActivateTheRadar = unit1 addaction ["ActivateRadar","script.sqs"]
On Dea: Unit1 RemoveAction ActivateTheRadar
My player is Unit1
Object is RT (it's a Radar Telescope)
I want a distance of 100
I am confused about the "script.sqs"
Do I need this in my missions folder and what goes inside? Your script below and I assume I need to change some variable in your script?
-truck1 will be RT
-?(_dis > 100):
-ActivateTheRadar = unit1 addaction ["ActivateRadar","script.sqs"]
OK so far?
_______________________________________________________
#check
_dis = aP distance truck1
~0.1
?(_dis > 5): goto "check"
actionID = aP addaction ["actionname","script.sqs"]
#check2
_dis = aP distance truck1
~0.1
?(_dis < 5): goto "check2"
aP removeaction actionID
goto "check"
______________________________________
-
Easier is make a trigger with condition and activation box:
1. Make trigger with radius 0-0
2. in "Condition box" write: player distance truck<5 (name of vehicle must be a truck)
3. in "Activation box" write: player addaction ["TextDisplay","ScriptName.sqs"]
NOTE: You can change PLAYER addaction in TRUCK addaction ;)
That's it.
-
Thanks, managed to get it working.
Problem was, I still had a 0-0-0 Juliet trigger on the map.
Trigger for the Radio Telescope
Condition: player in thislist
On Act: act = player addAction ["ActivateRadar","rt.sqf"]
rt.sqf is the script created by Mondkalp for his Radio Telescope found in his MGB Buildings2.
On Dea: player removeAction act
Works like a charm, so far...