SetWeapon

From Eternity Wiki
Revision as of 07:25, 4 April 2026 by Printz (talk | contribs) (Created page with "{{ACSFunction|description=Changes activator's current weapon. |usage=''boolean'' '''SetWeapon'''(''str weapon'') |parameters= *''weapon'': name of weapon to switch to. This name is one defined by an EDF weaponinfo block, which for the base games is stored in '''player.edf'''. |return='''TRUE''' if the weapon was successfully selected or was already active, '''FALSE''' otherwise. |examples= <code>int result = SetWeapon("Crossbow"); // will return TRUE if player...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Description[edit]

This is an ACS built-in function.

Changes activator's current weapon.

Usage[edit]

boolean SetWeapon(str weapon)

Parameters[edit]

  • weapon: name of weapon to switch to. This name is one defined by an EDF weaponinfo block, which for the base games is stored in player.edf.

Return value[edit]

TRUE if the weapon was successfully selected or was already active, FALSE otherwise.

Examples[edit]

int result = SetWeapon("Crossbow"); // will return TRUE if player has and can use crossbow

Notes[edit]

This function only works if activator is a player.

This will not allow selecting a weapon missing from activator's playerclass weaponslot items (i.e. weapons not allowed for the given character class), even if the player holds it in the inventory.

If Heretic tome of power (from powereffect type PowerWeaponLevel2) is active, it will always choose the powered type even if you specify the unpowered weaponinfo definition name.

This function's identification in zspecial.acs is: (ACS internal).

See also[edit]