Key input?

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

Moderator: Core Staff

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

Post by Drofder2004 » February 20th, 2006, 10:39 pm

Also, whenever you see...

Code: Select all

for(;;)
You read that as forever. Simply because the for loop does not end (unless told to). using these incorrectly can cause infinite loop errors.
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

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » February 20th, 2006, 11:02 pm

Code: Select all

main()
{
thread e1();
}
e1()
{
b1 = getent ("b1","targetname");
f1 = getent ("f1","targetname");
l1 = getent ("l1","targetname");
r1 = getent ("r1","targetname");
bottom1 = getent ("bottom1","targetname");
trigger = getent ("e1","targetname");
b1b = getent ("b1b","targetname");
f1b = getent ("f1b","targetname");
l1b = getent ("l1b","targetname");
r1b = getent ("r1b","targetname");
while(1)
{
trigger waittill ("trigger");
bottom1 moveZ (2,1,0.5,0.5);
b1b moveX (-40,1,0.5,0.5);
f1b moveX (40,1,0.5,0.5);
l1b moveY (40,1,0.5,0.5);
r1b moveY (-40,1,0.5,0.5);
wait(1);
b1b moveX (40,1,0.5,0.5);
f1b moveX (-40,1,0.5,0.5);
l1b moveY (-40,1,0.5,0.5);
r1b moveY (40,1,0.5,0.5);
wait(1);
b1 moveZ (66,1,0.5,0.5);
f1 moveZ (66,1,0.5,0.5);
l1 moveZ (66,1,0.5,0.5);
r1 moveZ (66,1,0.5,0.5);
wait(1);
b1 moveX (-8,1,0.5,0.5);
f1 moveX (8,1,0.5,0.5);
l1 moveY (8,1,0.5,0.5);
r1 moveY (-8,1,0.5,0.5);
r1 waittill ("movedone");
wait(2);
bottom1 moveZ (318,2,0.5,0.5);
b1 moveZ (318,2,0.5,0.5);
f1 moveZ (318,2,0.5,0.5);
l1 moveZ (318,2,0.5,0.5);
r1 moveZ (318,2,0.5,0.5);
r1 waittill ("movedone");
wait(1);
bottom1 moveX (-184,2,0.5,0.5);
b1 moveX (-184,2,0.5,0.5);
f1 moveX (-184,2,0.5,0.5);
l1 moveX (-184,2,0.5,0.5);
r1 moveX (-184,2,0.5,0.5);
r1 waittill ("movedone");
wait(2);
bottom1 moveX (-52,2,0.5,0.5);
bottom1 waittill ("movedone");
wait(2);
bottom1 moveZ (-320,1,0.5,0.5);
b1 moveX (192,1,0.5,0.5);
wait(1);
bottom1 moveX (236,1,0.5,0.5);
f1 moveX (176,1,0.5,0.5);
l1 moveX (184,1,0.5,0.5);
r1 moveX (184,1,0.5,0.5);
wait(1);
l1 moveY (-8,1,0.5,0.5);
r1 moveY (8,1,0.5,0.5);
wait(1);
b1 moveZ (-384,1,0.5,0.5);
f1 moveZ (-384,1,0.5,0.5);
l1 moveZ (-384,1,0.5,0.5);
r1 moveZ (-384,1,0.5,0.5);
r1 waittill ("movedone");
}
}
That's the script for the lift at the end of the map - can you see any reason for it to only do it once? :?
Image
Image

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

Post by Drofder2004 » February 20th, 2006, 11:11 pm

With that many things moving, I dont recommend the "waittill movedone" function. Try removing them all and replacing them with times.

Code: Select all

main()
{
thread e1();
}

e1()
{
b1 		= getent ("b1","targetname");
f1 		= getent ("f1","targetname");
l1 		= getent ("l1","targetname");
r1 		= getent ("r1","targetname");
bottom1 = getent ("bottom1","targetname");
trigger = getent ("e1","targetname");
b1b 	= getent ("b1b","targetname");
f1b 	= getent ("f1b","targetname");
l1b 	= getent ("l1b","targetname");
r1b 	= getent ("r1b","targetname");

while(1)
{
trigger waittill ("trigger");
bottom1 moveZ (2,1,0.5,0.5);
b1b 	moveX (-40,1,0.5,0.5);
f1b 	moveX (40,1,0.5,0.5);
l1b 	moveY (40,1,0.5,0.5);
r1b 	moveY (-40,1,0.5,0.5);

wai 1;

b1b 	moveX (40,1,0.5,0.5);
f1b 	moveX (-40,1,0.5,0.5);
l1b 	moveY (-40,1,0.5,0.5);
r1b 	moveY (40,1,0.5,0.5);

wait 1;

b1 		moveZ (66,1,0.5,0.5);
f1 		moveZ (66,1,0.5,0.5);
l1 		moveZ (66,1,0.5,0.5);
r1 		moveZ (66,1,0.5,0.5);

wait 1;

b1 		moveX (-8,1,0.5,0.5);
f1 		moveX (8,1,0.5,0.5);
l1 		moveY (8,1,0.5,0.5);
r1 		moveY (-8,1,0.5,0.5);

wait 2;

bottom1	moveZ (318,2,0.5,0.5);
b1 		moveZ (318,2,0.5,0.5);
f1 		moveZ (318,2,0.5,0.5);
l1 		moveZ (318,2,0.5,0.5);
r1 		moveZ (318,2,0.5,0.5);

wait  2;

bottom1	moveX (-184,2,0.5,0.5);
b1 		moveX (-184,2,0.5,0.5);
f1 		moveX (-184,2,0.5,0.5);
l1 		moveX (-184,2,0.5,0.5);
r1 		moveX (-184,2,0.5,0.5);

wait 2;

bottom1	moveX (-52,2,0.5,0.5);

wait 2;

bottom1	moveZ (-320,1,0.5,0.5);
b1 		moveX (192,1,0.5,0.5);

wait 1;

bottom1	moveX (236,1,0.5,0.5);
f1 		moveX (176,1,0.5,0.5);
l1 		moveX (184,1,0.5,0.5);
r1 		moveX (184,1,0.5,0.5);

wait 1;

l1 		moveY (-8,1,0.5,0.5);
r1 		moveY (8,1,0.5,0.5);

wait 1;

b1 		moveZ (-384,1,0.5,0.5);
f1 		moveZ (-384,1,0.5,0.5);
l1 		moveZ (-384,1,0.5,0.5);
r1 		moveZ (-384,1,0.5,0.5);

wait 1;
}
}
Spaced out to make it easier to read :P
You may need to change the wait values, mine may not work 100% correctly.
:)
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

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » February 20th, 2006, 11:46 pm

OK, will try them ;)
Image
Image

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » February 21st, 2006, 12:11 am

Oh btw, what kind of trigger should I use with this code?:

Code: Select all

end_trig = getent("end_trig","targetname");
while(1)
{
end_trig waittill ("trigger",user);
user iprintlnbold("Congrats");
}
Just trigger_use, with cursorhint:HINT_NOACTIVATE ?
Image
Image

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

Post by Luke » February 21st, 2006, 12:36 am

It should be a trigger_multiple, coz that trigger works when the player touches it without needing input from the player...so ideally u want it where the player has no option but to fall/move through it.

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

Post by Drofder2004 » February 21st, 2006, 1:45 am

Luke wrote:It should be a trigger_multiple, coz that trigger works when the player touches it without needing input from the player...so ideally u want it where the player has no option but to fall/move through it.
Indeed.
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

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » February 21st, 2006, 1:57 pm

Ah ok, so they can't keep setting it off like in ultra_gap_training :)
Image
Image

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » February 21st, 2006, 3:42 pm

Hmmm, well I tested it and it worked, although I don't really have anywhere where you can only trigger it once. Is there any way to make sure you can only do it once every 10 seconds or so? Also, does it show to everyone in the server or just that one person?
Image
Image

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

Post by Luke » February 21st, 2006, 3:58 pm

Pedsdude wrote:Hmmm, well I tested it and it worked, although I don't really have anywhere where you can only trigger it once. Is there any way to make sure you can only do it once every 10 seconds or so? Also, does it show to everyone in the server or just that one person?
It should show for just the one player, but test it with someone to make sure...

If you want it so it can only be triggered once every 10 seconds just add a wait time

Code: Select all

end_trig = getent("end_trig","targetname"); 
while(1) 
{ 
end_trig waittill ("trigger",user); 
user iprintlnbold("Congrats"); 
wait 10;
}

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » February 21st, 2006, 4:44 pm

Oh yeah... stupid me :P
Image
Image

User avatar
Soviet
Core Staff
Core Staff
Posts: 7762
Joined: April 23rd, 2005, 9:12 pm

Post by Soviet » February 21st, 2006, 10:08 pm

KillerSam wrote:
Pedsdude wrote:Oh yeah... stupid me :P
stooooooooooooooooooopid....sorry had too.
lmao...owned

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » February 21st, 2006, 10:42 pm

Shhh.... :P

I can't seem to fix the elevator :( Will just leave the finish message so that people understand they've finished.
Image
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests