Event System

From Sinfar

OUTDATED

This page is outdated, instead check Variable based events

OUTDATED

The way to get an event parameter has been standardized... now instead of calling functions from inc_x_events or getting local variable, parameters are stored in an array:

They can be obtained all at once with the GetEventParams() function or one by one, here are all functions to deal with the new events system:

Code: Select all

int GetEventParamInt(int nParamIndex);

object GetEventParamObject(int nParamIndex);

string GetEventParamString(int nParamIndex);

float GetEventParamFloat(int nParamIndex);

effect GetEventParamEffect(int nParamIndex);

array GetEventParamArray(int nParamIndex);

dictionary GetEventParamDictionary(int nParamIndex);

location GetEventParamLocation(int nParamIndex);

vector GetEventParamVector(int nParamIndex);

array GetEventParams();

int GetEventParamType(int nParam);

int GetEventParamCount();

void BypassEvent();

void SetEventResultInt(int nResult);

void SetEventResultObject(object oResult);

void SetEventResultString(string sResult);

void SetEventResultFloat(float fResult);

void SetEventResultEffect(effect eResult);

void SetEventResultArray(array aResult);

void SetEventResultDictionary(dictionary dResult);

void SetEventResultVector(vector vResult);

void SetEventResultLocation(location lResult);

void RunEvent(string sScript, object oTarget, array aParams);

int RunEventInt(string sScript, object oTarget, array aParams);

object RunEventObject(string sScript, object oTarget, array aParams);

string RunEventString(string sScript, object oTarget, array aParams);

float RunEventFloat(string sScript, object oTarget, array aParams);

effect RunEventEffect(string sScript, object oTarget, array aParams);

array RunEventArray(string sScript, object oTarget, array aParams);

dictionary RunEventDictionary(string sScript, object oTarget, array aParams);

vector RunEventVector(string sScript, object oTarget, array aParams);

location RunEventLocation(string sScript, object oTarget, array aParams);


And the reference for most existing events:

pc_ev_useitem -> item:EVENT_USE
self : user
p0: item
p1: target object
p2: target position
p3: sub type

pc_ev_examine -> player:EVENT_EXAMINE
self: player
p0: target object

pc_ev_attack -> attacker:EVENT_ATTACK
self: attacker
p0: target object
p1: attack type

pc_ev_trap -> target:EVENT_TRAP
self: trapper
p0: type
p1: target object
p2: target position

pc_ev_firetrap -> target:EVENT_FIRETRAP
self: trigger
p0: type
p1: target

pc_ev_useskill -> user:EVENT_USESKILL, user:EVENT_USESKILL_%skill%
self: user
p0: skill
p1: target
p2: target position
p3: item

pc_ev_usefeat -> user:EVENT_USEFEAT, user:EVENT_USEFEAT_%feat%
self: user
p0: feat
p1: target
p2: target position

pc_ev_togglemode -> user:EVENT_TOGGLEMODE, user:EVENT_TOGGLEMODE_%mode%
self: user
p0: mode

pc_ev_castspell -> caster:EVENT_CASTING, caster:EVENT_CASTING_%spell%
self: caster
p0: target
p1: target position
p2: spell
p3: meta magic
p4: class
p5: is instant

ilr_canequip -> item:EVENT_CAN_EQUIP
self: equip by
p0: item

pc_ev_setlike setter:EVENT_SETLIKE
self: setter
p0: type
p1: target

pc_ev_party
self: setter
p0: type
p1: target

pc_ev_pickpocket
self: attacker
p0: target object