The 'QuakeC lessons' thread[prev. help with script teleport]

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

Moderator: Core Staff

Ben xD
CJ Wannabe
CJ Wannabe
Posts: 27
Joined: February 22nd, 2011, 5:14 pm
Gamertag: v Bouuncee

Re: help with script teleport

Post by Ben xD » April 30th, 2011, 10:41 am

Lol soviet i was looking at ur picture for like 10 minutes, Its addicting :P
The Only Reason Everyone Holds on to Memories So Tightly Is Because Memories Are the Only Things That Don't Change When Everything and Everyone Else Does

Ryan
CJ Newbie
CJ Newbie
Posts: 64
Joined: March 2nd, 2008, 1:18 am
Location: Germany

Re: help with script teleport

Post by Ryan » April 30th, 2011, 3:38 pm

Rezil wrote:Make a variable that contains some random numbers that is 15 letters long, then print out that variable to the player. You can use the built-in function RandomInt(<max>) to get a random value from 0 to <max>-1. Also, you can add to a string by using +("ap"+"ple" would generate a string with the value "apple").
i dont understand what you mean man

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

Re: help with script teleport

Post by Drofder2004 » April 30th, 2011, 5:13 pm

Ryan wrote:
Rezil wrote:Make a variable that contains some random numbers that is 15 letters long, then print out that variable to the player. You can use the built-in function RandomInt(<max>) to get a random value from 0 to <max>-1. Also, you can add to a string by using +("ap"+"ple" would generate a string with the value "apple").
i dont understand what you mean man
Firstly, create a 15 character long variable using random numbers.
To create a string of 15 individual numbers, you will be required to create a string variable and then append a character to that variable after each loop.

So, in Pseudocode:
Create (string) Variable. [*] Generate a random digit and append this digit to the existing variable. Loop from [*] until variable contains 15 characters.

The function for a Random Integer is RandomInt(x) where x is an integer greater than 0.
The method of appending to a variable is 'myVariable = myVariable + "str"' where 'str' is the string you wish to add on (or alternatively 'myVariable =+ "str"')
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

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: help with script teleport

Post by IzNoGoD » April 30th, 2011, 5:44 pm

Drofder2004 wrote:(or alternatively 'myVariable =+ "str"')
(or alternatively 'myVariable += "str"')
LMGTFY!

Its not a glitch... Its the future!

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

Re: help with script teleport

Post by Drofder2004 » April 30th, 2011, 8:03 pm

IzNoGoD wrote:
Drofder2004 wrote:(or alternatively 'myVariable =+ "str"')
(or alternatively 'myVariable += "str"')
My most common error :(
One day I will correctly remember the direction without looking at a cheat sheet
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
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: help with script teleport

Post by waywaaaard » April 30th, 2011, 8:53 pm

Drofder2004 wrote: My most common error :(
One day I will correctly remember the direction without looking at a cheat sheet
One day :P
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

Ryan
CJ Newbie
CJ Newbie
Posts: 64
Joined: March 2nd, 2008, 1:18 am
Location: Germany

Re: help with script teleport

Post by Ryan » April 30th, 2011, 9:01 pm

i still dont understand it... its like jumping from 1+1=2 to pro maths...

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

Re: help with script teleport

Post by Drofder2004 » April 30th, 2011, 10:13 pm

Ryan wrote:i still dont understand it... its like jumping from 1+1=2 to pro maths...
Nah, this is simple. Use Pseudocode and create a step-by-step of what needs to happen

First, an empty string variable.

Code: Select all

myVariable = "";
[/size]
Second create a loop (for/while are the easiest)

Code: Select all

myVariable = "";
for(;;)
{
   
}
[/size]
Third a Randomly generated number between 0-9

Code: Select all

myVariable = "";
for(;;)
{
   // randomInt(10);
}
[/size]
Now make the variable update with the new number each loop

Code: Select all

myVariable = "";
for(;;)
{
   myVariable = myVariable + randomInt(10);
}
[/size]
Now we need to stop the loop after 15 characters

Code: Select all

myVariable = "";
for(i=0;i<15;i++)
{
   myVariable = myVariable + randomInt(10);
}
[/size]
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

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: help with script teleport

Post by IzNoGoD » May 1st, 2011, 9:27 am

If you run this code, try what happens if you switch myvariable=""; with myvariable=0;
That way you might understand things a little better.
LMGTFY!

Its not a glitch... Its the future!

SubGunner
CJ Wannabe
CJ Wannabe
Posts: 17
Joined: February 16th, 2011, 10:41 pm

Re: help with script teleport

Post by SubGunner » May 1st, 2011, 11:20 am

Here ya go download and extract this zip file. Inside is a teleporter prefab.
If you make copies of it make sure you delete the targetname and targets of the trigger and script_origin before making copies. Otherwise they will all link together. Each grouped trigger and script_origin must have unique names.The Trigger is the entrance and the script_origin is the exit.
Also includes a teleporter.gsc file which must be called from your mapname.gsc file and be placed in the maps/mp folder.

http://rrmsweb.com/sub/teleporter.zip

Ryan
CJ Newbie
CJ Newbie
Posts: 64
Joined: March 2nd, 2008, 1:18 am
Location: Germany

Re: help with script teleport

Post by Ryan » May 1st, 2011, 11:33 am

it seems like that forum doesnt like me and keeps deleting my posts...

i still dont understand it i dont know am i officially to ostupid to script or hsould i carry on desperately trying to grasp it with not the slightest chance of success forming the basis for a news announcement ending with the words "then he pointed the weapon at himself"?

SubGunner
CJ Wannabe
CJ Wannabe
Posts: 17
Joined: February 16th, 2011, 10:41 pm

Re: help with script teleport

Post by SubGunner » May 1st, 2011, 11:44 am

No luck with my teleporter? That thing is the easiest script to setup. Even multiple ones.
Don't need to ever alter the script file either.

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

Re: help with script teleport

Post by Drofder2004 » May 1st, 2011, 1:52 pm

SubGunner wrote:No luck with my teleporter? That thing is the easiest script to setup. Even multiple ones.
Don't need to ever alter the script file either.
Read through the thread. If he wanted to simply copy and paste someone elses work, the thread would've finished on the first page.
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: help with script teleport

Post by Drofder2004 » May 1st, 2011, 1:52 pm

Ryan wrote:it seems like that forum doesnt like me and keeps deleting my posts...

i still dont understand it i dont know am i officially to ostupid to script or hsould i carry on desperately trying to grasp it with not the slightest chance of success forming the basis for a news announcement ending with the words "then he pointed the weapon at himself"?
Read through my post step by step and at what point do you not understand?
Wording or the method used in the 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

Ryan
CJ Newbie
CJ Newbie
Posts: 64
Joined: March 2nd, 2008, 1:18 am
Location: Germany

Re: help with script teleport

Post by Ryan » May 1st, 2011, 2:05 pm

why is it myVariable or can it be anything actually?

why is it myVariable = ""; what do the "" do there

why is it for(;;) what do the ;; do there

why is it i=0; i<15 what is i?

how do you print out this stuff then? rezil asked to make players able to see this then...

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests