Home   Help Search Login Register  

Author Topic: onMapSingleClick & setPos  (Read 1035 times)

0 Members and 1 Guest are viewing this topic.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
onMapSingleClick & setPos
« on: 24 Mar 2003, 18:28:57 »
I have a little bit of code (see below) ..... CSM is the group that is moving.     bob is meant to be a gamelogic:  when CSM get to where they have been told to go, its proximity to bob triggers a radio message as you can see.

The bizarre thing is, this script works perfectly ... as long as bob is a soldier/civilian.   If he is a GL or an object like a tent or invisible H, it doesn't work.

Any ideas?    Solutions?   Workarounds?    

Many thanks

--------------------------

#move

onMap=false

onMapSingleClick {CSM move _pos; leader CSM sidechat "CSM Moving on"; bob setPos _pos; onMap=true; onMapSingleClick {}}

@onMap


#marker

"CSMmarker" setMarkerPos getPos (leader CSM)

~4

? bob distance leader CSM <= 10: leader CSM sideChat "CSM.  In position."; "CSMmarker" SetMarkerType "End"; "CSMmarker" setMarkerColor "ColorBlue"; exit

goto "marker"
« Last Edit: 24 Mar 2003, 20:24:44 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:onMapSingleClick & setPos
« Reply #1 on: 24 Mar 2003, 21:41:42 »
strange  :o

mebe try changin

 bob distance leader CSM

to

bob distance (leader CSM)

only thing i can think bout ;D

noder thing is - da csm is movin right ?

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:onMapSingleClick & setPos
« Reply #2 on: 24 Mar 2003, 21:48:53 »
very strange

you can even make "bob" a marker and move that with setmarkerpos .... but then you can't, for some reason, bob setpos marker (yes I use different names).

If bob is a GL then the CSM moves ok but the distance if ... then doesn't work.

I'll try playing with brackets, you never know.   It works beautifully if bob is a soldier:  even when he gets run over by one of the vehicles  ;D.     CSM moves no problem, and thanks to your tips the tanks don't have to go too ::)

Thanks m8
« Last Edit: 24 Mar 2003, 21:59:20 by macguba »
Plenty of reviewed ArmA missions for you to play

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:onMapSingleClick & setPos
« Reply #3 on: 24 Mar 2003, 21:56:04 »
prooly should b  bob setpos getmarkerpos "marker" :P ::)

tel me if it works ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:onMapSingleClick & setPos
« Reply #4 on: 24 Mar 2003, 22:03:15 »
lol yes I did use

bob setpos getmarkerpos "marker"

I may be bad at syntax but I'm not that bad.    ;D  Same problem.   bob does not get set to the pos.   That's why its such a bizarre problem, its not even directly attributable to onmapsingleclick.

*suddenly thinks - I haven't tried rebooting.    first rule of using Windows ......*
Plenty of reviewed ArmA missions for you to play

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:onMapSingleClick & setPos
« Reply #5 on: 24 Mar 2003, 22:18:11 »
lol mebe rebootin wil do ;D

try debugin it (make radio call wid hint dat sais wat is da distance between da CSM and bob) tel mewat it returns wen it suposed 2 b close ;D

LCD OUT

[edit] also try setposin urself 2 bobs pos 2 know if it realy setposed ;D
« Last Edit: 24 Mar 2003, 22:19:05 by LCD »
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:onMapSingleClick & setPos
« Reply #6 on: 24 Mar 2003, 23:44:16 »
Rebooting and brackets didn't help, but I have more information on what is happening.

If you use a soldier, it gets setposed to ground level

If you use an empty vehicle, it gets setposed to the same x-z position, but -106 on the y, which I presume to be sea level.

This explains why interposing a marker didn't help - they must be at sea level too.

It looks as if the _pos returned by onMapSingleClick is essentially at sea level, but there is a hardcoded fix for soldiers.   Does that make sense?



(aside - I don't know much about the format command either  ;D  This works

_far = bob distance Tank1C
_position = position bob

titletext [format ["bob distance %1\nposition %2",_far,_position],"plain",1]

but I couldn't figure out how to make it a hint.    ???  )



Plenty of reviewed ArmA missions for you to play

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:onMapSingleClick & setPos
« Reply #7 on: 25 Mar 2003, 00:31:11 »
k if dats all da prob i have a solution ;D

just wen u setpos it do like dat

bob setPos [_pos select 0, _pos select 1,0]

bout da hint thing

hint format ["%1",bob distance Tank1C]

:cheers:

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:onMapSingleClick & setPos
« Reply #8 on: 25 Mar 2003, 01:18:40 »
bingo

works like a charm now

many thanks LCD, my saviour as ever  8)

(I was putting too many " " in the hint thing.)
Plenty of reviewed ArmA missions for you to play