Home   Help Search Login Register  

Author Topic: distance with addaction command help?  (Read 3047 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
distance with addaction command help?
« 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..
Who's hyped for Arma4, long live Arma!

Offline Gcfungus

  • Members
  • *
Re: distance with addaction command help?
« Reply #1 on: 25 Apr 2008, 21:27:09 »
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:
Code: [Select]
actionID = playername addaction ["textdisplayed","script.sqs"if you need any more help, just ask.
-=GC=-Fungus1999
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: distance with addaction command help?
« Reply #2 on: 25 Apr 2008, 22:48:34 »
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..

Who's hyped for Arma4, long live Arma!

Offline Gcfungus

  • Members
  • *
Re: distance with addaction command help?
« Reply #3 on: 25 Apr 2008, 23:00:35 »
Try this:
Code: [Select]
#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
« Last Edit: 25 Apr 2008, 23:02:44 by Gcfungus »
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: distance with addaction command help?
« Reply #4 on: 25 Apr 2008, 23:41:48 »
It works great, a lot of work just to get the game to recognize the player 5ft from the truck, lol...
Who's hyped for Arma4, long live Arma!

Offline Gcfungus

  • Members
  • *
Re: distance with addaction command help?
« Reply #5 on: 26 Apr 2008, 00:01:46 »
It's not a huge script, and only took me 5 mins to make  :P
Anyway, good luck with your mission.  :)
-=GC=-Fungus1999
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: distance with addaction command help?
« Reply #6 on: 26 Apr 2008, 03:18:01 »
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:   :)
Who's hyped for Arma4, long live Arma!

Offline Sparticus76

  • Members
  • *
Re: distance with addaction command help?
« Reply #7 on: 26 Apr 2008, 03:23:29 »
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..
Code: [Select]
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...
Code: [Select]
aP removeaction actionID
 :dunno:

Offline Kommiekat

  • Members
  • *
Re: distance with addaction command help?
« Reply #8 on: 26 Aug 2011, 11:34:14 »
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"

______________________________________

Offline robertoHrvat

  • Members
  • *
    • Area 51 modification
Re: distance with addaction command help?
« Reply #9 on: 26 Aug 2011, 12:12:37 »
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.
RobertoHrvat

Offline Kommiekat

  • Members
  • *
Re: distance with addaction command help?
« Reply #10 on: 26 Aug 2011, 16:31:54 »
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...