Pickup.Pos
From Liberty Unleashed Wiki
This Pickup class member returns or sets the position of the given pickup.
Syntax
You can either return or set a new value using this member:
Vector pickup.Pos
pickup.Pos = Vector vPos
Arguments
- vPos - This is the new position for the pickup as a Vector
Example 1. Returning
function onPlayerCommand( player, cmd, text ) { if ( cmd == "pickuppos" ) { local pickup = FindPickup( 0 ); if ( pickup ) MessagePlayer( "Pickup 0s position is: " + pickup.Pos, player ); else MessagePlayer( "Pickup 0 does not exist", player ); } }
This command will tell the player the co-ordinates of pickup id 0.
Example 2. Setting
function onPlayerCommand( player, cmd, text ) { if ( cmd == "setpickuppos" ) { local newpos = Vector( 100.00, 90.00, 1.00 ); local pickup = FindPickup( 0 ); if ( pickup ) pickup.Pos = newpos; } }
This command will set the pickup with ID 0s position to the co-ordinates of 100.00 (X), 90.00 (Y), 1.00 (Z).
Notes
The function FindPickup and eventonPlayerCommand was used in in this example. More info about this in the corresponding page.