• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

a simple overview of built-in events

Status
Not open for further replies.
Level 13
Joined
Nov 7, 2014
Messages
571
This is a simple overview of the built-in events:

JASS:
//
// gamevent
//
constant gameevent EVENT_GAME_VICTORY = ConvertGameEvent(0)
constant gameevent EVENT_GAME_END_LEVEL = ConvertGameEvent(1)

constant gameevent EVENT_GAME_VARIABLE_LIMIT = ConvertGameEvent(2)
     constant limitop LESS_THAN = ConvertLimitOp(0)
     constant limitop LESS_THAN_OR_EQUAL = ConvertLimitOp(1)
     constant limitop EQUAL = ConvertLimitOp(2)
     constant limitop GREATER_THAN_OR_EQUAL = ConvertLimitOp(3)
     constant limitop GREATER_THAN = ConvertLimitOp(4)
     constant limitop NOT_EQUAL = ConvertLimitOp(5)
     native TriggerRegisterVariableEvent takes trigger whichTrigger, string varName, limitop opcode, real limitval returns event
     //constant native string GetTriggeringVariableName takes nothing returns string

constant gameevent EVENT_GAME_STATE_LIMIT = ConvertGameEvent(3)
     constant native GetEventGameState takes nothing returns gamestate
     native TriggerRegisterGameStateEvent takes trigger whichTrigger, gamestate whichState, limitop opcode, real limitval returns event

constant gameevent EVENT_GAME_TIMER_EXPIRED = ConvertGameEvent(4)
     native TriggerRegisterTimerExpireEvent takes trigger whichTrigger, timer t returns event // Triggers when the timer you tell it about expires
     native TriggerRegisterTimerEvent takes trigger whichTrigger, real timeout, boolean periodic returns event // Creates it's own timer and triggers when it expires

constant gameevent EVENT_GAME_ENTER_REGION = ConvertGameEvent(5)
     constant native GetTriggeringRegion takes nothing returns region
     constant native GetEnteringUnit takes nothing returns unit
     native TriggerRegisterEnterRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event

constant gameevent EVENT_GAME_LEAVE_REGION = ConvertGameEvent(6)
     constant native GetTriggeringRegion takes nothing returns region
     constant native GetLeavingUnit takes nothing returns unit
     native TriggerRegisterLeaveRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event

constant gameevent EVENT_GAME_TRACKABLE_HIT = ConvertGameEvent(7)
     constant native GetTriggeringTrackable takes nothing returns trackable
     native TriggerRegisterTrackableHitEvent takes trigger whichTrigger, trackable t returns event

constant gameevent EVENT_GAME_TRACKABLE_TRACK = ConvertGameEvent(8)
     constant native GetTriggeringTrackable takes nothing returns trackable
     native TriggerRegisterTrackableTrackEvent takes trigger whichTrigger, trackable t returns event

constant gameevent EVENT_GAME_SHOW_SKILL = ConvertGameEvent(9)
constant gameevent EVENT_GAME_BUILD_SUBMENU = ConvertGameEvent(10)
constant gameevent EVENT_GAME_SAVE = ConvertGameEvent(259)
constant gameevent EVENT_GAME_LOADED = ConvertGameEvent(256)
constant gameevent EVENT_GAME_TOURNAMENT_FINISH_SOON = ConvertGameEvent(257)
constant gameevent EVENT_GAME_TOURNAMENT_FINISH_NOW = ConvertGameEvent(258)

native TriggerRegisterGameEvent takes trigger whichTrigger, gameevent whichGameEvent returns event


//
// gamestate event
//
type gamestate extends handle
type igamestate extends gamestate
type fgamestate extends gamestate
constant igamestate GAME_STATE_DIVINE_INTERVENTION = ConvertIGameState(0)
constant igamestate GAME_STATE_DISCONNECTED = ConvertIGameState(1)
constant fgamestate GAME_STATE_TIME_OF_DAY = ConvertFGameState(2)
constant native GetEventGameState takes nothing returns gamestate
native TriggerRegisterGameStateEvent takes trigger whichTrigger, gamestate whichState, limitop opcode, real limitval returns event


//
// playerevent
//
constant playerevent EVENT_PLAYER_STATE_LIMIT = ConvertPlayerEvent(11)
     native TriggerRegisterPlayerStateEvent takes trigger whichTrigger, player whichPlayer, playerstate whichState, limitop opcode, real limitval returns event

