two scripts needed

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

Moderator: Core Staff

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

two scripts needed

Post by Nightmare » November 18th, 2006, 3:17 am

ok I need two scripts for my upcoming map.

1. So I make a keypad with numbers. I would like it so you have to press the right buttons in the right order to open a door.

2. Kinda like that script in nm_rain, but I need it so when two people are standing in two different triggers that it activates something.
so like even if someone stands on the spot, they need to wait for a second player to come and stand on the spot.

Thanks alot :D
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Drofder2004 » November 18th, 2006, 3:44 am

Ok, I need sleep so i'm only going to give you an idea of how each is done...

1)
Create the keypad, run 1 thread per button.
Use a level variable (level.code) to gather input...

example..
trigger1 waittill ("trigger");
level.variable = level.variable + "1"; //etc

Then create a enter button that checks the variable...
triggerEnter waittill("trigger");
if(level.code == "<code number here>")
//do something
else
level.code = ""; //Reset code.

2)
Again, use a level vairable to monitor the threads (a thread per trigger + 1 thread)

thread a...
{
level.triggerA = false;
while(1)
{
triggerA waittill("trigger", player);

level.triggerA = true;
while(player isTouching(triggerA))
{
wait 0.1;
}
level.triggerA = false;
}

(Same for trigger 2)

Then run a seperate thread to compare the variables...

{
while(1)
{
if((level.triggerA == true) && (level.triggerB == true))
// Do something

wait 0.1;
}
}


More info some other time (if you still need it).
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
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » November 22nd, 2006, 11:44 pm

could you give me some more info on the first script, I think I understand the second one.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Drofder2004 » November 23rd, 2006, 12:57 am

Ok, so you run 11 threads for the buttons...


button0 = getent("button0","targetname");
button1 = getent("button1","targetname");
button2 = getent("button2","targetname");
... ... ...
button9 = getent("button9","targetname");
buttonEnter = getent("buttonEnter","targetname");

You then run them all into their threads...

button0 thread checkButton("0");
button1 thread checkButton("1");
button2 thread checkButton("2");
... .. ...
button9 thread checkButton("9");
buttonEnter thread checkButton("enter");

Now, you need to create the thread, checkbutton().

Code: Select all

checkButton(button)
{
while(1)
{
   self waittill("trigger");
   
   if(button == "enter")
   {
      if(level.code == level.answer)
         //Open door
      else
         level.code = "";
   }
   else
      level.code += button;
}
}
Very untested, off the top of my head, should work, if it doesn't try for yourself (a couple of things to remember, you will need to define level.code [level.code = "";] before this you run the checkButton threads, and also you will need to define level.answer to be the code [level.answer = "1234";])
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
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » November 23rd, 2006, 4:46 am

I still don't get a lick of this, sorry.
Could you make a gsc file and send it over email? That would help me out alot :)
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Luke » November 23rd, 2006, 8:54 pm

Theres a keypad lock in the map rnr_warehouse, which you have to shoot the numbers to enter the code. The script is over 1000 lines though :o
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php

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

Post by Drofder2004 » November 24th, 2006, 2:13 am

Luke wrote:The script is over 1000 lines though :o
What just for the keypad?

Shooting is a better option I must admit, sometimes pushing triggers that are close together get bad responses...

I will knock up a keypad door now.
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
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » November 24th, 2006, 2:25 am

thank you drof, I <3 you :D
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Luke » November 24th, 2006, 2:43 am

Drofder2004 wrote:
Luke wrote:The script is over 1000 lines though :o
What just for the keypad?

Shooting is a better option I must admit, sometimes pushing triggers that are close together get bad responses...

I will knock up a keypad door now.
yep, they created a gsc just for that. I had a quick look at it, and could not find the actual code lol :P
And yeah, to create it with use triggers would be damn near impossible to operate if u wanted to make a realistic looking one anyway, as the triggers would be too small and close to each other.
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » November 24th, 2006, 3:00 am

yeah, I am fine with shooting
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Drofder2004 » November 24th, 2006, 4:45 am

Sorry, got put on hold til 2moro ;)
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
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » November 24th, 2006, 4:53 am

nooooooooooooooo, drof, you make me sad :(
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Drofder2004 » November 24th, 2006, 5:56 am

Nightmare wrote:nooooooooooooooo, drof, you make me sad :(
Its now 5am, if I had more time I would, but what would you prefer, pavlov or script... infact dont answer that, it my choice... pavlov first :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

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » November 24th, 2006, 4:21 pm

Ok well hurry up. :x
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Drofder2004 » November 24th, 2006, 9:13 pm

Nightmare wrote:Ok well hurry up. :x
lol, for that you have to wait until 2moro :P
(well, real reason is I have had 4 hours sleep and I am not in a great mood :P)

For now, check out the map luke said (rnr) and check their coding :)
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 0 guests