- Joined
- Nov 2, 2004
- Messages
- 1,993
Is it not possible to use a non-static method as a condition for a trigger? This script gives me the error "this is not an struct name", about this.RallyPoint when adding it as a condition.
JASS:
struct Barracks
readonly unit barracks
readonly group units = CreateGroup()
readonly trigger trgRally = CreateTrigger()
integer spawn_amount
integer spawn_type
private method RallyPoint takes nothing returns boolean
if OrderId2String(GetIssuedOrderId()) == "setrally" then
call GroupPointOrder(this.units, "attack", GetOrderPointX(), GetOrderPointY())
endif
return false
endmethod
public static method create takes unit barracks, integer spawn_amount, integer spawn_type returns Barracks
local Barracks this = Barracks.allocate()
local unit createdUnit
local real x = GetUnitX(barracks) + 200
local real y = GetUnitY(barracks) - 200
local integer index = 0
set this.barracks = barracks
set this.spawn_amount = spawn_amount
set this.spawn_type = spawn_type
call UnitAddAbility(barracks, 'ARal')
call IssuePointOrder(barracks, "setrally", x, y)
loop
set createdUnit = CreateUnit(GetOwningPlayer(barracks), spawn_type, x, y, bj_UNIT_FACING)
call GroupAddUnit(this.units, createdUnit)
set index = index + 1
exitwhen index == spawn_amount
endloop
call TriggerRegisterUnitEvent(this.trgRally, barracks, EVENT_UNIT_ISSUED_POINT_ORDER)
call TriggerAddCondition(this.trgRally, function this.RallyPoint)
return this
endmethod
method destroy takes nothing returns nothing
call DestroyGroup(this.units)
call DestroyTrigger(this.trgRally)
call this.deallocate()
endmethod
endstruct
Last edited: