Page 1 of 1

origins and entities

Posted: June 19th, 2013, 8:38 pm
by pcbouncer
how can i get the x,y, or z values alone? i know that you can get an entities origin.. but how to get the values out of that?

Re: origins and entities

Posted: June 19th, 2013, 8:41 pm
by Drofder2004

Code: Select all

x = org[0];
y = org[1];
z = org[2];

Re: origins and entities

Posted: June 19th, 2013, 8:46 pm
by pcbouncer
so like this?

origin = brush1 getOrigin();
x=origin[0];?

Re: origins and entities

Posted: June 19th, 2013, 8:49 pm
by pcbouncer
ah thankyou so much! :)

Re: origins and entities

Posted: June 19th, 2013, 8:50 pm
by pcbouncer
one more thing, do you know how to turn triggers on and off???

Re: origins and entities

Posted: June 19th, 2013, 9:27 pm
by F |Madness| U
Wow, that would have helped me back in the day ha.

To `turn a trigger off` just add in some code (an argument of some sort) that stops it getting back to "trigger waittill ...".

I.e normally the "trigger waitill ..." line is embedded in a while(1) loop, meaning the trigger is always on. If you take it out of this loop, once activated the trigger will be finished with.

Or if you know you want to permanently turn off the trigger, you can do trigger delete() to delete the trigger entity.

Re: origins and entities

Posted: June 20th, 2013, 3:24 am
by pcbouncer
ah ye, that sounds simple enough, boolean flags

Re: origins and entities

Posted: June 20th, 2013, 8:01 pm
by Drofder2004
pcbouncer wrote:ah ye, that sounds simple enough, boolean flags
Even easier:

Code: Select all

trigger_ent thread maps\mp\_utility::triggerOff(); /* triggerOn(); */

Re: origins and entities

Posted: June 20th, 2013, 8:59 pm
by pcbouncer
Drofder2004 wrote:
pcbouncer wrote:ah ye, that sounds simple enough, boolean flags
Even easier:

Code: Select all

trigger_ent thread maps\mp\_utility::triggerOff(); /* triggerOn(); */

^^ :)

Re: origins and entities

Posted: June 20th, 2013, 9:11 pm
by pcbouncer
you told me how to take apart origins... but how to make them? look at this;doesnt compile obv


r1(){
trigger = getent("killgame","targetname");
k1 = getent("kr1","targetname");
k2 = getent("kr2","targetname");
k3 = getent("kr3","targetname");
while(1){
trigger waittill("trigger", user);
o = user getOrigin();
x=o[0];
y=o[1];
z=o[2];

k1 moveTo(user getOrigin(), 1, .9, .1);
rand = RandomIntRange( -30, 31 );
rand2 = RandomIntRange( -30, 31 );
ot = [x+=rand, y+=rand2, z];
k2 moveTo(ot, 1, .9, .1);
rand = RandomIntRange( -30, 31 );
rand2 = RandomIntRange( -30, 31 );
//k3 moveTo((x+=rand,y+=rand2,z), 1, .9, .1);
wait 1;
}
}

Re: origins and entities

Posted: June 20th, 2013, 9:16 pm
by F |Madness| U
pcbouncer wrote:ot = [x+=rand, y+=rand2, z];
I don't think you can construct it like this. The way you seperated the x,y,z values was treating the getorigin() value as an array of the three values, so I guess you would have to recompile it like that.

Ie.

Code: Select all

ot[0] = x+=rand;
ot[1] = y+=rand2         // created array of x,y,z values - the new origin value.;
ot[2] = z;
k2 moveTo(ot, 1, .9, .1);
Still don't know if this would work though, just my theory.

Re: origins and entities

Posted: June 20th, 2013, 9:22 pm
by pcbouncer
doesnt work, i think bbecause its not considered an origino, only an array

Re: origins and entities

Posted: June 20th, 2013, 9:35 pm
by pcbouncer
lol i had += inside a statement x) it works now, thanks for the help

Re: origins and entities

Posted: June 20th, 2013, 10:00 pm
by F |Madness| U
Great, that surprised me that it even worked :P Glad you got it sorted.

Re: origins and entities

Posted: June 21st, 2013, 11:36 am
by Rezil
Drofder2004 wrote: Even easier:

Code: Select all

trigger_ent thread maps\mp\_utility::triggerOff(); /* triggerOn(); */
This only works if your trigger is not linked to anything. If it is, triggerOff() and triggerOn() don't work. Those two functions are helpers, in reality the trigger is simply moved -10000 units on the Z axis. So use them only when not using linkTo(ent) on your trigger as well.