Page 1 of 1

Question about locations

Posted: Mon Jul 28, 2003 3:32 pm
by digitac
How to get the location of an script object ?

i want an object only to move if it's in a position i choose

Posted: Mon Jul 28, 2003 5:04 pm
by jv_map
$object_targetname.origin :wink:

Welcome to .map :D

Posted: Mon Jul 28, 2003 8:37 pm
by Alcoholic
and this:

Code: Select all

if ($object_targetname.origin == (40 40 40))
{
    iprintln "$object_targetname is in position
}
:)

Posted: Mon Jul 28, 2003 10:12 pm
by digitac
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 ?

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 :)

Posted: Mon Jul 28, 2003 10:41 pm
by Alcoholic
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:

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
something like that. :wink:

Posted: Tue Jul 29, 2003 10:38 am
by Parts
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

Posted: Tue Jul 29, 2003 8:47 pm
by Alcoholic
yeah, so you could put

if ($elevator_platform.origin[2] == 320) //that would be if the z coordinate (vertical) is 320.

Posted: Sun Aug 03, 2003 11:13 pm
by digitac
This solution gives me NIL

dunno what that means :roll:

Maybee i did something wrong ?

if ($elevator_platform.origin[2] == 0)
{
.....
}

Posted: Mon Aug 04, 2003 5:56 am
by jv_map
Could you post the exact error message?