ZoriaRPG

RunScript.zh

May 30th, 2019
179
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace Scripts
  2. {
  3.     const int IFLAG_SCRITPERPETUAL = 15;
  4.    
  5.     int RunItem(int name)
  6.     {
  7.          itemdata id = Game->LoadItemData(Game->GetItem("hotscript"));
  8.          int script_number = Game->GetItemScript(name);
  9.          id->Script = script_number;
  10.          id->RunScript();
  11.          return script_number;
  12.     }
  13.  
  14.     //! Runs an arbitrary item script.
  15.     //! Itemname is the name of the item used to run script scriptname.
  16.     //! Returns the script number.
  17.     int RunItem(int scriptname, int itemname)
  18.     {
  19.          itemdata id = Game->LoadItemData(Game->GetItem("hotscript"));
  20.          int script_number = Game->GetItemScript(scriptname);
  21.          id->Script = script_number;
  22.          id->RunScript();
  23.          return script_number;
  24.     }
  25.  
  26.  
  27.  
  28.  
  29.     void ToggleItem(int id, bool on)
  30.     {
  31.         itemdata idat = Game->LoadItemData(id);
  32.         idat->Flags[IFLAG_SCRITPERPETUAL] = (on ? true : false );
  33.     }
  34.  
  35.     void ToggleItem(itemdata id, bool on)
  36.     {
  37.         id->Flags[IFLAG_SCRITPERPETUAL] = (on ? true : false );
  38.     }
  39.  
  40.     int ToggleItemName(int name, bool state)
  41.     {
  42.         int itemid = Game->GetItem(name);
  43.         itemdata id  = Game->LoadItemData(itemid);
  44.         id->Flags[IFLAG_SCRITPERPETUAL] = (on ? true : false );
  45.     }
  46. }
RAW Paste Data