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, 12:29 am

KillerSam wrote:doubt it drofder...you will get through first door MAYBE, then u r screwed...i can swear that.
I can get all the way nearly >.<
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, 1:27 am

Nearly? NEARLY? THAT'S NOT GOOD ENOUGH SOLDIER!

I've yet to see someone do it. People have gotten close, but that's been mainly down to luck and me dropping subtle hints lol.
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 20th, 2006, 1:32 am

Drofder, i've been trying to get a trigger to play a sound just for the user that triggers it but so far i can only get it to work for text.
here the code i used

Code: Select all

gap260() 
{ 
gap260_trig = getent ("260_trig","targetname"); 
gap260_org = getent ("260_org", "targetname"); 

while (1)
{
		players = getentarray("player", "classname");

		for(i=0;i<players.size;i++)
		{
gap260_trig waittill ("trigger",user);
user iprintlnbold ("Well done, you're a pro! Now go make a new record in the EXPERTZ ONLY section!");
user playsound("clap"); 

wait 3;
		}
	wait 3;
	}
} 
It works for the text, but the sound just works as normal so if a player triggers it anyone in range of it also hears it :? do u know how to make it work for sounds too?

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, 1:48 am

Code: Select all

gap260()
{
gap260_trig = getent ("260_trig","targetname");
gap260_org = getent ("260_org", "targetname");

while (1)
{
gap260_trig waittill ("trigger",user);
user iprintlnbold ("Well done, you're a pro! Now go make a new record in the EXPERTZ ONLY section!");
user playsound("clap");
wait 3;
}
}
If that doesnt work, then try...

Code: Select all

gap260()
{
gap260_trig = getent ("260_trig","targetname");
gap260_org = getent ("260_org", "targetname");

while (1)
{
gap260_trig waittill ("trigger",user);
user iprintlnbold ("Well done, you're a pro! Now go make a new record in the EXPERTZ ONLY section!");
user playlocalsound("clap");
wait 3;
}
}
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

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 20th, 2006, 2:38 am

Thanks,

Code: Select all

user playlocalsound 
works :wink:

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, 2:40 am

Luke wrote:Thanks,

Code: Select all

user playlocalsound 
works :wink:
Yeh, I found it in my "command list" and it looked like the answer so I editted :P
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

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 20th, 2006, 3:42 am

What about when its a differen't kind of trigger, like trigger damage. since it's triggered by damage and not the user, is it still possible to do the same thing?

If its possible could u try it on this plz?

Code: Select all

secret_door()
{
door1_trig = getent("door1_trig","targetname");
door1 = getent ("door1","targetname");
while (1)
{
door1_trig waittill ("damage", idamage);
if(idamage > 100)
	{
user iprintlnbold ("Great Shot!");	
door1 moveto ((0, 48, 0), 3,1,2);
door1 waittill ("movedone");
wait 3;
door1 moveto ((0, 0, 0), 3,1,2);
door1 waittill ("movedone");
wait 5;
	}
else if(idamage < 100)
user iprintlnbold ("Try again");
}
}

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

Post by Pedsdude » February 20th, 2006, 4:51 pm

lmao, I told you Drofder would have the solution Lule ;)
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 20th, 2006, 6:38 pm

Yes, i'm pleased with that :D

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, 7:01 pm

The accumulating damage switch.

Code: Select all

main()
{
thread door_trigger();
}

door_trigger()
{
door1_trig = getent("door1_trig","targetname");
door1 = getent ("door1","targetname");
	
accum = 0;

while (accum < 300)
{
door1_trig waittill ("damage", iDamage);
   {
	accum = accum + iDamage;
   }
}
door1 movez(300, 1);
door1 waittill("movedone");
door1 movez(-300, 1);
door1 waittill("movedone");
thread door_trigger();
}
A run down on what this script does.

When the thread is started it sets accum to 0. (Accum can be named anything you want).
The "while" script is then set in motion, it will keep running, until accum becomes greater than 300.
While this is running, the door trigger is waiting until it takes damage, and it record the damage it takes as "iDamage" (this can also be renamed).

iDamage is then accumulated by this piece of code

Code: Select all

accum = accum + iDamage;
How this works.
accum = 0 and iDamage = 50.
accum (0) + iDamage(50) = accum(now accum = 50 not 0).
accum(50) + iDamage(50) = accum(100)
accum(100)....

Once accum = 300+ the while script ends and the script continues.

Code: Select all

door1 movez(300, 1);
door1 waittill("movedone");
door1 movez(-300, 1);
door1 waittill("movedone");
The door opens and then closes again. (This can be any action, moving platform, door, etc)

Code: Select all

thread door_trigger();
The thread is restarted.
Accum is reset to 0.

Have Fun ;)
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, 7:29 pm

Niiiiiiiiiiiiiiiice :)

By the way, I'm redesigning the secret room to stop people getting as close as they have done, so will rerelease a later version of peds_pace in the near future.
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 20th, 2006, 7:51 pm

