Page 1 of 2

Script help.

Posted: October 14th, 2008, 7:49 pm
by zipperdude
Does anyone know how to make the script for... like on nm_dual where u have to shoot the buttons in a certain order for the door or what ever happens to happen?
I wanna use taht in my map lol.

Re: Script help.

Posted: October 15th, 2008, 12:52 am
by Nightmare
It's a bit complicated and requires some good knowledge of scripting. Here are all the necessary parts you need.

Code: Select all

main()
{
   maps\mp\_load::main();

   level.codeCount=0;
      level.code="";

      for(i=1;i<4;i++) //Change 4 to however many triggers you have
   {
      trig = getent("mp_indoors_trigger"+i,"targetname");
      trig thread checkTrig(i);
   }
}

checkTrig(i)
{
   while(1)
   {
      self waittill("trigger",user);
      if(level.codeCount<3) //Change 3 with however long your code is.
      {
         level.code=level.code+""+i;
         level.codeCount++;
      }
      if(level.codeCount==3) //Change 3 with however long your code is
      {
         if(level.code==123) //Change 123 to whatever code you want
         {
                //Do Stuff Here
         }
         level.codeCount=0;
         level.code="";
      }
   }
}
Got any questions? Just ask.

Re: Script help.

Posted: October 15th, 2008, 12:59 am
by Soviet
lol, he is never going to understand that :P

Re: Script help.

Posted: October 15th, 2008, 2:12 am
by zipperdude
Soviet wrote:lol, he is never going to understand that :P
lol be quite lol.
I can always try. i have all the time in the world to figure it out. Plus im good at asking nm for help lol.

Re: Script help.

Posted: October 15th, 2008, 6:52 am
by JDogg
zipperdude wrote:
Soviet wrote:lol, he is never going to understand that :P
lol be quite lol.
I can always try. i have all the time in the world to figure it out. Plus im good at asking nm for help lol.
All the time in the world? How long is that?

Re: Script help.

Posted: October 15th, 2008, 2:41 pm
by Soviet
A few hundred billion years.

Re: Script help.

Posted: October 15th, 2008, 9:59 pm
by Drofder2004
Mismatch of types! :P

if(level.code==123) <--- Integer
level.code=level.code+""+i; <--- String

Re: Script help.

Posted: October 15th, 2008, 10:15 pm
by Nightmare
Not with the quake 3 scripting, that's the magic of it. :)
It automatically switches to the correct type without need for stating so. :D

Hence how when you declare a variable, you don't have to declare it's type.

Re: Script help.

Posted: October 15th, 2008, 10:29 pm
by Soviet
Well that is a week of Computer Science knowledge wasted :roll:

Re: Script help.

Posted: October 15th, 2008, 11:20 pm
by zipperdude
I put my info in and it still doesnt do anything can someone help me?
Heres my script:

Code: Select all

main()
{
   maps\mp\_load::main();

   level.codeCount=0;
      level.code="";

      for(i=0;i<10;i++) 
   {
      trig = getent("math_prob_"+i,"targetname");
     trig thread checkTrig(i);
   }
}
checkTrig(i)
{
   while(1)
   {
      self waittill("trigger",user);
      if(level.codeCount<2) //Change 3 with however long your code is.
      {
         level.code=level.code+""+i;
         level.codeCount++;
      }
      if(level.codeCount=2) //Change 3 with however long your code is
      {
         if(level.code==62) //Change 123 to whatever code you want
	{
		door = getent("math_door_1","targetname");
		door rotatepitch(90, 2);
		door waittill("rotatedone");
		wait(5);
		door rotatepitch(-90, 2);
		door waittill("rotatedone");
         }
         level.codeCount==2;
         level.code="";
      }
   }
}
By the way... I have no knoledge of coding, C++ java or anything. I was taking a collage class on it but i quit to work full time for ups then they laid me off :(

Re: Script help.

Posted: October 17th, 2008, 1:09 am
by Drofder2004
Nightmare wrote:Not with the quake 3 scripting, that's the magic of it. :)
It automatically switches to the correct type without need for stating so. :D

Hence how when you declare a variable, you don't have to declare it's type.
hmm, this may be so in vCoD, but not in CoD2/4, and generally. Its bad practice.

Re: Script help.

Posted: October 17th, 2008, 1:19 am
by Nightmare
Drofder2004 wrote:
Nightmare wrote:Not with the quake 3 scripting, that's the magic of it. :)
It automatically switches to the correct type without need for stating so. :D

Hence how when you declare a variable, you don't have to declare it's type.
hmm, this may be so in vCoD, but not in CoD2/4, and generally. Its bad practice.
Meh, might as well take advantage of it. :D

Re: Script help.

Posted: October 17th, 2008, 12:19 pm
by JDogg
Nightmare wrote:
Drofder2004 wrote:
Nightmare wrote:Not with the quake 3 scripting, that's the magic of it. :)
It automatically switches to the correct type without need for stating so. :D

Hence how when you declare a variable, you don't have to declare it's type.
hmm, this may be so in vCoD, but not in CoD2/4, and generally. Its bad practice.
Meh, might as well take advantage of it. :D
Lol, lazy :P.

Re: Script help.

Posted: October 17th, 2008, 11:33 pm
by Nightmare
Not exactly, just being efficient using the tools given. Pointless to change it's type when the game automatically does it for you.

Re: Script help.

Posted: October 18th, 2008, 6:17 am
by zipperdude
:(