Difference between revisions of "Event keyword/ru"
m (Правка) |
m (Edit) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{rupage|События|Скрипты|Требуется помощь в переводе}} | ||
{{Infobox script/ru}} | {{Infobox script/ru}} | ||
Line 223: | Line 224: | ||
[[IsEventValid]], [[HandleEvent]], [[SignalEvent]] | [[IsEventValid]], [[HandleEvent]], [[SignalEvent]] | ||
− | + | {{Languages|Event keyword}} | |
− | + | [[Category:Keywords]] | |
− | {{Languages|Event | + | |
− | [[Category: | + | |
[[Category:Events]] | [[Category:Events]] | ||
− |
Latest revision as of 05:37, 14 October 2011
События |
Начало / Русская DA Builder Wiki / Поделиться ВКонтакте
|
Скрипты |
---|
|
Event, именуемое далее Событие, это пакет информации в специальном формате, который передаётся игре, чтобы вызвать какую-либо реакцию на него. События генерируются движком игры и посылаются скрипту объекта, обрабатывающему события.
События различаются по типу, объекту назначения, задержке времени и пакету параметров (произвольное количество численных, объектных, плавающих и строковых переменных).
Определение события и его обработка
При написании скриптов можно использовать несколько способов определения события, которое необходимо обработать. Это определение события, которое происходит по умолчанию, определение с помощью функции Event (en) и определение текущего события. Их использование можно увидеть в нижеследующем примере:
Обратите внимание:
- функция Event() позволяет сгенерировать любое событие и послать его нужному объекту.
Ниже приведён типичный скрипт обработки событий:
void main() { event ev = GetCurrentEvent(); int nEventType = GetEventType(ev); //извлечение типа события int nEventHandled = FALSE; //указываем, что событию требуется обработка switch(nEventType) { case EVENT_TYPE_AREALOAD_SPECIAL: { ... nEventHandled = TRUE; //устанавливаем TRUE в случае, если больше никакая обработка не требуется break; } } if (!nEventHandled) //если событие не было обработано скрптом, либо требуется его дальнейшая обработка, //то передаём событие основному скрипту объекта { HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE); } }
Обратите внимание:
- Обычно событие посылается для обработки скрипту событий объекта, но существует несколько типов событий, которые обрабатываются только движком игры.
- Некоторые типы событий определяются движком и посылаются для обработки как #defines (определяемые).
- Функция HandleEvent (en) позволяет также отобрать, какие события стоит обработать пользовательским скриптом, а какие перенаправить в основной скрипт объекта (константы, определяющие основные скрипты, находятся в подключаемом скрипте global_objects_h)
Более подробно о том, как обработать или переопределить обработку события, вы сможете прочитать в Инструкции по работе со скриптами (en), Переопределение обработки событий (en).
Список типов событий
Ниже приведён список возможных типов событий, определённых в DA изначально. Пользовательские события возможно также будут перечислены в этом списке, если же вы не сможете найти здесь интересующее вас событие, то посмотрите по ссылке - Категории типов событий (en).
- Perception
- EVENT_TYPE_PERCEPTION_APPEAR - A creature enters the perception area of creature receiving the event
- EVENT_TYPE_PERCEPTION_DISAPPEAR - A creature exits the perception area of creature receiving the event
- Effects
- EVENT_TYPE_APPLY_EFFECT - an effect is applied to the receiving object
- EVENT_TYPE_REMOVE_EFFECT - an effect is removed from the receiving object
- Combat
- EVENT_TYPE_COMBAT_INITIATED - Fires whenever the attack command is added into the command queue. Used to set combat mode and combat camera/music. Also fires by scripting to trigger combat after being attacked or an ally is attack.
- EVENT_TYPE_COMBAT_END - a creature doesn't perceive any more hostiles.
- EVENT_TYPE_MELEE_ATTACK_START - [Undocumented]
- EVENT_TYPE_COMMAND_PENDING - Fires at the beginning of the attack part of the attack command OR at the beginning of an ability execution.
- EVENT_TYPE_COMMAND_COMPLETE - creature finishes doing a command(attack, special ability, spell, conversation, etc)
- EVENT_TYPE_ATTACK_IMPACT -- An attack has impacted the target. This can be melee (sword hit), ranged (arrow hit) or spell (fireball explodes). Used for applying damage, and handling abilities that function on hit (Berserk etc').
- EVENT_TYPE_ATTACKED - another object tried attacking this creature using melee/ranged weapons (hit or miss), talents or spells.
- EVENT_TYPE_ALLY_ATTACKED - an ally has received the ATTACKED event. An ally is an object with the same group ID.
- Damage and death
- EVENT_TYPE_DAMAGED - an object loses 1 hit point or more
- EVENT_TYPE_DOT_TICK - Damage over time tick event.
- EVENT_TYPE_DYING - a creature received the killing blow.
- EVENT_TYPE_DEATH - creature or placeable have the death effect applied (regardless of hitpoints)
- EVENT_TYPE_RESURRECTION - Creature resurrected.
- EVENT_TYPE_TEAM_DESTROYED - Fires when an entire team of creatures is destroyed.
- Inventory
- EVENT_TYPE_INVENTORY_ADDED - An item is added to the personal inventory of the object receiving the event or the party inventory.
- EVENT_TYPE_INVENTORY_REMOVED - An item is removed from the personal inventory of the object receiving the event or the party inventory.
- EVENT_TYPE_EQUIP - The current creature has equipped an item
- EVENT_TYPE_UNEQUIP - The current creature has unequipped an item
- EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED - items with the ITEM_ACQUIRED_EVENT_ID variable set are picked up.
- EVENT_TYPE_INVENTORY_FULL - [Undocumented]
- EVENT_TYPE_OUT_OF_AMMO - [Undocumented]
- Movement
- EVENT_TYPE_BLOCKED - The current creature's path has been blocked while moving by a creature or door. This event will NOT fire when blocked by placeables who can not change the walk mesh or terrain.
- EVENT_TYPE_ENTER - A creature enters the object receiving the event
- EVENT_TYPE_EXIT - A creature exits the object receiving the event
- EVENT_TYPE_REACHED_WAYPOINT - [Undocumented]
- Traps
- EVENT_TYPE_APPROACH_TRAP - Trap triggered and the creature receiving this event should approach the trap
- EVENT_TYPE_TRAP_ARM Sent by script to request that a trap arm itself.
- EVENT_TYPE_TRAP_TRIGGER_ENTER - [Undocumented]
- EVENT_TYPE_TRAP_DISARMED - [Undocumented]
- EVENT_TYPE_TRAP_TRIGGER_ARMED - [Undocumented]
- EVENT_TYPE_TRAP_TRIGGER_EXIT - [Undocumented]
- EVENT_TYPE_TRAP_TRIGGERED - [Undocumented]
- Game state events
- EVENT_TYPE_SPAWN - an object spawns into the game. This event can fire only once per game for each object, regardless of save games.
- EVENT_TYPE_MODULE_START - The module starts. This can happen only once for a single game instance.
- EVENT_TYPE_MODULE_LOAD - The module loads from a save game. This event can fire more than once for a single module or game instance.
- EVENT_TYPE_AREALOAD_SPECIAL - for playing things like cutscenes and movies when you enter an area, things that do not involve AI or actual game play
- EVENT_TYPE_AREALOAD_PRELOADEXIT - for things you want to happen while the load screen is still up, things like moving creatures around
- EVENT_TYPE_AREALOAD_POSTLOADEXIT - fires at the same time that the load screen is going away, and can be used for things that you want to make sure the player sees.
- EVENT_TYPE_AREALOADSAVE_POSTLOADEXIT - fires at the same time that the load screen is going away, but only when loading a savegame.
- EVENT_TYPE_GAMEMODE_CHANGE
- EVENT_TYPE_DELAYED_GM_CHANGE
- EVENT_TYPE_SET_GAME_MODE
- Plots
- EVENT_TYPE_SET_PLOT - A plot is setting a plot flag
- EVENT_TYPE_GET_PLOT - A plot is setting a plot flag
- Dialogue
- EVENT_TYPE_DIALOGUE - An object tries to initiate dialog with the object receiving the event, either by clicking or by scripting
- EVENT_TYPE_DELAYED_SHOUT - Used to fire a dialog shout every few seconds.
- EVENT_TYPE_AMBIENT_CONTINUE - conversation ends or player is nearby to resume ambient behaviour
- Party management
- EVENT_TYPE_PARTYMEMBER_ADDED - Party member added to active party using the party GUI
- EVENT_TYPE_PARTYMEMBER_DROPPED - Party member removed from active party using the party GUI
- EVENT_TYPE_PARTYPICKER_CLOSED - [Undocumented]
- EVENT_TYPE_PARTY_MEMBER_HIRED - Fires first time a party member is added to the party. For plot followers: follower recruited (added to pool). For other followers: UT_Hire called
- EVENT_TYPE_PARTY_MEMBER_FIRED - Fires when an active or locked-active party member is removed from the active party
- EVENT_TYPE_PARTY_MEMBER_RES_TIMER - Resurrection timer used if a creature dies in explore mode.
- EVENT_TYPE_GIFT_ITEM - [Undocumented]
- EVENT_TYPE_MODULE_HANDLE_FOLLOWER_DEATH - [Undocumented]
- EVENT_TYPE_MODULE_HANDLE_GIFT - [Undocumented]
- EVENT_TYPE_SUMMON_DIED - [Undocumented]
- Character generation and level advancement
- EVENT_TYPE_CHARGEN_START and EVENT_TYPE_CHARGEN_END - A range of event constants (nEvent >= EVENT_TYPE_CHARGEN_START && nEvent <= EVENT_TYPE_CHARGEN_END) that occur during character generation.
- EVENT_TYPE_PLAYER_LEVELUP Fired by sys_rewards_h.RewardXP (the levelup system)
- EVENT_TYPE_PLAYERLEVELUP
- EVENT_TYPE_CHARGEN_AUTOLEVEL
- EVENT_TYPE_MODULE_CHARGEN_DONE
- EVENT_TYPE_GUI_OPENED - GUI tutorial calls
- World map
- EVENT_TYPE_TRANSITION_TO_WORLD_MAP - Player uses the generic transition system to open the world map
- EVENT_TYPE_WORLD_MAP_CLOSED
- EVENT_TYPE_WORLD_MAP_USED - the player clicks on a destination in the world map
- EVENT_TYPE_BEGIN_TRAVEL
- EVENT_TYPE_WORLDMAP_PRETRANSITION
- EVENT_TYPE_WORLDMAP_POSTTRANSITION
- EVENT_TYPE_FINISH_TRAVEL
- Found in placeable_core
- EVENT_TYPE_PLACEABLE_ONCLICK player clicks on object.
- EVENT_TYPE_USE
- EVENT_TYPE_UNLOCKED Sent by script when placeable is unlocked.
- EVENT_TYPE_SET_OBJECT_ACTIVE Sent by script to change active state. Needed since CommandDoFunction was removed and we're using CommandDoEvent
- EVENT_TYPE_PLACEABLE_COLLISION player collides with object (if EnableCollisionEvent column in placeables.xls is non-zero).
- EVENT_TYPE_POPUP_RESULT
- Found in rules_core
- Found in player_core
- Spellcasting
- Proving events
- Debugging
- Stats
- Miscellaney
- EVENT_TYPE_CLICK
- EVENT_TYPE_CUSTOM_COMMAND_COMPLETE
- EVENT_TYPE_FAILTOOPEN
- EVENT_TYPE_HANDLE_CUSTOM_AI
- EVENT_TYPE_INVALID
- EVENT_TYPE_LISTENER
- EVENT_TYPE_LOCKED
- EVENT_TYPE_QA_EVENT
- EVENT_TYPE_QA_EVENT_BLA
- EVENT_TYPE_STEALING_FAILURE
- EVENT_TYPE_STEALING_SUCCESS
- EVENT_TYPE_UNIQUE_POWER - Fired when an item with ability "ITEM_ABILITY_UNIQUE_POWER_SINGLE_USE" or "ITEM_ABILITY_UNIQUE_POWER_UNLIMITED_USE" is "used". this event is sent to the module script. Fired by the core "item_unique_power.ncs" script.
Shouts
Shouts (events) are used to make creatures communicate with one another. This is a list of all the shouts referenced in the AI documentation.
- SHOUT_TYPE_WASATTACKED When I am attacked, signal this event for all allies. What do the allies do? They will go into combat round, not specifically targeting this attacker but becoming combat ready.
- SHOUT_TYPE_SAWENEMY Attack enemy.
- SHOUT_TYPE_KILLEDME Attack enemy.
- SHOUT_TYPE_SWITCH_MELEE Will switch to melee weapons, useful for certain plot situations
- SHOUT_TYPE_WAKE_UP Any creature that hears this shout will wake up, if sleeping. This shout needs to be manually called.
- SHOUT_TYPE_FOUND_SOMEONE (YaronToDo) a scout sees someone they broadcasts this event. Allies go here. (NOT DONE)
- SHOUT_TYPE_FINISHHIM Attacks a specified enemy till they are dead. A Commander issues order generally.
- SHOUT_TYPE_ATTACK_WIZARD (YaronToDo) Starting targeting wizard class enemies instead of others.
- SHOUT_TYPE_FLANK Rogues will get into a flanking position to an appropriate enemy
- SHOUT_TYPE_SWITCH_RANGED Will randomly choose one ally and ask them to switch to a ranged weapon. This is mostly done to even out the number of participants in melee battle for animation purposes (closer to even the sides are, the better things look)
See Also
IsEventValid, HandleEvent, SignalEvent
Язык: | English • русский |
---|