Drofder2004 wrote:The accumulating damage switch.

Code: Select all

main()
{
thread door_trigger();
}

door_trigger()
{
door1_trig = getent("door1_trig","targetname");
door1 = getent ("door1","targetname");
	
accum = 0;

while (accum < 300)
{
door1_trig waittill ("damage", iDamage);
   {
	accum = accum + iDamage;
   }
}
door1 movez(300, 1);
door1 waittill("movedone");
door1 movez(-300, 1);
door1 waittill("movedone");
thread door_trigger();
}
A run down on what this script does.

When the thread is started it sets accum to 0. (Accum can be named anything you want).
The "while" script is then set in motion, it will keep running, until accum becomes greater than 300.
While this is running, the door trigger is waiting until it takes damage, and it record the damage it takes as "iDamage" (this can also be renamed).

iDamage is then accumulated by this piece of code

Code: Select all

accum = accum + iDamage;
How this works.
accum = 0 and iDamage = 50.
accum (0) + iDamage(50) = accum(now accum = 50 not 0).
accum(50) + iDamage(50) = accum(100)
accum(100)....

Once accum = 300+ the while script ends and the script continues.

Code: Select all

door1 movez(300, 1);
door1 waittill("movedone");
door1 movez(-300, 1);
door1 waittill("movedone");
The door opens and then closes again. (This can be any action, moving platform, door, etc)

Code: Select all

thread door_trigger();
The thread is restarted.
Accum is reset to 0.

Have Fun ;)
sweet! thanks :)

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, 8:15 pm

Pedsdude wrote:Niiiiiiiiiiiiiiiice :)

By the way, I'm redesigning the secret room to stop people getting as close as they have done, so will rerelease a later version of peds_pace in the near future.
Maybe you can fix the bug near the end that stops the platforms from being used only once ;)

Also, maybe add something to the end to notify them they are finished.

Code: Select all

end_trig = getent("end_trig","targetname");
while(1)
{
end_trig waittill ("trigger",user);
user iprintlnbold("Congrats");
}
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

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 20th, 2006, 9:37 pm

Drofder2004 wrote:
Pedsdude wrote:Niiiiiiiiiiiiiiiice :)

By the way, I'm redesigning the secret room to stop people getting as close as they have done, so will rerelease a later version of peds_pace in the near future.
Maybe you can fix the bug near the end that stops the platforms from being used only once ;)

Also, maybe add something to the end to notify them they are finished.

Code: Select all

end_trig = getent("end_trig","targetname");
while(1)
{
end_trig waittill ("trigger",user);
user iprintlnbold("Congrats");
}
In one of the scripts i showed u for the text (which i found somewhere) it also had this peice of code after the while (1)

Code: Select all

players = getentarray("player", "classname");

		for(i=0;i<players.size;i++)
		{
I left that in there coz i thought maybe u forgot to add it in the new script you suggested, but u didn't add it for peds script either...so is that not needed? whats it for otherwise :?

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:37 pm

Luke wrote: In one of the scripts i showed u for the text (which i found somewhere) it also had this peice of code after the while (1)

Code: Select all

players = getentarray("player", "classname");

		for(i=0;i<players.size;i++)
		{
I left that in there coz i thought maybe u forgot to add it in the new script you suggested, but u didn't add it for peds script either...so is that not needed? whats it for otherwise :?
It took me a lot of reading and asking questions to find out what this done (I thank Ezekiel Victor for his help).

So heres how I got to understand it (broken down).

Code: Select all

players = getentarray("player", "classname");
This bit is obvious.
getEntArray means Get an Array of Entities.

In the code above, the array that is being looked for is a classname. A classname is given to most things, trigger_use, trigger_multiple, etc.
The classname player is given to... players.

So the script finds all the players on the server. Each player is then put into a list by the script.
The list:
Players (i meaning Integer [number])
so, if 3 players are on the server, each player is given a number.

Players[1]
Players[2]
Players[3]

Once it has found all the players it then starts the for statement.

Code: Select all

for(i=0;i<players.size;i++)
The for statement is constructed like this...

for(start value;while;task)

Code: Select all

i=0
This is the starting value. Variable 'i' is equal to 1.

Code: Select all

i<players.size
This is the confusing part, size does NOT mean how tall, it means how many. So change this to english.

Code: Select all

While, 'i' is less than the amount of players.

Code: Select all

i++
i++ simply means add 1 to i. This is the same as my accumulator script.
i = i + 1 is the same as i++

So this is how the for loop is readin English.

Code: Select all

'i' equals 0. While 'i' is less than the amount of players, add 1 to 'i'
You should then follow the statement with...

Code: Select all

players[i] thread dosomething();
or somewhat similar.

This whole script will simply take every player on the server and make them each individually do a task.

I recommend NOT using this for loop in a map as it will not work correctly. The for loop will not detect players who join late, only players who are there when the loop is run. Stick to using the while loops.

Hope you understand that :)
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 2 guests