ItemFunctions

Item

Interact with a currently targeted or held item

Syntax

Item [action] -- Perform an action with the held item (kill, drop, throw, or use)

Item take,[attachmentpoint] -- Take the item with a specified attachment point

Item throw,[attachmentpointdirection] -- Throw the item at a specified attachmentpoint direction

Item kill,[blendtime] -- Dematerialize the item in a specified amount of time then kill/destroy it

Warning

- "Item" also refers to weapon or corpse/limb pickups

- NPCs aren't able to pick up weapons off the ground, or interact them in any way in P3S, this is a bug

Note

Here's a list of all the action types: take, kill, drop, throw, use

The attachmentpointdirection parameter takes in the name of the attachment point that is related to the orientation of the NPC, the only attachment point bone direction that is actually used in the p3s scripts is forward.

Example


pt_default
{
    actions
    {
        // In order to take an item you need to target the entity first!
        TargetEntByName yummy_item

        // Take the targeted item entity...
        Item take,hand_right

        // In order to interact with a held item you must target it first!
        TargetItem 1

        // Drop the held item...
        Item drop

        // Use the held item...
        Item use

        // Throw the held item forwards...
        Item throw,forward

        // Dematerialize the held item in 0.5 seconds and destroy/kill it...
        Item kill,0.5
    }
}


SpawnItem

Cause an existing p3_item_spawner entity to spawn an item, and do stuff with the spawned item.

Syntax

SpawnItem [spawnername],[destinationtype],[attachmentpoint],[blendtime] -- Spawn the held item

Note

Here's a list of all the destination types: owner, target, caller, point

The point destination type uses the default p3_item_spawner entity spawn logic

The attachmentpoint parameter is any bone name of an NPC for example

The blendtime parameter controls how fast the spawned item will take to fully "materialize"

The attachmentpoint parameter does not need to be specified or nulled out if you use the point destination type

Example


pt_default
{
    actions
    {
        // Tell our cellphone spawner entity to spawn a cellphone item,
        // make the owner us, and put it in our right hand...
        SpawnItem "spawner_cellphone,owner,hand_right"

        // Spawn a drocha item (pornworld jizz rag) using the 
        // default p3_item_spawner spawning logic, and fully materialize it in 0.5 seconds
        SpawnItem spawn_droch,point,0.5
    }
}