constant playerevent EVENT_PLAYER_ALLIANCE_CHANGED = ConvertPlayerEvent(12)
     native TriggerRegisterPlayerAllianceChange takes trigger whichTrigger, player whichPlayer, alliancetype whichAlliance returns event

constant playerevent EVENT_PLAYER_DEFEAT = ConvertPlayerEvent(13)
constant playerevent EVENT_PLAYER_VICTORY = ConvertPlayerEvent(14)
constant playerevent EVENT_PLAYER_LEAVE = ConvertPlayerEvent(15)

constant playerevent EVENT_PLAYER_CHAT = ConvertPlayerEvent(16)
     constant native GetEventPlayerChatString takes nothing returns string // returns the actual string they typed in ( same as what you registered for if you required exact match )
     constant native GetEventPlayerChatStringMatched takes nothing returns string // returns the string that you registered for
     native TriggerRegisterPlayerChatEvent takes trigger whichTrigger, player whichPlayer, string chatMessageToDetect, boolean exactMatchOnly returns event

constant playerevent EVENT_PLAYER_END_CINEMATIC = ConvertPlayerEvent(17)
constant playerevent EVENT_PLAYER_ARROW_LEFT_DOWN = ConvertPlayerEvent(261)
constant playerevent EVENT_PLAYER_ARROW_LEFT_UP = ConvertPlayerEvent(262)
constant playerevent EVENT_PLAYER_ARROW_RIGHT_DOWN = ConvertPlayerEvent(263)
constant playerevent EVENT_PLAYER_ARROW_RIGHT_UP = ConvertPlayerEvent(264)
constant playerevent EVENT_PLAYER_ARROW_DOWN_DOWN = ConvertPlayerEvent(265)
constant playerevent EVENT_PLAYER_ARROW_DOWN_UP = ConvertPlayerEvent(266)
constant playerevent EVENT_PLAYER_ARROW_UP_DOWN = ConvertPlayerEvent(267)
constant playerevent EVENT_PLAYER_ARROW_UP_UP = ConvertPlayerEvent(268)

constant native GetTriggerPlayer takes nothing returns player
native TriggerRegisterPlayerEvent takes trigger whichTrigger, player whichPlayer, playerevent whichPlayerEvent returns event


//
// playerstate event
//
constant playerstate PLAYER_STATE_GAME_RESULT = ConvertPlayerState(0)
constant playerstate PLAYER_STATE_RESOURCE_GOLD = ConvertPlayerState(1)
constant playerstate PLAYER_STATE_RESOURCE_LUMBER = ConvertPlayerState(2)
constant playerstate PLAYER_STATE_RESOURCE_HERO_TOKENS = ConvertPlayerState(3)
constant playerstate PLAYER_STATE_RESOURCE_FOOD_CAP = ConvertPlayerState(4)
constant playerstate PLAYER_STATE_RESOURCE_FOOD_USED = ConvertPlayerState(5)
constant playerstate PLAYER_STATE_FOOD_CAP_CEILING = ConvertPlayerState(6)
constant playerstate PLAYER_STATE_GIVES_BOUNTY = ConvertPlayerState(7)
constant playerstate PLAYER_STATE_ALLIED_VICTORY = ConvertPlayerState(8)
constant playerstate PLAYER_STATE_PLACED = ConvertPlayerState(9)
constant playerstate PLAYER_STATE_OBSERVER_ON_DEATH = ConvertPlayerState(10)
constant playerstate PLAYER_STATE_OBSERVER = ConvertPlayerState(11)
constant playerstate PLAYER_STATE_UNFOLLOWABLE = ConvertPlayerState(12)
constant playerstate PLAYER_STATE_GOLD_UPKEEP_RATE = ConvertPlayerState(13)
constant playerstate PLAYER_STATE_LUMBER_UPKEEP_RATE = ConvertPlayerState(14)
constant playerstate PLAYER_STATE_GOLD_GATHERED = ConvertPlayerState(15)
constant playerstate PLAYER_STATE_LUMBER_GATHERED = ConvertPlayerState(16)
constant playerstate PLAYER_STATE_NO_CREEP_SLEEP = ConvertPlayerState(25)
     constant native GetTriggerPlayer takes nothing returns player
     constant native GetEventPlayerState takes nothing returns playerstate
