User Tools

Site Tools


cerea2:build:hooks

Hooks

See ci_g_hooks for more information about hooks. The below is list of hook names. If you want to set for example OnDying hook for the area, you put “OnDying” string variable on the area and set its name to match your own script (for example ch_tk_dyoa_dying_hook). Then in that script you can call C_GetHookPC, C_GetHookParamString and C_GetHookParamInt to get parameters for the hook. If you want to skip the normal processing of the script (i.e. skip the normal on dying processing) you can call C_SetHookSkipNormalProcessing function.

The object (i.e. the OBJECT_SELF of the hook script, not the OBJECT_SELF of the function calling hook) for which hook is called depends on the hook, as listed below.

See generic hooks page for more documentation about generic hooks.

Here is list of generic hooks in the cerea2 module:

ch_g_q_incquest
ch_g_q_saytext
ch_g_q_tagger

Guild system

Object = NPC giving the rank.
  • GuildAdvance(guildtag, newranknumber) Called when member advances in guild. Also called when member initially joins the guild.

Quest system

Object = NPC, Trigger or module advancing the quest.
  • QuestSuccess(questtag, newstatenumber) Called when quest is finished successfully.
  • QuestFail(questtag, newstatenumber) Called when quest failed.
  • QuestProgress(questtag, newstatenumber) Called when quest state is advancing and the new state is set to newstatenumber.

Doors

Object = Door object.
  • OnUsed() Called when object was used (or placeable like portal is used as door and clicked on).
  • OnAreaTransitionClick() Called when door was clicked to get through.
  • OnClose() Called when door or placeble is closed.
  • OnDamaged() Called when door is damaged.
  • OnDestroyed() Called when door is forced to open.
  • OnFailToOpen() Called when failed to pick the lock of the door.
  • OnLock() Called when door is locked.
  • OnOpen() Called when door is opened.
  • OnUnLockWithKey() Called when unlocked with key.
  • OnUnLock() Called when unlocked normally.

PC Dying / Death

Object = PC who is dying.
  • OnDying(KillerTag, KilledByPC) Called when PC is dying. If KilledByPC is 1 then the PC was killed by another PC, and the KillerTag is UniqueID of PC. If PC was killed by NPC or creature then the KillerTag is the Tag of killer.
  • OnDeath(KillerTag, KilledByPC) Called when PC is dead. If KilledByPC is 1 then the PC was killed by another PC, and the KillerTag is UniqueID of PC. If PC was killed by NPC or creature then the KillerTag is the Tag of killer.
  • OnRespawn() Called when PC respawned.
  • OnRevive() Called when PC is revived (either by time or by healing spells etc).

NPC Healing

Object = NPC who was healed.
  • NPCRaised(“”, MaxHitsHealed) Called when NPC was successfully raised from dying status. MaxHitsHealed tells the max number of hits this spell could have healed.
  • NPCHealed(“”, MaxHitsHealed) Called when NPC was healed somewhat, but not enough to raise it from dying status. MaxHitsHealed tells the max number of hits this spell could have healed.

Altars / Deity

Object = Altar or NPC doing the change.
  • AltarUse(sDeity) Called when altar is used in general.
  • AltarPray(sDeity) Called when believer prays on altar.
  • AltarNonBeliever(sDeity) Called when non-believer prays on altar.
  • SetDeity(sNewDeity) Called when deity is changed.

Creatures

Object = NPC running the script.
  • OnPerception() Called when creature perceives PC.

Area

Object = Area
  • OnAreaEntry(sLastAreaTag) Called when entering new area, the argument is the tag of last area we exited, i.e. where we came to here.
  • OnAreaExit() Called when player exits area.
cerea2/build/hooks.txt · Last modified: 2015/05/03 12:32 by 127.0.0.1