OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: JasonO on 17 Jun 2009, 19:33:30

Title: [SOLVED] cursorTarget
Post by: JasonO 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
Title: Re: cursorTarget
Post by: Spooner 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!
Title: Re: cursorTarget
Post by: Worldeater 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
Title: Re: cursorTarget
Post by: Spooner 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 };};
Title: Re: cursorTarget
Post by: JasonO 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 :)