EquipItem

From GECK
(Redirected from EquipObject)
Jump to: navigation, search


A function included in the GECK for Fallout 3.

Description

EquipItem forces an actor to equip an item.

Syntax

[help]
[ActorRefID].EquipItem ObjectID:baseform NoUnequipFlag:int{0, 1} HideEquipMessage:int{0, 1} 

Or:

[ActorRefID].EquipObject ObjectID:baseform NoUnequipFlag:int{0, 1} HideEquipMessage:int{0, 1}

Example

Player.EquipItem HuntingRifle 0 1 

Notes

  • If NoUnequipFlag = 1, actor (including the player) will be unable to unequip the item. Once the item is unequipped with the UnequipItem function, the item can be equipped and unequipped as normal.
  • If HideEquipMessage = 1, the item equipped message will be hidden from the player.
  • In the case that the player has multiples of the specified item, it would appear that the item of lowest condition is the one equipped. If EquipItem is called on the same actor and in the same frame as AddItem or AddItemHealthPercent, however, the last item added is equipped instead.
  • Ingestibles can be passed as the item to equip, resulting in the actor consuming the indicated item as normal, provided they have at least one in their inventory. The item is treated as though it were used normally, e.g. effects for food and aid items will scale with the player's Survival and Medicine skills respectively, and there is a possibility the player can become addicted if they use an addictive substance.
  • Using EquipItem to equip different ammo types on a Non-Playable Character will not work if they have more than one ammo type of the same caliber.
  • This will not run the OnEquip block of a script attached to the item. Use EquipItemAlt if that is needed.
  • EquipItem will not work if there is already an item in that slot that has been equipped with the NoUnequipFlag set. This can be useful for determining whether or not that flag has been set. Use UnequipItem to remove such an item before using EquipItem.
  • This function can be used to force actors into using chems.
  • Using this function to equip an armor item on an NPC will not automatically unequip the replaced item, as it does on the player. E.g., if you add and equip 10 types of boots, all will report as equipped (but not added to the Armor Rating). This may or may not be fixed in following frames.
  • This function does not always work when used to equip items which have been added to an inventory using AddItem, unless you provide a delay between adding the items and equipping them. For instance:
addItem someItem 1
equipItem someItem 1 ; <- item may not be equipped

short equipDelay
if ( equipDelay == 0 )
  addItem someItem 1
  set equipDelay to 1
elseif ( equipDelay < 10 ) ; wait 10 frames
  set equipDelay to equipDelay + 1
elseif ( equipDelay > 0 )
  equipItem someItem ; <- should work properly now
  set equipDelay to -1 ; finished
endif
  • RemoveAllItems Bugs:
  • If you equip a playable item with the NoUnequipFlag set to 1 on a NPC, a subsequent call of RemoveAllItems on this NPC will crash the game.
  • If you equip a playable non-quest item with the NoUnequipFlag set to 1 on the player, a subsequent call of RemoveAllItems on the player will crash the game.

See Also