Skip to content

Instantly share code, notes, and snippets.

@ndugger
Last active August 13, 2019 20:33
Show Gist options
  • Save ndugger/ab0faedeb978057d78795dcc6ce9326a to your computer and use it in GitHub Desktop.
Save ndugger/ab0faedeb978057d78795dcc6ce9326a to your computer and use it in GitHub Desktop.
Example Ported Script From Papyrus To Dungeon
use list.
use object.
use spell.
define update_equip_state as action (
use actor as self,
use list as armor_list,
use list as cuirass_list,
use list as spell_list
), set to -> nothing:
define armor_index as number, set to armor_list'size.
define cuirass_index as number, set to -1.
define spell_index as number, set to spell_list'size.
define equipped as number, set to 0.
repeat spell_index:
define effect as spell, set to do spell_list'at (spell_index - 1).
do self'remove_spell (effect).
set spell_index to spell_index - 1.
repeat armor_index:
define item as object, set to do armor_list'at (armor_index - 1).
if do self'has_equipped (item):
set equipped to equipped + 1.
if do cuirass_list'has (item):
set cuirass_index to do cuirass_list'position_of (item).
if cuirass_index > 2:
set cuirass_index to cuirass_index - 3.
set armor_index to armor_index - 1.
if equipped > 4, or equipped = 4:
define equipped_spell as spell, set to do spell_list'at (cuirass_index).
do self'add_spell (equipped_spell).
@ndugger
Copy link
Author

ndugger commented Aug 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment