- Joined
- Nov 30, 2007
- Messages
- 1,202
I want to create a fake target ability and to this end I'd need to override the mouse cursor, is it possible to change it to the generic select target cursor?
What I want to achieve is something with the following syntax:
An alternative is using:
What I want to achieve is something with the following syntax:
JASS:
struct PlayerCursor extends array
private static thistype first
private static thistype last
private static thistype cur
private static timer t
private thistype prev
private thistype next
private boolean inList
private real aoe//0 == single target
private trigger trgOnPressed
private effect cursor // dummy visual effect
boolean targetUnit
boolean targetItem
boolean targetDestructable
private static method onMouseMove takes nothing returns nothing
set cur = first
loop
exitwhen cur == 0
// move effect to moseXY
set cur = cur.next
endloop
endmethod
method getSingleTarget takes real x, real y returns handle
endmethod
method operator aoe= takes real r returns nothing
// update effect if need be, if 0 than single target cursor
endmethod
method start takes nothing returns nothing
if inList then
return
endif
if first == 0 then
set first = this
set last = this
set this.prev = 0
if t == null then
set t = CreateTimer()
endif
call TimerStart(t, 0.03125, true, function thistype.onMouseMove)
else
set last.next = this
set this.prev = last
set last = this
endif
set this.next = 0
set this.inList = true
endmethod
method stop takes nothing returns nothing
if not inList then
return
endif
if first == this then
set first = first.next
if first != 0 then
set first.prev = 0
else
call PauseTimer(t)
endif
elseif last == this then
set last = last.prev
set last.next = 0
else
set this.prev.next = this.next
set this.next.prev = this.prev
endif
set this.inList = false
endmethod
endstruct
An alternative is using:
-
Selection - Select (Triggering unit) for Player 1 (Red)
-
Game - Force Player 1 (Red) to press the key A
-
Game - Force Player 1 (Red) to press the key B
Last edited: