Random numbers

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

Moderator: Core Staff

Post Reply
pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Random numbers

Post by pcbouncer » June 18th, 2013, 5:49 pm

is it possible to generate random numbers in codscript?

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: Random numbers

Post by Goro92 » June 18th, 2013, 6:14 pm

Code: Select all

RandomInt( <max> )
check here for scripts http://www.zeroy.com/script/
Image

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: Random numbers

Post by pcbouncer » June 18th, 2013, 7:04 pm

thanks alot :), do you know if there's a method for checking if a user activated a trigger?

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: Random numbers

Post by Goro92 » June 18th, 2013, 7:19 pm

pcbouncer wrote:thanks alot :), do you know if there's a method for checking if a user activated a trigger?
well i am not a good scripter but i'll try to help you

example of code:

Code: Select all

thread_name()
{
trigger = getent("trig_1","targetname");
 
   while (1)
   {
 
      trigger waittill ("trigger", player );
 
      if ( isPlayer( player ) && isAlive( player ) && isdefined( player.done ) ) 
              {
               //when player touch the trigger for 2nd,3rd..ect
               }
      else 
          {
 
//when the player touch the trigger for the first time
player iprintlnbold ("Congratulations, " + player.name + ", you have completed the map!");   
 
   wait 0.5;
 
         player.done = true; 
 
         }
   }
}
if this didn't help you, wait for a good scripter :)
Image

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

Re: Random numbers

Post by Drofder2004 » June 18th, 2013, 7:32 pm

pcbouncer wrote:thanks alot :), do you know if there's a method for checking if a user activated a trigger?

Code: Select all

function()
{
   trigger_ent = getent("trigger_targetname", "targetname")
 
   while(1)
   {
      trigger_ent waittill("trigger", user)
      iprintlnbold("Player " + user.name + " ^7activated the trigger");
 Â  }
}
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
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Random numbers

Post by Drofder2004 » June 19th, 2013, 8:43 pm

randomjumper wrote:well, here are some numbers for you:
...i hope thats enough np
Stay out of the mapping section.
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 24 guests