Classes:ScriptUtil

From ZDoom Wiki
Jump to navigation Jump to search

ScriptUtil is a ZScript class that functions as a container for several static utility functions. It has no other functionality.

Methods

Static

  • static void GiveInventory (Actor activator, Name type, int amount)
Gives an item (specified by type) to the activator or to all players (if activator is null).
  • static void TakeInventory (Actor activator, Name type, int amount)
Takes an item (specified by type) from the activator or from all players (if activator is null).
  • static void ClearInventory (Actor activator)
Calls ClearInventory to clear the inventory of the activator or of all players (if activator is null).
  • static int SetWeapon (Actor activator, class<Inventory> cls)
If the activator is a player, switches their weapon to cls.
  • static void SetMarineWeapon (LevelLocals Level, Actor activator, int tid, int marineweapontype)
Finds all instances of the ScriptedMarine class with TID of tid on the level and switches their weapon to marineweapontype.
  • static void SetMarineSprite (LevelLocals Level, Actor activator, int tid, class<Actor> type)
Finds all instances of the ScriptedMarine class with TID of tid on the level and changes their sprites to use the sprites from the type actor class.
  • static int PlayerMaxAmmo (Actor activator, class<Actor> type, int newmaxamount = int.min, int newbpmaxamount = int.min)
Checks the activators inventory for the type Ammo class and sets its Inventory.MaxAmount to newmaxamount and its Ammo.BackpackMaxAmount to newbpmaxamount. Returns the ammo's new maxamount.
  • static int PlayerAmmo (Actor activator, class<Inventory> type, int newamount = int.min)
Checks the activators inventory for the type Ammo class and sets its current amount to newamount. Returns the updated amount.