CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Forums
Gaming
Call of Duty Classics
Tutorial Section
Basic GSC Coding: Operations
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="CabCon" data-source="post: 580" data-attributes="member: 1"><p>Hello</p><p></p><p>This is another basic tutorial I wanted to make. This one is about numbers and math functions.</p><p></p><p>In cod you can use 2 kinds of numbers, "int"s and "float"s. "Int"s are entire numbers ( 2, 3, 50, 1000, 45 ... ) and "float"s are decimal numbers ( 1.1, 4.324, 6.67, 3.141592 ... ). If you have for example the number 5.31 you can do some operations with it, like:</p><p>[CODE]</p><p>Int( 5.31 ) //will return 5</p><p>Floor( 5.31 ) //will return 5 ( aproximation to down )</p><p>Ceil( 5.31 ) //will return 6 ( aproximation to up )</p><p>[/CODE]</p><p></p><p></p><p>The game also has some interesting functions relationed with "Int"s and "Float"s which give you random numbers, they are this 4:</p><p>[CODE]</p><p>randomInt( number )</p><p>randomIntRange( number 1, number 2 )</p><p>randomFloat( number )</p><p>randomFloatRange( number 1, number 2 )</p><p>[/CODE]</p><p></p><p></p><p>Lets put some real examples with them:</p><p>[CODE]</p><p>luckynumber = randomInt( 6 ); //will give a random number beetween 0 and 6</p><p>wait ( randomFloatRange( 3, 6 ) ); //will wait a random ammount of time beetween 3 and 6 seconds, the times will probably be decimal numbers</p><p>tutorialnumber = randomIntRange( 1, 50 ); //random number beetween 1 and 50</p><p>wait ( randomFloat( 2 ) ); //will give you a random number beetween 0 and 2</p><p>[/CODE]</p><p></p><p></p><p>Also the game allows you to use some basic operations such as: divisions, multiplications..... They work like this with real examples ( I recommend doing operations with pathenthesys: "( )" ):</p><p>[CODE]</p><p>plus = ( 3 + 15 ); // 18</p><p>minus = ( 100 - 30 ); // 70</p><p>multiplied = ( 2 * 2 ); // 4</p><p>divided = ( 100 / 20 ); // 5</p><p>moduled = ( 10 % 3 ); // 1, is the leftover of doing a division: 10 / 3 = 3, but there is one 1 missing, thats the module.</p><p>nepperlog = log( 1 ); // 0, is the natural logarithm ( Nepper one )</p><p>cosine = cos( 0 ); // 1, cosine, trigonometrical function</p><p>sine = sin( 90 ); // 1, sine, trigonometrical function</p><p>tangent = tan( 45 ); // 1, tangent, trigonometrical function</p><p>arcosine = asin( 1 ); // 90, arco sine, trigonometrical function</p><p>arcocosine = acos( 1 ); // 0, arco cosine, trigonometrical function</p><p>arcotangent = atan( 1 ); // 45, arco tangent, trigonometrical function</p><p>absolutevalue = abs( -3 ); // 3, if the number is lower than 0, it returns that number multiplied by -1</p><p>squareroot = sqrt( 4 ); // 2, square root</p><p>whatonebigger = max( 3, 9 ); //9, 9 is bigger than 3</p><p>whatonesmaller = min( 2, 6 ); //2, 2 is smaller than 6</p><p>[/CODE]</p><p></p><p></p><p>Well, thats it, if you dont know what is mathematic operation -> Google it</p><p></p><p>Thanks for reading, [USER=1]@CabCon[/USER]. Credits goes to Yamato.</p></blockquote><p></p>
[QUOTE="CabCon, post: 580, member: 1"] Hello This is another basic tutorial I wanted to make. This one is about numbers and math functions. In cod you can use 2 kinds of numbers, "int"s and "float"s. "Int"s are entire numbers ( 2, 3, 50, 1000, 45 ... ) and "float"s are decimal numbers ( 1.1, 4.324, 6.67, 3.141592 ... ). If you have for example the number 5.31 you can do some operations with it, like: [CODE] Int( 5.31 ) //will return 5 Floor( 5.31 ) //will return 5 ( aproximation to down ) Ceil( 5.31 ) //will return 6 ( aproximation to up ) [/CODE] The game also has some interesting functions relationed with "Int"s and "Float"s which give you random numbers, they are this 4: [CODE] randomInt( number ) randomIntRange( number 1, number 2 ) randomFloat( number ) randomFloatRange( number 1, number 2 ) [/CODE] Lets put some real examples with them: [CODE] luckynumber = randomInt( 6 ); //will give a random number beetween 0 and 6 wait ( randomFloatRange( 3, 6 ) ); //will wait a random ammount of time beetween 3 and 6 seconds, the times will probably be decimal numbers tutorialnumber = randomIntRange( 1, 50 ); //random number beetween 1 and 50 wait ( randomFloat( 2 ) ); //will give you a random number beetween 0 and 2 [/CODE] Also the game allows you to use some basic operations such as: divisions, multiplications..... They work like this with real examples ( I recommend doing operations with pathenthesys: "( )" ): [CODE] plus = ( 3 + 15 ); // 18 minus = ( 100 - 30 ); // 70 multiplied = ( 2 * 2 ); // 4 divided = ( 100 / 20 ); // 5 moduled = ( 10 % 3 ); // 1, is the leftover of doing a division: 10 / 3 = 3, but there is one 1 missing, thats the module. nepperlog = log( 1 ); // 0, is the natural logarithm ( Nepper one ) cosine = cos( 0 ); // 1, cosine, trigonometrical function sine = sin( 90 ); // 1, sine, trigonometrical function tangent = tan( 45 ); // 1, tangent, trigonometrical function arcosine = asin( 1 ); // 90, arco sine, trigonometrical function arcocosine = acos( 1 ); // 0, arco cosine, trigonometrical function arcotangent = atan( 1 ); // 45, arco tangent, trigonometrical function absolutevalue = abs( -3 ); // 3, if the number is lower than 0, it returns that number multiplied by -1 squareroot = sqrt( 4 ); // 2, square root whatonebigger = max( 3, 9 ); //9, 9 is bigger than 3 whatonesmaller = min( 2, 6 ); //2, 2 is smaller than 6 [/CODE] Well, thats it, if you dont know what is mathematic operation -> Google it Thanks for reading, [USER=1]@CabCon[/USER]. Credits goes to Yamato. [/QUOTE]
Verification
Post reply
Forums
Gaming
Call of Duty Classics
Tutorial Section
Basic GSC Coding: Operations
CabConModding is now on facebook! Check the latest Updates, the Site Status and much more now!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top