Home   Help Search Login Register  

Author Topic: [SOLVED] cursorTarget  (Read 3880 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
[SOLVED] cursorTarget
« on: 17 Jun 2009, 19:33:30 »
Hey,

Anyone managed to get this working?

It's added in ArmA2 but the syntax it uses is wrong (or the command is dead).

http://www.arma2.com/comref/full.html#cursorTarget
« Last Edit: 17 Jun 2009, 23:46:26 by JasonO »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: cursorTarget
« Reply #1 on: 17 Jun 2009, 20:03:32 »
Yeah, it works fine for me if you ignore the example:
Code: (run in init.sqf) [Select]
[] spawn { waitUntil { hint str cursorTarget; false } };
Note that it detects vehicles, units and buildings (even map-placed buildings), but not trees or bushes.

Can't believe how much effort I had trying to make a decent workaround for this command in A1!
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: cursorTarget
« Reply #2 on: 17 Jun 2009, 20:56:10 »
Code: (init field) [Select]
glanceOfDeath = compile "waitUntil { cursorTarget setDamage (random 1); sleep 0.1; false };"; dummy = [] spawn glanceOfDeath;
... f34r!1!! :D
try { return true; } finally { return false; }

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: cursorTarget
« Reply #3 on: 17 Jun 2009, 22:07:02 »
You'll never kill anyone that way, since you are setDamageing to random 1 (which is 0 up to, but not including 1). You'll also end up healing sometimes ;)

Also confused why compiling where you could just use standard function creation with {}.
Code: (init field) [Select]
glanceOfDeath = { waitUntil { cursorTarget setDamage (random 1); sleep 0.1; false };}; dummy = [] spawn glanceOfDeath;
or even simpler:
Code: (init field) [Select]
call { [] spawn { waitUntil { cursorTarget setDamage (random 1); sleep 0.1; false };};
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: cursorTarget
« Reply #4 on: 17 Jun 2009, 23:46:15 »
Hehe.

I'm an SQS whore, and always have been - even in ArmA!

However I'm told I supposidly can benefit from SQF, so got my thinking cap out the draw. I do PHP where the kinda c++ derived syntax is very similar in places.

The commands etc are the same and most concepts of the engine I know, so just to learn that flippin' syntax!

Works great Spooner! Helped a lot :)