native TriggerRegisterPlayerStateEvent takes trigger whichTrigger, player whichPlayer, playerstate whichState, limitop opcode, real limitval returns event


//
// player alliance change event
//
constant alliancetype ALLIANCE_PASSIVE = ConvertAllianceType(0)
constant alliancetype ALLIANCE_HELP_REQUEST = ConvertAllianceType(1)
constant alliancetype ALLIANCE_HELP_RESPONSE = ConvertAllianceType(2)
constant alliancetype ALLIANCE_SHARED_XP = ConvertAllianceType(3)
constant alliancetype ALLIANCE_SHARED_SPELLS = ConvertAllianceType(4)
constant alliancetype ALLIANCE_SHARED_VISION = ConvertAllianceType(5)
constant alliancetype ALLIANCE_SHARED_CONTROL = ConvertAllianceType(6)
constant alliancetype ALLIANCE_SHARED_ADVANCED_CONTROL= ConvertAllianceType(7)
constant alliancetype ALLIANCE_RESCUABLE = ConvertAllianceType(8)
constant alliancetype ALLIANCE_SHARED_VISION_FORCED = ConvertAllianceType(9)
     constant native GetTriggerPlayer takes nothing returns player
native TriggerRegisterPlayerAllianceChange takes trigger whichTrigger, player whichPlayer, alliancetype whichAlliance returns event


//
// playerunitevent
//
constant playerunitevent EVENT_PLAYER_UNIT_ATTACKED = ConvertPlayerUnitEvent(18)
     constant native GetAttacker takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_RESCUED = ConvertPlayerUnitEvent(19)
     constant native GetRescuer takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_DEATH = ConvertPlayerUnitEvent(20)
     constant native GetKillingUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_DECAY = ConvertPlayerUnitEvent(21)
     constant native GetDecayingUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_DETECTED = ConvertPlayerUnitEvent(22)
     constant native GetDetectedUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_HIDDEN = ConvertPlayerUnitEvent(23)

constant playerunitevent EVENT_PLAYER_UNIT_SELECTED = ConvertPlayerUnitEvent(24)
     //constant native GetSelectedUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_DESELECTED = ConvertPlayerUnitEvent(25)

constant playerunitevent EVENT_PLAYER_UNIT_CONSTRUCT_START = ConvertPlayerUnitEvent(26)
     constant native GetConstructingStructure takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_CONSTRUCT_CANCEL = ConvertPlayerUnitEvent(27)
     constant native GetCancelledStructure takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_CONSTRUCT_FINISH = ConvertPlayerUnitEvent(28)
     constant native GetConstructedStructure takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_UPGRADE_START = ConvertPlayerUnitEvent(29)
constant playerunitevent EVENT_PLAYER_UNIT_UPGRADE_CANCEL = ConvertPlayerUnitEvent(30)
constant playerunitevent EVENT_PLAYER_UNIT_UPGRADE_FINISH = ConvertPlayerUnitEvent(31)

constant playerunitevent EVENT_PLAYER_UNIT_TRAIN_START = ConvertPlayerUnitEvent(32)
     constant native GetTrainedUnitType takes nothing returns integer

constant playerunitevent EVENT_PLAYER_UNIT_TRAIN_CANCEL = ConvertPlayerUnitEvent(33)
     constant native GetTrainedUnitType takes nothing returns integer

constant playerunitevent EVENT_PLAYER_UNIT_TRAIN_FINISH = ConvertPlayerUnitEvent(34)
     constant native GetTrainedUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_RESEARCH_START = ConvertPlayerUnitEvent(35)
constant playerunitevent EVENT_PLAYER_UNIT_RESEARCH_CANCEL = ConvertPlayerUnitEvent(36)
constant playerunitevent EVENT_PLAYER_UNIT_RESEARCH_FINISH = ConvertPlayerUnitEvent(37)
     constant native GetResearchingUnit takes nothing returns unit
     constant native GetResearched takes nothing returns integer

constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_ORDER = ConvertPlayerUnitEvent(38)
     constant native GetOrderedUnit takes nothing returns unit
     constant native GetIssuedOrderId takes nothing returns integer

constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER = ConvertPlayerUnitEvent(39)
     constant native GetOrderedUnit takes nothing returns unit
     constant native GetIssuedOrderId takes nothing returns integer
     constant native GetOrderPointX takes nothing returns real
     constant native GetOrderPointY takes nothing returns real
     constant native GetOrderPointLoc takes nothing returns location

constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER = ConvertPlayerUnitEvent(40)
     constant native GetOrderedUnit takes nothing returns unit
     constant native GetIssuedOrderId takes nothing returns integer
     constant native GetOrderTarget takes nothing returns widget
     constant native GetOrderTargetDestructable takes nothing returns destructable
     constant native GetOrderTargetItem takes nothing returns item
     constant native GetOrderTargetUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER = ConvertPlayerUnitEvent(40) // for compat
     constant native GetOrderedUnit takes nothing returns unit
     constant native GetIssuedOrderId takes nothing returns integer

constant playerunitevent EVENT_PLAYER_HERO_LEVEL = ConvertPlayerUnitEvent(41)
     constant native GetLevelingUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_HERO_SKILL = ConvertPlayerUnitEvent(42)
     constant native GetLearningUnit takes nothing returns unit
     constant native GetLearnedSkill takes nothing returns integer
     constant native GetLearnedSkillLevel takes nothing returns integer

constant playerunitevent EVENT_PLAYER_HERO_REVIVABLE = ConvertPlayerUnitEvent(43)
     constant native GetRevivableUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_HERO_REVIVE_START = ConvertPlayerUnitEvent(44)
constant playerunitevent EVENT_PLAYER_HERO_REVIVE_CANCEL = ConvertPlayerUnitEvent(45)
constant playerunitevent EVENT_PLAYER_HERO_REVIVE_FINISH = ConvertPlayerUnitEvent(46)
     constant native GetRevivingUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_SUMMON = ConvertPlayerUnitEvent(47)
     constant native GetSummoningUnit takes nothing returns unit
     constant native GetSummonedUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_LOADED = ConvertPlayerUnitEvent(51)
     constant native GetTransportUnit takes nothing returns unit
     constant native GetLoadedUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_SELL = ConvertPlayerUnitEvent(269)
     constant native GetSellingUnit takes nothing returns unit
     constant native GetSoldUnit takes nothing returns unit
     constant native GetBuyingUnit takes nothing returns unit

constant playerunitevent EVENT_PLAYER_UNIT_CHANGE_OWNER = ConvertPlayerUnitEvent(270)
     constant native GetChangingUnit takes nothing returns unit
     constant native GetChangingUnitPrevOwner takes nothing returns player

constant playerunitevent EVENT_PLAYER_UNIT_DROP_ITEM = ConvertPlayerUnitEvent(48)
constant playerunitevent EVENT_PLAYER_UNIT_PICKUP_ITEM = ConvertPlayerUnitEvent(49)
constant playerunitevent EVENT_PLAYER_UNIT_USE_ITEM = ConvertPlayerUnitEvent(50)
     constant native GetManipulatingUnit takes nothing returns unit
     constant native GetManipulatedItem takes nothing returns item

constant playerunitevent EVENT_PLAYER_UNIT_SELL_ITEM = ConvertPlayerUnitEvent(271)
     constant native GetSoldItem takes nothing returns item

constant playerunitevent EVENT_PLAYER_UNIT_PAWN_ITEM = ConvertPlayerUnitEvent(277)

constant playerunitevent EVENT_PLAYER_UNIT_SPELL_CHANNEL = ConvertPlayerUnitEvent(272)
constant playerunitevent EVENT_PLAYER_UNIT_SPELL_CAST = ConvertPlayerUnitEvent(273)
constant playerunitevent EVENT_PLAYER_UNIT_SPELL_EFFECT = ConvertPlayerUnitEvent(274)
constant playerunitevent EVENT_PLAYER_UNIT_SPELL_FINISH = ConvertPlayerUnitEvent(275)
constant playerunitevent EVENT_PLAYER_UNIT_SPELL_ENDCAST = ConvertPlayerUnitEvent(276)
     constant native GetSpellAbilityUnit takes nothing returns unit
     constant native GetSpellAbilityId takes nothing returns integer
     constant native GetSpellAbility takes nothing returns ability
     constant native GetSpellTargetLoc takes nothing returns location
     constant native GetSpellTargetX takes nothing returns real
     constant native GetSpellTargetY takes nothing returns real
     constant native GetSpellTargetDestructable takes nothing returns destructable
     constant native GetSpellTargetItem takes nothing returns item
     constant native GetSpellTargetUnit takes nothing returns unit

constant native GetTriggerUnit takes nothing returns unit
constant native GetTriggerPlayer takes nothing returns player
native TriggerRegisterPlayerUnitEvent takes trigger whichTrigger, player whichPlayer, playerunitevent whichPlayerUnitEvent, boolexpr filter returns event


//
// unitevent
//
constant unitevent EVENT_UNIT_DAMAGED = ConvertUnitEvent(52)
     constant native GetEventDamage takes nothing returns real
     constant native GetEventDamageSource takes nothing returns unit

constant unitevent EVENT_UNIT_DEATH = ConvertUnitEvent(53)
     constant native GetDyingUnit takes nothing returns unit
     constant native GetKillingUnit takes nothing returns unit

constant unitevent EVENT_UNIT_DECAY = ConvertUnitEvent(54)
     constant native GetDecayingUnit takes nothing returns unit

constant unitevent EVENT_UNIT_DETECTED = ConvertUnitEvent(55)
     constant native GetEventDetectingPlayer takes nothing returns player

constant unitevent EVENT_UNIT_HIDDEN = ConvertUnitEvent(56)
constant unitevent EVENT_UNIT_SELECTED = ConvertUnitEvent(57)
constant unitevent EVENT_UNIT_DESELECTED = ConvertUnitEvent(58)

constant unitevent EVENT_UNIT_STATE_LIMIT = ConvertUnitEvent(59)
     native TriggerRegisterUnitStateEvent takes trigger whichTrigger, unit whichUnit, unitstate whichState, limitop opcode, real limitval returns event

constant unitevent EVENT_UNIT_ACQUIRED_TARGET = ConvertUnitEvent(60)
constant unitevent EVENT_UNIT_TARGET_IN_RANGE = ConvertUnitEvent(61)
     constant native GetEventTargetUnit takes nothing returns unit
     native TriggerRegisterUnitInRange takes trigger whichTrigger, unit whichUnit, real range, boolexpr filter returns event

constant unitevent EVENT_UNIT_ATTACKED = ConvertUnitEvent(62)
     constant native GetAttacker takes nothing returns unit

constant unitevent EVENT_UNIT_RESCUED = ConvertUnitEvent(63)
     constant native GetRescuer takes nothing returns unit

constant unitevent EVENT_UNIT_CONSTRUCT_CANCEL = ConvertUnitEvent(64)
     constant native GetCancelledStructure takes nothing returns unit

constant unitevent EVENT_UNIT_CONSTRUCT_FINISH = ConvertUnitEvent(65)
     constant native GetConstructedStructure takes nothing returns unit

constant unitevent EVENT_UNIT_UPGRADE_START = ConvertUnitEvent(66)
constant unitevent EVENT_UNIT_UPGRADE_CANCEL = ConvertUnitEvent(67)
constant unitevent EVENT_UNIT_UPGRADE_FINISH = ConvertUnitEvent(68)

constant unitevent EVENT_UNIT_TRAIN_START = ConvertUnitEvent(69)
     constant native GetTrainedUnitType takes nothing returns integer

constant unitevent EVENT_UNIT_TRAIN_CANCEL = ConvertUnitEvent(70)
     constant native GetTrainedUnitType takes nothing returns integer

constant unitevent EVENT_UNIT_TRAIN_FINISH = ConvertUnitEvent(71)
     constant native GetTrainedUnit takes nothing returns unit

constant unitevent EVENT_UNIT_RESEARCH_START = ConvertUnitEvent(72)
constant unitevent EVENT_UNIT_RESEARCH_CANCEL = ConvertUnitEvent(73)
constant unitevent EVENT_UNIT_RESEARCH_FINISH = ConvertUnitEvent(74)

constant unitevent EVENT_UNIT_ISSUED_ORDER = ConvertUnitEvent(75)
     constant native GetOrderedUnit takes nothing returns unit
     constant native GetIssuedOrderId takes nothing returns integer

constant unitevent EVENT_UNIT_ISSUED_POINT_ORDER = ConvertUnitEvent(76)
     constant native GetOrderedUnit takes nothing returns unit
     constant native GetIssuedOrderId takes nothing returns integer
     constant native GetOrderPointX takes nothing returns real
     constant native GetOrderPointY takes nothing returns real
     constant native GetOrderPointLoc takes nothing returns location

constant unitevent EVENT_UNIT_ISSUED_TARGET_ORDER = ConvertUnitEvent(77)
     constant native GetOrderedUnit takes nothing returns unit
     constant native GetIssuedOrderId takes nothing returns integer
     constant native GetOrderTarget takes nothing returns widget
     constant native GetOrderTargetDestructable takes nothing returns destructable
     constant native GetOrderTargetItem takes nothing returns item
     constant native GetOrderTargetUnit takes nothing returns unit

constant unitevent EVENT_UNIT_HERO_LEVEL = ConvertUnitEvent(78)
     constant native GetLevelingUnit takes nothing returns unit

constant unitevent EVENT_UNIT_HERO_SKILL = ConvertUnitEvent(79)
     constant native GetLearningUnit takes nothing returns unit
     constant native GetLearnedSkill takes nothing returns integer
     constant native GetLearnedSkillLevel takes nothing returns integer

constant unitevent EVENT_UNIT_HERO_REVIVABLE = ConvertUnitEvent(80)
     constant native GetRevivableUnit takes nothing returns unit

constant unitevent EVENT_UNIT_HERO_REVIVE_START = ConvertUnitEvent(81)
constant unitevent EVENT_UNIT_HERO_REVIVE_CANCEL = ConvertUnitEvent(82)
constant unitevent EVENT_UNIT_HERO_REVIVE_FINISH = ConvertUnitEvent(83)
     constant native GetRevivingUnit takes nothing returns unit

constant unitevent EVENT_UNIT_SUMMON = ConvertUnitEvent(84)
     constant native GetSummoningUnit takes nothing returns unit
     constant native GetSummonedUnit takes nothing returns unit

constant unitevent EVENT_UNIT_DROP_ITEM = ConvertUnitEvent(85)
constant unitevent EVENT_UNIT_PICKUP_ITEM = ConvertUnitEvent(86)
constant unitevent EVENT_UNIT_USE_ITEM = ConvertUnitEvent(87)
     constant native GetManipulatingUnit takes nothing returns unit
     constant native GetManipulatedItem takes nothing returns item

constant unitevent EVENT_UNIT_SELL_ITEM = ConvertUnitEvent(288)
     constant native GetSoldItem takes nothing returns item

constant unitevent EVENT_UNIT_PAWN_ITEM = ConvertUnitEvent(294)

constant unitevent EVENT_UNIT_LOADED = ConvertUnitEvent(88)
     constant native GetTransportUnit takes nothing returns unit
     constant native GetLoadedUnit takes nothing returns unit

constant unitevent EVENT_UNIT_SELL = ConvertUnitEvent(286)
     constant native GetSellingUnit takes nothing returns unit
     constant native GetSoldUnit takes nothing returns unit
     constant native GetBuyingUnit takes nothing returns unit

constant unitevent EVENT_UNIT_CHANGE_OWNER = ConvertUnitEvent(287)
     constant native GetChangingUnit takes nothing returns unit
     constant native GetChangingUnitPrevOwner takes nothing returns player

constant unitevent EVENT_UNIT_SPELL_CHANNEL = ConvertUnitEvent(289)
constant unitevent EVENT_UNIT_SPELL_CAST = ConvertUnitEvent(290)
constant unitevent EVENT_UNIT_SPELL_EFFECT = ConvertUnitEvent(291)
constant unitevent EVENT_UNIT_SPELL_FINISH = ConvertUnitEvent(292)
constant unitevent EVENT_UNIT_SPELL_ENDCAST = ConvertUnitEvent(293)
     constant native GetSpellAbilityUnit takes nothing returns unit
     constant native GetSpellAbilityId takes nothing returns integer
     constant native GetSpellAbility takes nothing returns ability
     constant native GetSpellTargetLoc takes nothing returns location
     constant native GetSpellTargetX takes nothing returns real
     constant native GetSpellTargetY takes nothing returns real
     constant native GetSpellTargetDestructable takes nothing returns destructable
     constant native GetSpellTargetItem takes nothing returns item
     constant native GetSpellTargetUnit takes nothing returns unit

constant native GetTriggerUnit takes nothing returns unit
native TriggerRegisterUnitEvent takes trigger whichTrigger, unit whichUnit, unitevent whichEvent returns event


//
// unitstate event
//
constant unitstate UNIT_STATE_LIFE = ConvertUnitState(0)
constant unitstate UNIT_STATE_MAX_LIFE = ConvertUnitState(1)
constant unitstate UNIT_STATE_MANA = ConvertUnitState(2)
constant unitstate UNIT_STATE_MAX_MANA = ConvertUnitState(3)
constant native GetEventUnitState takes nothing returns unitstate
native TriggerRegisterUnitStateEvent takes trigger whichTrigger, unit whichUnit, unitstate whichState, limitop opcode, real limitval returns event


//
// widget event
//
type widget extends agent // an interactive game object with life
type unit extends widget // a single unit reference
type destructable extends widget
type item extends widget
constant native GetTriggerWidget takes nothing returns widget
constant widgetevent EVENT_WIDGET_DEATH = ConvertWidgetEvent(89)
native TriggerRegisterDeathEvent takes trigger whichTrigger, widget whichWidget returns event


//
// dialog event
//
constant dialogevent EVENT_DIALOG_CLICK = ConvertDialogEvent(91)
constant native GetClickedDialog takes nothing returns dialog
native TriggerRegisterDialogEvent takes trigger whichTrigger, dialog whichDialog returns event

constant dialogevent EVENT_DIALOG_BUTTON_CLICK = ConvertDialogEvent(90)
constant native GetClickedButton takes nothing returns button
native TriggerRegisterDialogButtonEvent takes trigger whichTrigger, button whichButton returns event


// List of all TriggerRegister* natives
//
native TriggerRegisterGameEvent takes trigger whichTrigger, gameevent whichGameEvent returns event
native TriggerRegisterGameStateEvent takes trigger whichTrigger, gamestate whichState, limitop opcode, real limitval returns event

native TriggerRegisterTimerEvent takes trigger whichTrigger, real timeout, boolean periodic returns event
native TriggerRegisterTimerExpireEvent takes trigger whichTrigger, timer t returns event

native TriggerRegisterPlayerEvent takes trigger whichTrigger, player whichPlayer, playerevent whichPlayerEvent returns event
native TriggerRegisterPlayerStateEvent takes trigger whichTrigger, player whichPlayer, playerstate whichState, limitop opcode, real limitval returns event
native TriggerRegisterPlayerAllianceChange takes trigger whichTrigger, player whichPlayer, alliancetype whichAlliance returns event
native TriggerRegisterPlayerChatEvent takes trigger whichTrigger, player whichPlayer, string chatMessageToDetect, boolean exactMatchOnly returns event
native TriggerRegisterPlayerUnitEvent takes trigger whichTrigger, player whichPlayer, playerunitevent whichPlayerUnitEvent, boolexpr filter returns event

native TriggerRegisterDialogEvent takes trigger whichTrigger, dialog whichDialog returns event
native TriggerRegisterDialogButtonEvent takes trigger whichTrigger, button whichButton returns event

native TriggerRegisterEnterRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event
native TriggerRegisterLeaveRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event

native TriggerRegisterTrackableHitEvent takes trigger whichTrigger, trackable t returns event
native TriggerRegisterTrackableTrackEvent takes trigger whichTrigger, trackable t returns event

native TriggerRegisterUnitEvent takes trigger whichTrigger, unit whichUnit, unitevent whichEvent returns event
native TriggerRegisterUnitStateEvent takes trigger whichTrigger, unit whichUnit, unitstate whichState, limitop opcode, real limitval returns event
native TriggerRegisterFilterUnitEvent takes trigger whichTrigger, unit whichUnit, unitevent whichEvent, boolexpr filter returns event
native TriggerRegisterUnitInRange takes trigger whichTrigger, unit whichUnit, real range, boolexpr filter returns event

native TriggerRegisterDeathEvent takes trigger whichTrigger, widget whichWidget returns event

native TriggerRegisterVariableEvent takes trigger whichTrigger, string varName, limitop opcode, real limitval returns event

