Author Topic: Writing my own "class" script!  (Read 3796 times)

0 Members and 1 Guest are viewing this topic.

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
Re: Writing my own "class" script!
« Reply #20 on: May 10, 2009, 02:26:10 pm »
Please don't double post so much, people. You can edit your previous messages and I don't think this topic will die very quickly :p

What i don't get is what you're planning to do after a player dies. Will he have to select a class again or will the same class still apply? In the last case you will need to remember what class each player has chosen and thus you'll need to store that. That means you could use iDante's example the way danmer suggests. Then instead of an array of boolean, create an array of integers and store there for each player a number which represents the class. If the number is zero then the player hasn't chosen yet.

adapted from iDante:
Code: [Select]
var
   picked_class: array[1..32] of integer;

//This bit should run when the player has tried to pick a class.
begin
   if picked_class[ID] > 0 then
      WriteConsole('You already picked a class')
   else begin
      { Give them the bonus here }
      picked_class[ID] := classnumber; //classnumber being the class that the player has chosen
   end;
end;

Btw, I'm always willing to help ppl learn2script (in Dutch). You can find my xfire on elitectf.com

After the player dies he will be put in spectator, The next round you can take a new class. ;)
                  Forum Rules   -   Search

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
Re: Writing my own "class" script!
« Reply #21 on: May 10, 2009, 02:26:51 pm »
Yep, iDante's one is quite more simple than mine :)
I am a beginner too. I'm helping with what i know and i learned alot doing this. If you can explain me what i didn't do correct it could be nice staying in the topic's subject.

And yeah, i don't know what to do when player dies.

D4NG3R : Did you make an includes.txt ?

Edit : JFK, i know what to do, i'll script it =]

I did xD
                  Forum Rules   -   Search

Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Re: Writing my own "class" script!
« Reply #22 on: May 10, 2009, 02:29:03 pm »
Oh ok... So when player dies the chosen class is erased, then player chooses for another one next round ?
Edit : What do you get for a compile error?

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
Re: Writing my own "class" script!
« Reply #23 on: May 10, 2009, 02:30:37 pm »
Oh ok... So when player dies the chosen class is erased, then player chooses for another one next round ?
Edit : What do you get for a compile error?

On map switch the pickclass is set back to 0 :)
                  Forum Rules   -   Search

Offline VinceBros

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 275
Re: Writing my own "class" script!
« Reply #24 on: May 10, 2009, 02:33:27 pm »
Okay =)
When player joins, do you want it do be in spectator, so he doesn't get killed by " Zombiez "

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
Re: Writing my own "class" script!
« Reply #25 on: May 10, 2009, 04:03:48 pm »
JFK helped me with my script  (thx mate) but for some reason its still not working (NO this script aint finished yet, i just wanted to compile it to test  >:(

The second upload is a picture of what i get
the first upload is the .pas
                  Forum Rules   -   Search

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Writing my own "class" script!
« Reply #26 on: May 10, 2009, 04:08:58 pm »
well it stops at test2, try disabling that script (rename Includes.txt for example) and see if the rest compile.

Also, you'll get faster replies at IRC, try #soldat.devs and #soldat.central @ QuakeNet

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Writing my own "class" script!
« Reply #27 on: May 10, 2009, 11:26:15 pm »
In line 6 you have to put a ; (Semicolon) at the end of the line

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Writing my own "class" script!
« Reply #28 on: May 11, 2009, 05:44:11 am »
Not really. First of all the compiler always adds a line for some reason, so the place to look is at line 5. Then the error (usually) means that the compiler expected a semicolon before the given line (and char). So that would be a semicolon after:

Code: [Select]
var picked_class : array[1..32] of integer;

Also remove the semicolon after 'begin', there's never a semicolon after 'begin'.
Come join: EliteCTF
Listen to: My Music

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Writing my own "class" script!
« Reply #29 on: May 11, 2009, 07:23:27 am »
I write that in the Morning, so i forget that with the line :D

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
Re: Writing my own "class" script!
« Reply #30 on: May 11, 2009, 11:55:24 am »
Edit + repost it please, Because I keep getting that error, even after changing it to what you said =/
                  Forum Rules   -   Search

Offline y0uRd34th

  • Camper
  • ***
  • Posts: 325
  • [i]Look Signature![/i]
Re: Writing my own "class" script!
« Reply #31 on: May 11, 2009, 03:01:27 pm »
If you get an error post the code so we can faster help you, because we don'T know if the code uper is the current one you use.