Home   Help Search Login Register  

Author Topic: onmapsingleclick waypoint creation?  (Read 1285 times)

0 Members and 1 Guest are viewing this topic.

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
onmapsingleclick waypoint creation?
« on: 08 Sep 2005, 08:02:59 »
I'm going to create a simple litle script (just for my self) wich allows you to make an airplane bomb a specific target selected on the map. I want to know how to add waypoints with the OnMapSingleClick command.

If the above isn't possible, ONLY if it's not possible, answer this:

is it possible to MOVE waypoints with an OnMapSingleClick command? If it is, how?
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:onmapsingleclick waypoint creation?
« Reply #1 on: 08 Sep 2005, 08:05:15 »
did you look in the comref?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:onmapsingleclick waypoint creation?
« Reply #2 on: 08 Sep 2005, 08:14:45 »
It's not possible to create waypoints directly.  However, the move command effectively creates a waypoint.

Moving a waypoint is easy as bedges implies.     Check the online comref for information on onmapsingleclick.

Plenty of reviewed ArmA missions for you to play

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:onmapsingleclick waypoint creation?
« Reply #3 on: 08 Sep 2005, 13:33:57 »
Ok I looked but I can't sort it out my self since im a rookie in scripting. Two more questions:

Can somone make a pre-made onmapsingleclick code line that makes a single unit move at the

Is it possible to name the waypoint you create with the Onmapsingleclick command so I can execute a script when the unit reaches its target?
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Kyle Sarnik

  • Guest
Re:onmapsingleclick waypoint creation?
« Reply #4 on: 08 Sep 2005, 23:07:19 »
Code: [Select]
this addaction ["Call Airstrike","airstrike.sqs"]
airstrike.sqs
Code: [Select]
_obj = _this select 0
_unit = _this select 1
_ID = _this select 2

? _obj != _unit : exit

_obj removeaction _ID

_plane = Plane1
MapClicker = _unit
MapClick = []
_n = 0
onMapSingleClick {[MapClicker,_pos,_units,_shift,_alt] exec "MapClick.sqs"}

#WaitForMapClick
~1
_n = _n + 1
? _n > 30 : goto "Expired"
? format ["%1",MapClick] == "[]" : goto "WaitForMapClick"

_pos = MapClick select 1
_target = "logic" createvehicle _pos
_target setpos _pos
_plane flyinheight 70

#MoveToTarget
~0.5
_plane domove (getpos _target)
_distance = _plane distance _target
_zpos = (getpos _plane select 2)
? _distance <= (_zpos*2) : goto "DropBomb"
goto "MoveToTarget"

#DropBomb
_plane selectweapon "LaserGuidedBombLauncher"
_plane fire "LaserGuidedBombLauncher"
_plane dofollow (leader group _plane)
exit

#Expired
hint "You failed to select a target in time, you must try again."
_ID = _obj addaction ["Call Airstrike","airstrike.sqs"]
exit

MapClick.sqs
Code: [Select]
MapClick = _this
exit

Not tested, but it should work, all you have to do is figure out the proper bomb tradjectory and change the public variables and classnames to suit your needs.

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:onmapsingleclick waypoint creation?
« Reply #5 on: 09 Sep 2005, 12:56:57 »
:O that is the exact thing I need! Thank you ;D! I was actually going to make a larger bomber execute another script wich makes it drop about 20 bombs but this is good enough.

I'm not going to solve this yet till I test it.
« Last Edit: 09 Sep 2005, 13:00:47 by OFPfreak »
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:onmapsingleclick waypoint creation?
« Reply #6 on: 10 Sep 2005, 02:13:33 »
Hm it doesn't seem to work. No errors show up but nothing happens. Can you also add hints so I know when the script activates? Also, do the player and the plane have to be named?
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:onmapsingleclick waypoint creation?
« Reply #7 on: 10 Sep 2005, 02:46:44 »
for hints, just add
Code: [Select]
Hint [i]"My Hint"[/i]
where ever you want a hint.

Yes, player and plane have to be named.
« Last Edit: 10 Sep 2005, 02:53:15 by Tyger »
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Kyle Sarnik

  • Guest
Re:onmapsingleclick waypoint creation?
« Reply #8 on: 10 Sep 2005, 03:26:44 »
Hm it doesn't seem to work. No errors show up but nothing happens. Can you also add hints so I know when the script activates? Also, do the player and the plane have to be named?

Yes you have to replace _plane = Plane1 with _plane = <nameofyourplane> for it to work correctly, and make sure you add the action to the player.

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:onmapsingleclick waypoint creation?
« Reply #9 on: 10 Sep 2005, 08:45:50 »
lol hints. why the tags?
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Kyle Sarnik

  • Guest
Re:onmapsingleclick waypoint creation?
« Reply #10 on: 10 Sep 2005, 14:42:18 »
lol hints. why the tags?

I think Tyger forgot that you can't italicize code...  ::)