origins and entities
Moderator: Core Staff
origins and entities
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?
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: origins and entities
Code: Select all
x = org[0];
y = org[1];
z = org[2];
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: origins and entities
so like this?
origin = brush1 getOrigin();
x=origin[0];?
origin = brush1 getOrigin();
x=origin[0];?
Re: origins and entities
ah thankyou so much!
Re: origins and entities
one more thing, do you know how to turn triggers on and off???
-
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Re: origins and entities
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.
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
ah ye, that sounds simple enough, boolean flags
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: origins and entities
Even easier:pcbouncer wrote:ah ye, that sounds simple enough, boolean flags
Code: Select all
trigger_ent thread maps\mp\_utility::triggerOff(); /* triggerOn(); */
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: origins and entities
Drofder2004 wrote:Even easier:pcbouncer wrote:ah ye, that sounds simple enough, boolean flagsCode: Select all
trigger_ent thread maps\mp\_utility::triggerOff(); /* triggerOn(); */
^^
Re: origins and entities
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;
}
}
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;
}
}
-
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Re: origins and entities
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.pcbouncer wrote:ot = [x+=rand, y+=rand2, z];
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);
-
Re: origins and entities
doesnt work, i think bbecause its not considered an origino, only an array
Re: origins and entities
lol i had += inside a statement x) it works now, thanks for the help
-
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: origins and entities
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.Drofder2004 wrote: Even easier:Code: Select all
trigger_ent thread maps\mp\_utility::triggerOff(); /* triggerOn(); */
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
Who is online
Users browsing this forum: No registered users and 2 guests