A note about the order in which event handlers (TriggerAddCondition, TriggerAddAction) are called (synchronously vs asynchronously):

EVENT_PLAYER_UNIT_DEATH | EVENT_UNIT_DEATH fires synchronously, meaning:
JASS:
function my_function takes nothing returns nothing
    call KillUnit(my_unit)
    // The event handlers fire before the next line.

    // This get's called after all the event handlers fire.
    call DoSomethingElse()
endfunction

EVENT_PLAYER_UNIT_SELECTED | EVENT_UNIT_SELECTED fires asynchronously, meaning:
JASS:
function my_function takes nothing returns nothing
    call SelectUnitForPlayerSingle(my_unit, Player(0))

    // This get's called before all the event handlers fire.
    call DoSomethingElse()

    // The event handlers fire after the function returns.
endfunction

So which event's are synchronous and which are asynchronous?
I don't know... =), probably most are synchronous.
 
Level 13
Joined
Nov 7, 2014
Messages
571
I'm just curious. Is there something interesting you discorvered with events? A anomaly or something.

No, not really. Frankly I've probably never used most of them =), but it seems:

playerunitevent is missing the corresponding of unitevent's:
JASS:
    EVENT_UNIT_DAMAGED
    EVENT_UNIT_ACQUIRED_TARGET
    EVENT_UNIT_TARGET_IN_RANGE
    EVENT_UNIT_STATE_LIMIT

unitevent is missing the corresponding of playerunitevent's:
JASS:
    EVENT_PLAYER_UNIT_CONSTRUCT_START


Also the following events use another native:
JASS:
    // gameevent (TriggerRegisterGameEvent)
    //
    EVENT_GAME_VARIABLE_LIMIT
    native TriggerRegisterVariableEvent takes trigger whichTrigger, string varName, limitop opcode, real limitval returns event

    EVENT_GAME_STATE_LIMIT
    native TriggerRegisterGameStateEvent takes trigger whichTrigger, gamestate whichState, limitop opcode, real limitval returns event

    EVENT_GAME_TIMER_EXPIRED
    native TriggerRegisterTimerExpireEvent takes trigger whichTrigger, timer t returns event // Triggers when the timer you tell it about expires
    native TriggerRegisterTimerEvent takes trigger whichTrigger, real timeout, boolean periodic returns event // Creates it's own timer and triggers when it expires

    EVENT_GAME_ENTER_REGION
    native TriggerRegisterEnterRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event
    EVENT_GAME_LEAVE_REGION
    native TriggerRegisterLeaveRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event

    EVENT_GAME_TRACKABLE_HIT
    native TriggerRegisterTrackableHitEvent takes trigger whichTrigger, trackable t returns event
    EVENT_GAME_TRACKABLE_TRACK
    native TriggerRegisterTrackableTrackEvent takes trigger whichTrigger, trackable t returns event


    // playerevent (TriggerRegisterPlayerEvent)
    //
    EVENT_PLAYER_STATE_LIMIT
    native TriggerRegisterPlayerStateEvent takes trigger whichTrigger, player whichPlayer, playerstate whichState, limitop opcode, real limitval returns event

    EVENT_PLAYER_ALLIANCE_CHANGED
    native TriggerRegisterPlayerAllianceChange takes trigger whichTrigger, player whichPlayer, alliancetype whichAlliance returns event

    EVENT_PLAYER_CHAT
    native TriggerRegisterPlayerChatEvent takes trigger whichTrigger, player whichPlayer, string chatMessageToDetect, boolean exactMatchOnly returns event


    // unitevent (TriggerRegisterUnitEvent)
    //
    EVENT_UNIT_STATE_LIMIT
    native TriggerRegisterUnitStateEvent takes trigger whichTrigger, unit whichUnit, unitstate whichState, limitop opcode, real limitval returns event

    EVENT_UNIT_ACQUIRED_TARGET
    EVENT_UNIT_TARGET_IN_RANGE
    native TriggerRegisterUnitInRange takes trigger whichTrigger, unit whichUnit, real range, boolexpr filter returns event

Which could mean that the less specific native doesn't work with that event or the event response functions (eg.: GetEventPlayerChatString) don't or there is a bit of redundancy in the API.
 
Status
Not open for further replies.
Top