Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define APPLY_EXTRA_AMLA_EFFECT _AMLA_ID _ACTIONS
- [event]
- id="post_advance_" + {_AMLA_ID}
- name=post advance
- first_time_only=no
- [filter]
- side=1
- role=hero
- [/filter]
- #[store_amlas]
- # id=$unit.id
- # variable=temp_advancements
- #[/store_amlas]
- {VARIABLE temp_event_id ("post_advance_" + {_AMLA_ID})}
- # Debug code for manual firing
- #[apply_amlas]
- # id=Elynia
- # [advance]
- # id={_AMLA_ID}
- # [/advance]
- #[/apply_amlas]
- #[store_unit]
- # [filter]
- # id=Elynia
- # [/filter]
- # variable=unit
- #[/store_unit]
- {FOREACH unit.modifications.advance i}
- [if]
- {VARIABLE_LEXICAL_EQUALS unit.modifications.advance[$i].id {_AMLA_ID}}
- #{VARIABLE_BOOLEAN_NOT_EQUALS unit.variables.actions_executed_${_AMLA_ID}| yes}
- [then]
- #{VARIABLE unit.variables.actions_executed_${_AMLA_ID}| yes}
- #[lua]
- # code = <<
- # local set, get = wesnoth.set_variable, wesnoth.get_variable
- # set("k", select(2, helper.get_child(get("unit"), "event", get("temp_event_id"))) - 1)
- # >>
- #[/lua]
- {VARIABLE k 0}
- [while]
- {VARIABLE_NUMERICAL_LESS_THAN k $unit.event.length}
- {VARIABLE_NUMERICAL_NOT_EQUALS unit.event[$k].id $temp_event_id}
- [do]
- {VARIABLE_INC k 1}
- [/do]
- [/while]
- #{BUG_ON ({VARIABLE_NUMERICAL_EQUALS k $unit.event.length})
- #("unit does not carry the amla command controller event!")}
- {CLEAR_VARIABLE unit.event[$k],k}
- # Unstore unit before executing actions
- [unstore_unit]
- variable=unit
- find_vacant=no
- [/unstore_unit]
- {_ACTIONS}
- # Remove this event so it won't trigger again on next advance
- [event]
- id=$temp_event_id
- remove=yes
- [/event]
- {LOG_NX_DBG ("Post-advance commands applied for AMLA '" + {_AMLA_ID} + "'")}
- [/then]
- [/if]
- {NEXT i}
- {CLEAR_VARIABLE temp_event_id}
- [/event]
- #enddef
Advertisement
Add Comment
Please, Sign In to add comment