Waaaaagh
I lost all my rep and my title being a jerk
- Reaction score
- 70
I am having issues with calling methods from within other methods. Am I retarded for thinking this is possible?
Gives me: "Undeclared variable Bag3__hero" and "Syntax error" on the TriggerAddAction line.
My guess is it's somehow not recognizing the method I want to call.
Side note: What does static mean? It doesn't seem to do anything... but create must be static...
JASS:
private struct hero
unit hero
unit dummy
trigger pickup
string state
method Pickup takes nothing returns nothing
endmethod
static method create takes player p, integer id, real x, real y, real face returns hero
local hero h=hero.allocate()
set h.hero=CreateUnit(p,id,x,y,face)
set h.dummy=CreateUnit(p,DummyId,GetRectMaxX(bj_mapInitialPlayableArea),GetRectMaxY(bj_mapInitialPlayableArea),0.)
call SetUnitScale(h.dummy,.001,.001,.001)
call SetUnitInvulnerable(h.dummy,true)
call UnitAddAbility(h.dummy,039;AInv039;)
set h.pickup=CreateTrigger()
call TriggerRegisterUnitEvent(h.pickup,h.hero,EVENT_UNIT_PICKUP_ITEM)
call TriggerAddAction(h.pickup,hero.Pickup)
set h.state="Main"
call GroupAddUnit(HeroGroup,h.hero)
return h
endmethod
method setstate takes string state returns nothing
set this.state=state
endmethod
method getstate takes nothing returns string
return this.state
endmethod
method onDestroy takes nothing returns nothing
call GroupRemoveUnit(HeroGroup,this.hero)
call RemoveUnit(this.hero)
call RemoveUnit(this.dummy)
endmethod
item array inventory [6]
method getitem takes integer which returns item
return this.inventory[which]
endmethod
endstruct
Gives me: "Undeclared variable Bag3__hero" and "Syntax error" on the TriggerAddAction line.
My guess is it's somehow not recognizing the method I want to call.
Side note: What does static mean? It doesn't seem to do anything... but create must be static...