Jaildoors!

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

Moderator: Core Staff

Post Reply
User avatar
Moriar
CJ Newbie
CJ Newbie
Posts: 88
Joined: March 12th, 2006, 8:15 pm
Location: The Netherlands

Jaildoors!

Post by Moriar » August 15th, 2006, 11:43 am

Hello, im trying to make a jail. and those jaildoors can be opened by the button near the door, and the button in the control room....those buttons should open/close them but I want to make another button which opens/closes all together.....the problem is how can I make it? because when door1 is open and door2 is closed it will close door1 and open door2.... So I want to make it that door1 stays closed and door2 will close...
I hope this is enough information to help me.... :)

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » August 15th, 2006, 12:28 pm

So you want a button that closes and opens all the doors at the same time? well dunno the best way of doing that, but if i was to try it i'd have 2 separate buttons, for opening and closing them. And use moveto for the doors, so if door1 was open and door2 was already closed and you used for example door1 moveto ((0, 0,0)1); door2 moveto ((0, 0,0)1); door1 will move to its origin, and door2 will stay on its origin.

User avatar
Moriar
CJ Newbie
CJ Newbie
Posts: 88
Joined: March 12th, 2006, 8:15 pm
Location: The Netherlands

Post by Moriar » August 15th, 2006, 12:31 pm

if I say door1 moveto ((0, 0, 0) 1);

it would move to those coordinates in 1 second? right?

if so....I know what I have to do :D

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » August 15th, 2006, 12:36 pm

Moriar wrote:if I say door1 moveto ((0, 0, 0) 1);

it would move to those coordinates in 1 second? right?

if so....I know what I have to do :D
yep

User avatar
Moriar
CJ Newbie
CJ Newbie
Posts: 88
Joined: March 12th, 2006, 8:15 pm
Location: The Netherlands

Post by Moriar » August 15th, 2006, 1:21 pm

OK Thanks for helping :)

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

Post by Drofder2004 » August 15th, 2006, 4:53 pm

Or you could add a bit of complexity to the situation...

door1 = getent("door1","targetname");

door1.position = 0; (0 = closed, 1 open)

Then when the door is opened using moveZ, you simply next line down..
door1.position = 1;

And when the door closes, again, just change the number...
door1.position = 0;

Now we can use this to make all the doors open or closed...

Code: Select all

while(1)
{
//Get trig ent and door ents here
trig waittill("trigger");

if(door1.position == 1)
   //close the door here
if(door2.position == 1)
   //close door
//etc

trig waittill("trigger");
if(door1.position == 0)
   //open the door
//etc
}
Sweet complex simplicity ;)
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

User avatar
Moriar
CJ Newbie
CJ Newbie
Posts: 88
Joined: March 12th, 2006, 8:15 pm
Location: The Netherlands

Post by Moriar » August 16th, 2006, 11:38 pm

Ok I understand..I think :)

BTW: I dont know what I've done wrong in this script (its the old script)

This are 2 doors, and only 1 open and 1 close button(2 buttons for eacht door), no open/close buttons to open/close them all

Code: Select all

main()
{
thread jail1_1();
thread jail1_2();
thread jail2_1();
thread jail2_2();
}
jail1_1()
{
jail1_1door = getent ("jail1door","targetname");
trigger = getent ("jail1_1trig","targetname");
while(1)
{
trigger waittill ("trigger");
jail1_1door moveto  ((-34,857,124), 1);
jail1_1door waittill ("movedone");

}
}

jail1_2()
{
jail1_2door = getent ("jail1door","targetname");
trigger = getent ("jail1_2trig","targetname");
while(1)
{
trigger waittill ("trigger");
jail1_2door moveto  ((-96,857,124), 1);
jail1_2door waittill ("movedone");

}
}

jail2_1()
{
jail2_1door = getent ("jail2door","targetname");
trigger = getent ("jail2_1trig","targetname");
while(1)
{
trigger waittill ("trigger");
jail2_1door moveto  ((158,857,124), 1);
jail2_1door waittill ("movedone");

}
}

jail2_2()
{
jail2_2door = getent ("jail2door","targetname");
trigger = getent ("jail2_2trig","targetname");
while(1)
{
trigger waittill ("trigger");
jail2_2door moveto  ((96,857,124), 1);
jail2_2door waittill ("movedone");

}
}
When I test it and I press a button the doors move to a different way....they disappear out of my map :?

So please help me with this...

And Drofder...My compliments about your signature-picture :wink:

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » August 17th, 2006, 12:05 am

I don't think you understand what the moveto command is actually doing. The first 3 numbers are for moving the object from its origin along a specified axis. so jail1_1door moveto ((-34,857,124), 1); is going to make it move from its origin to -34 on the x axis, 857 on the y axis and 124 on the z axis at the same time.

First 3 numbers = x,y,z only put in the unit number on the axis you want it to move along, and put a 0 on the axis you dont want it to move along. I think you must of entered the maps coordinates of the place you wanted it to move, which isn't how this works.

If you're going to use drofders method for opening and closing all the doors(recommended) then you should use movex/y/z instead of moveto, otherwise it won't work very well.

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

Post by Drofder2004 » August 17th, 2006, 1:19 am

Luke wrote:I don't think you understand what the moveto command is actually doing. The first 3 numbers are for moving the object from its origin along a specified axis. so jail1_1door moveto ((-34,857,124), 1); is going to make it move from its origin to -34 on the x axis, 857 on the y axis and 124 on the z axis at the same time.

First 3 numbers = x,y,z only put in the unit number on the axis you want it to move along, and put a 0 on the axis you dont want it to move along. I think you must of entered the maps coordinates of the place you wanted it to move, which isn't how this works.

If you're going to use drofders method for opening and closing all the doors(recommended) then you should use movex/y/z instead of moveto, otherwise it won't work very well.
moveTo literally does what it says, it move to a set coordinate. The reason it seems to move how you think Luke, eg -37 on X, is because the brushmodel doe not know where its own origin is so set its origin as 0,0,0. So the coordinate 1,1,1 may not be the same as the actual coordinates. you can counter this, but tbh, just use MoveX/Y/Z much simpler commands.

And btw, thanks for the "compliments" ;)

If you really want to use moveTo, then I recommend you learn how targeting work, and how to use script_origins.
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

User avatar
Moriar
CJ Newbie
CJ Newbie
Posts: 88
Joined: March 12th, 2006, 8:15 pm
Location: The Netherlands

Post by Moriar » August 17th, 2006, 12:51 pm

I probably already know how it works... :D the Targeting and stuff... So thanks for helping...
I will try to fix it the right way :)....
But the script is fine?
I only have to add a target(which is the script_origin)...right?

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » August 17th, 2006, 1:54 pm

Well it works thats all i know, maybe not the proper way of using it, but i've seen it used that way before.

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

Post by Drofder2004 » August 17th, 2006, 4:31 pm

This is how I would do it...

Create all the jail doors, and name them "jaildoor", now make the trigger for each door, but do not give them a targetname.
Now select the the first jail door, then select the first trigger and then target them using CTRL-K (or W for CoD2)

Now use this code....

Code: Select all

main()
{
jaildoor = getentarray("jaildoor","targetname");
for(i=0;i<jaildoor.size;i++)
   {
   temp = jaildoor.target;
   jaildoor thread door_move(temp);
   }
}

door_move(trig)
{
while(1)
{
   trig waittill("trigger");
   self moveZ(100, 2);
   trig waittill("trigger");
   self moveZ(-100, 2);
}
}
2 Threads to control and INFINITE amount of jaildoors ;)
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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest