origins and entities

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

origins and entities

Post by pcbouncer » June 19th, 2013, 8:38 pm

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?

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: origins and entities

Post by Drofder2004 » June 19th, 2013, 8:41 pm

Code: Select all

x = org[0];
y = org[1];
z = org[2];
Image
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

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: origins and entities

Post by pcbouncer » June 19th, 2013, 8:46 pm

so like this?

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

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: origins and entities

Post by pcbouncer » June 19th, 2013, 8:49 pm

ah thankyou so much! :)

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: origins and entities

Post by pcbouncer » June 19th, 2013, 8:50 pm

one more thing, do you know how to turn triggers on and off???

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: origins and entities

Post by F |Madness| U » June 19th, 2013, 9:27 pm

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.
-

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: origins and entities

Post by pcbouncer » June 20th, 2013, 3:24 am

ah ye, that sounds simple enough, boolean flags

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: origins and entities

Post by Drofder2004 » June 20th, 2013, 8:01 pm

pcbouncer wrote:ah ye, that sounds simple enough, boolean flags
Even easier:

Code: Select all

trigger_ent thread maps\mp\_utility::triggerOff(); /* triggerOn(); */
Image
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

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: origins and entities

Post by pcbouncer » June 20th, 2013, 8:59 pm

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(); */

^^ :)

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: origins and entities

Post by pcbouncer » June 20th, 2013, 9:11 pm

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;
}
}

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: origins and entities

Post by F |Madness| U » June 20th, 2013, 9:16 pm

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.
-

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: origins and entities

Post by pcbouncer » June 20th, 2013, 9:22 pm

doesnt work, i think bbecause its not considered an origino, only an array

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: origins and entities

Post by pcbouncer » June 20th, 2013, 9:35 pm

lol i had += inside a statement x) it works now, thanks for the help

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: origins and entities

Post by F |Madness| U » June 20th, 2013, 10:00 pm

Great, that surprised me that it even worked :P Glad you got it sorted.
-

User avatar
Rezil
Core Staff
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

Post by Rezil » June 21st, 2013, 11:36 am

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.
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.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 25 guests