Home   Help Search Login Register  

Author Topic: Advanced onmapsingleclick question  (Read 729 times)

0 Members and 2 Guests are viewing this topic.

SideWinder

  • Guest
Advanced onmapsingleclick question
« on: 06 Feb 2004, 19:07:05 »
Being commander of a T80, clicking on the map tells your crew in yellow command instructions to move to that specific location.
I'm working on a simple command engine with a dialog and use onmapsingleclick to move 'move/target' markers around the map for two groups that the the player can control while being commander of the tank.
However, my onmapsingleclick overrides the standard move command for the tank. Clicks on the map keep repositioning the markers. I added a trigger to override the move markers onmapsingleclick by creating a new onmapsingleclick when a marker has been moved.
In this last onmapsingleclick eventhandler I need to put the instructions to tell the driver of my tank to drive to the locotion corresponding to my clicking on the map.
Some possible solutions would seem te be:
(driver T80_1) move _pos
T80_1 move _pos
(commander T80_1) move _pos
(player) doMove _pos
(driver T80_1) commandMove _pos

But these combinations do not seem to work, I think I've tried all combinations of unit, doMove/move/commandMove and positions, but they all fail to move the tank (with me as commander). Often a command like "group move to .." is given in green letters, but the tank is not moving, or sometimes the driver jumps out of the tank and runs to the appointed loction.

Is it possible to recreate the internal move commands (yellow letters) for a vehicle with a trigger? What should the command be?

If you think you know, please answer, but also test your idea first, because I don't think there is an easy solution here.

SideWinder   :)

deaddog

  • Guest
Re:Advanced onmapsingleclick question
« Reply #1 on: 06 Feb 2004, 19:17:51 »
Show us the line with the onmapsingleclick command in it.

Unnamed

  • Guest
Re:Advanced onmapsingleclick question
« Reply #2 on: 06 Feb 2004, 22:09:05 »
You can test to see if the user was holding down the shift or Alt key before you process your commands:

Code: [Select]
onMapSingleClick {If (_shift) Then {mapClickArray = mapClickArray + [_pos]}}
See the ComRef here for more details and comments on commands:

onMapSingleClick

Probably best using the shift key, as Alt Map click is a short cut for the unit to DoWatch a particular location.
« Last Edit: 06 Feb 2004, 22:14:45 by Unnamed »

Offline Spinor

  • Members
  • *
  • I'm a llama!
    • The chain of command
Re:Advanced onmapsingleclick question
« Reply #3 on: 06 Feb 2004, 22:55:55 »
An onMapSingleClick handler overrides only the standard move command if it returns true, like
Code: [Select]
onMapSingleClick{_pos exec "mapclick.sqs";true}Then, a move (or dowatch) command will never be issued.

If it returns false (or nothing), both the click handler and the standard command will be executed.

Unnamed

  • Guest
Re:Advanced onmapsingleclick question
« Reply #4 on: 07 Feb 2004, 00:51:14 »
Quote
An onMapSingleClick handler overrides only the standard move command if it returns true

I see, I just tried this:

Code: [Select]
onMapSingleClick{If (_Shift) Then {_pos exec "mapclick.sqs"} ; _Shift}
This will only execute the custom map click when your holding down the shift key. Only the left shift worked for me, but I have right shift mapped to sprint.

Cheers

SideWinder

  • Guest
Re:Advanced onmapsingleclick question
« Reply #5 on: 07 Feb 2004, 12:43:53 »
It works great! Thanks Unnamed!