How to get the location of an script object ?
i want an object only to move if it's in a position i choose
Question about locations
Moderator: Moderators
and this:

Code: Select all
if ($object_targetname.origin == (40 40 40))
{
iprintln "$object_targetname is in position
}so if i have an elevator that is on 320 high
and i want to have in my script that when u use the trigger
and the elevator needs to get down.
how can i say that ?
or something ( please change if needed ) i am a novice newbee
and i want to have in my script that when u use the trigger
and the elevator needs to get down.
how can i say that ?
Code: Select all
$elevator_platform time 5.8
$elevator_door_up_left time 2
$elevator_door_up_right time 2
$elevator_door_down_left time 2
$elevator_door_down_right time 2
$elevator_trigger waittill trigger
if ($elevator_platform.origin == 320)
{
$elevator_door_up_trigger nottriggerable
$elevator_trigger movedown 320
$elevator_trigger move
$elevator_platform movedown
$elevator_platform waitmove
$elevator_door_down_left rotatey 45
$elevator_door_down_right rotatey -45
$elevator_door_down_left move
$elevator_door_down_right move
wait 5
$elevator_door_down_left rotatey -45
$elevator_door_down_right rotatey 45
$elevator_door_down_trigger triggerable
}
if ($elevator_platform.origin == 0)
{
$elevator_door_down_trigger nottriggerable
$elevator_trigger moveup 320
$elevator_trigger move
$elevator_platform moveup
$elevator_platform waitmove
$elevator_door_up_left rotatey 45
$elevator_door_up_right rotatey -45
$elevator_door_up_left move
$elevator_door_up_right move
wait 5
$elevator_door_up_left rotatey -45
$elevator_door_up_right rotatey 45
$elevator_door_up_trigger triggerable
}
or something ( please change if needed ) i am a novice newbee
nononononononono. an origin is three numbers: coordinate x, coordinate y, and coordinate z.
remember, this is quake3, not half-life. you can do a few easier things here.
make a trigger_use in your map. heres an example script:
something like that. 
remember, this is quake3, not half-life. you can do a few easier things here.
make a trigger_use in your map. heres an example script:
Code: Select all
main:
level waittill prespawn
level waittill spawn
waitthread elevator_setup //wait for thread named elevator_setup before continuing
thread elevator //start thread elevator when ready
end
elevator_setup: // the thread we called
$elevator_trigger bind $elevator_platform //object a automatically moves at an offset with object b
//this next line assumes our elevator is in the "down" position... so we create our own variable that determines if its up or down...
$elevator_platform.state = "down"
$elevator_platform time 5.8
$elevator_door_up_left time 2
$elevator_door_up_right time 2
$elevator_door_down_left time 2
$elevator_door_down_right time 2
end
elevator: //our main elevator thread
$elevator_trigger waittill trigger
if ($elevator_platform.state == "down")
{
$elevator_door_down_trigger nottriggerable
$elevator_platform moveup 320
$elevator_platform waitmove
$elevator_door_up_left rotatey 45
$elevator_door_up_right rotatey -45
$elevator_door_up_left move
$elevator_door_up_right move
wait 5
$elevator_door_up_left rotatey -45
$elevator_door_up_right rotatey 45
//update to new position
$elevator_platform.state = "up"
$elevator_door_up_trigger triggerable
}
else if ($elevator_platform.state == "up")
{
$elevator_door_up_trigger nottriggerable
$elevator_platform movedown 320
$elevator_platform waitmove
$elevator_door_down_left rotatey 45
$elevator_door_down_right rotatey -45
$elevator_door_down_left move
$elevator_door_down_right move
wait 5
$elevator_door_down_left rotatey -45
$elevator_door_down_right rotatey 45
//update to new position
$elevator_platform.state = "down"
$elevator_door_down_trigger triggerable
}
end
The SDK Explains this pretty well but here goes anyway:
the origin property is actually a vector as pople have already explained consisting of x , y and z coordinates. If we are talking about up and down like in an elevator then you are interested in the Z coordinate.
Therefore to find out the height of the object you could do something like:
local.ElevatorHeight = $Elevator.origin[2]
o.e. take the third element out of the origin array. In the array 0 is x coord, 1 is y coord and 2 is z coord
the origin property is actually a vector as pople have already explained consisting of x , y and z coordinates. If we are talking about up and down like in an elevator then you are interested in the Z coordinate.
Therefore to find out the height of the object you could do something like:
local.ElevatorHeight = $Elevator.origin[2]
o.e. take the third element out of the origin array. In the array 0 is x coord, 1 is y coord and 2 is z coord
[VS-UK]Capt.Parts[BnHQ]
