Author Topic: Question Thread  (Read 32458 times)

0 Members and 1 Guest are viewing this topic.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Question Thread
« Reply #120 on: April 11, 2010, 03:19:58 pm »
Try replacing this AppOnIdle(); then..

Code: [Select]
Procedure AppOnIdle(Ticks: Integer); 
var BotID,DC: Byte;   
begin
for DC := 1 to 32 do if GetPlayerStat(DC,'Alive') = true then begin // This is a timer that will force the Berserker a knife every 10 seconds.
if Klasse[DC] = 'Berserker' then begin     // But only if he´s alive.
if ticks mod (60 * 10) = 0 then
ForceWeapon(DC,14,255,0);
    end;

for DC := 1 to 32 do
if GetPlayerStat(DC, 'Active') = true then
        if GetPlayerStat(DC, 'Alive') = true then
        if Klasse[DC] = 'Mage' then                       
        if ticks mod (60 * 7) = 0 then
        ForceWeapon(DC,14,255,0);
for BotID := 1 to 32 do if GetPlayerStat(BotID,'Human') = false then begin //Checkin if BotID is actually a bot..
if GetPlayerStat(BotID,'Deaths') < 2 then begin //Checking if BotID has less than 2 deaths..
SetScore(DC,GetPlayerStat(DC,'Kills') +1 );
SetScore(BotID,0);
if ticks mod (60 * 5) = 0 then
ForceWeapon(BotID,14,GetPlayerStat(BotID,'Secondary'),0); //Then give BotID a knife every 5 seconds.
end else KickPlayer(BotID); //If BotID has more/equal 2 deaths, kick him..
end;
   
for DC := 1 to 32 do if GetPlayerStat(DC,'Alive') = true then begin //The timer for the Thief class. Thieves get
if Klasse[DC] = 'Thief' then //one knife every 8 seconds.
if ticks mod (60*8) = 0 then
ForceWeapon(DC,14,255,0);
end;

for DC := 1 to 32 do if GetPlayerStat(DC,'Alive') = true then begin //The timer for the Ninja class. Ninjas get
if Klasse[DC] = 'Ninja' then //one knife every 8 seconds.
if ticks mod (60 * 8) = 0 then
ForceWeapon(DC,14,255,0);
end;
end;
end;

Otherwise, I have no idea.
www.soldatx.com.br - The brazilian Soldat community.

DarkCrusade

  • Guest
Re: Question Thread
« Reply #121 on: April 12, 2010, 06:40:48 am »
I did some testing: Script compiles and works fine except that the bot I summon is invincible and has no name. In addition I don´t get his kills, though they are set to 0 again. Bot kicking works also.

Bot file: Name: Minion.bot

Code: [Select]
[BOT]
Name=KnifeMinion
Color1=$FFFFFFFF
Color2=$FFFFFFFF
Skin_Color=$FFFFFFFF

Hair_Color=$FFFFFFFF
Favourite_Weapon=Knife
Secondary_Weapon=
Friend=
Accuracy=0
Shoot_Dead=0
Grenade_Frequency=100000000
Camping=255
OnStartUse=255
Hair=4
Headgear=1
Chain=0
Chat_Frequency=10000000000
Chat_Kill=Are you proud of me, master?
Chat_Dead=See you ... in a while.
Chat_Lowhealth=Food ... give me ... foood!
Chat_SeeEnemy=A knife in the right moment can change everything!
Chat_Winning=See, I can serve my master well.


He shouldn´t talk at all and should throw his knife (but currently he doesn´t).
« Last Edit: April 12, 2010, 06:51:00 am by DarkCrusade »

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Question Thread
« Reply #122 on: April 12, 2010, 09:34:14 am »
Weapon has to be Combat Knife  :P
You can disable bot chat in soldat.ini, it's on bottom of file.

DarkCrusade

  • Guest
Re: Question Thread
« Reply #123 on: April 12, 2010, 09:42:58 am »
Do you mean chat frequency? It doesn´t work, the bot will say "Flag!" and "Drop your Weapon!" anyway (it´s in the font folder).

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Question Thread
« Reply #124 on: April 12, 2010, 09:47:33 am »
You need to edit it in Soldat.ini

 [BOTS]
  Difficulty=10
  Chat=0

From 1 to 0, aye.

If you want bots to say stuff at some points you can use the BotChat function.
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

DarkCrusade

  • Guest
Re: Question Thread
« Reply #125 on: April 12, 2010, 10:11:11 am »
That solved it, croat. Thank you :)

But still, the bot is invisible and has no name ... and I don´t get any points from him.

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Question Thread
« Reply #126 on: April 12, 2010, 10:15:20 am »
Code: [Select]
[BOT]
Name=KnifeMinion
Color1=$FFFFFFFF
Color2=$FFFFFFFF
Skin_Color=$FFFFFFFF
Hair_Color=$FFFFFFFF
Favourite_Weapon=Knife
Secondary_Weapon=Knife
Friend=
Accuracy=0
Shoot_Dead=0
Grenade_Frequency=7
Camping=255
OnStartUse=255
Hair=4
Headgear=1
Chain=0
Chat_Frequency=0
Chat_Kill=Are you proud of me, master?
Chat_Dead=See you ... in a while.
Chat_Lowhealth=Food ... give me ... foood!
Chat_SeeEnemy=A knife in the right moment can change everything!
Chat_Winning=See, I can serve my master well.
You need to make sure that the numbers are valid, no enormous numbers and no empty lines.
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Question Thread
« Reply #127 on: April 12, 2010, 10:29:43 am »
Bot which spawns with a knife and throws a knife:
Code: [Select]
Favourite_Weapon=Combat Knife
Secondary_Weapon=1

DarkCrusade

  • Guest
Re: Question Thread
« Reply #128 on: April 13, 2010, 12:20:43 pm »
--Last post deleted-- (I don´t like doubleposting)

So I cannot use the ninja class since one part of the ninja function doesn´t work. The problem part is this one ...

Code: [Select]
Procedure OnFlagScore(ID,Teamflag:byte);
begin
if Klasse[ID] = 'Ninja' then begin
GiveBonus(ID, 1);
WriteConsole(ID,'############################################################',Color);
WriteConsole(ID,'You are granted 25 seconds predator time for scoring!', Color);
WriteConsole(ID,'############################################################',Color);
end;
end;

Well, help me fixing it or give me a brandnew idea for a better class ;)

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Question Thread
« Reply #129 on: April 13, 2010, 12:59:48 pm »
What the? I don't see anything wrong there. Maybe you assigned the Klasse var somewhere wrong.
Otherwise, no idea, actually it should work :| (And please remove the ###'s, gah can't see them :o)

DarkCrusade

  • Guest
Re: Question Thread
« Reply #130 on: April 14, 2010, 08:19:20 am »
What is the ID of the flamer? For my new class I need a ForceWeapon function ...

Code: [Select]
procedure OnPlayerSpeak(ID:Byte;Text:String);
begin

[...]

// Engineer (choose class)

if LowerCase(Text) = '!engineer' then begin
WriteConsole(ID,'You are now a ENGINEER! (special command: !gun' Color);
WriteConsole(ID,'For 5 kills you are able to get a special gun for 20 seconds!', Color);
Klasse[ID] := 'Engineer';
end;

// Special gun (for Engineer)

if LowerCase(Text) = '!gun' then begin
ForceWeapon(ID,{FlamerID},0,0);
WriteConsole(ID,'You got your special weapon ready to your hands!', Color);
end;
[...]

end;

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Question Thread
« Reply #131 on: April 14, 2010, 08:32:57 am »
Try this:

ForceWeapon(ID,11,0,0);

Flamer ID is 11.
www.soldatx.com.br - The brazilian Soldat community.

DarkCrusade

  • Guest
Re: Question Thread
« Reply #132 on: April 14, 2010, 09:26:55 am »
Thank you, where can I find the ID list?

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Question Thread
« Reply #133 on: April 14, 2010, 09:41:05 am »
In the core.pas (default) as consts.

DarkCrusade

  • Guest
Re: Question Thread
« Reply #134 on: April 14, 2010, 09:57:54 am »
Ah thanks. I don´t get around the problem with the KnifeMinion so I removed it and instead the player gets full health for killing someone. I got a problem with a little function for the Engineer. Here is the log ...

Code: [Select]
10-04-14 16:53:34  [*] Knife Server -> [Error] (221:44): Close round expected
10-04-14 16:53:34  [*] Compilation Failed.
10-04-14 16:53:34 Shutting down server...

And here the procedure.

Code: [Select]
Procedure AppOnIdle(Ticks: Integer); 
var DC: Byte;
begin

[...]

// Engineer (1 knife / 7 seconds)

        for DC := 1 to 32 do
if GetPlayerStat(DC, 'Active') = true then
             if GetPlayerStat(DC, 'Alive') = true then
if Klasse[DC] = 'Engineer' then                       
             if ((GetPlayerStat(DC, 'Primary')) Primary = 11) = false then
if ticks mod (60 * 7) = 0 then
                  ForceWeapon(DC,14,255,0);
            end;
        end;
   end;

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Question Thread
« Reply #135 on: April 14, 2010, 09:59:47 am »
Code: [Select]
if GetPlayerStat(DC, 'Primary') <> 11 then

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Question Thread
« Reply #136 on: April 14, 2010, 11:56:37 am »
Code: [Select]
10-04-14 16:53:34  [*] Knife Server -> [Error] (221:44): Close round expected
10-04-14 16:53:34  [*] Compilation Failed.
10-04-14 16:53:34 Shutting down server...
Why don't you read the god damned error? It clearly says that there is a close round "( )" mistake in line 220 column ~44.

DarkCrusade

  • Guest
Re: Question Thread
« Reply #137 on: April 14, 2010, 12:15:12 pm »
Well, now I know at least, Gizd :P And I read it. I didn´t know how to create a timer that displays the text like I´ve seen somewhere else so I tried this:

AppOnIdle procedure

Code: [Select]
// Special Gun (duration = 5 seconds)

for DC := 1 to 32 do
if GetPlayerStat(DC, 'Alive') = true then
if Klasse[DC] = 'Engineer' then
if ticks mod (60 * 5) = 5 then
DrawText(DC,'5 seconds left',60,Color,(255,255,255),5,50);
if ticks mod (60 * 5) = 4 then
DrawText(DC,'4 seconds left',60,Color,(255,255,255),5,50);
if ticks mod (60 * 5) = 3 then
DrawText(DC,'3 seconds left',60,Color,(255,255,255),5,50);
if ticks mod (60 * 5) = 2 then
DrawText(DC,'2 seconds left',60,Color,(255,255,255),5,50);
if ticks mod (60 * 5) = 1 then
DrawText(DC,'1 second left',60,Color,(255,255,255),5,50);
if ticks mod (60 * 5) = 0 then
DrawText(DC,'Gun removed',60,Color,(255,255,255),5,50);
ForceWeapon(DC,14,14,0);

Darn I hope I could fix all those bugs myself. Note for Gizd: Yeah, it´s the same error. Hurr. Hurr.

Code: [Select]
10-04-14 19:23:06  [*] Knife Server -> [Error] (230:46): Close round expected
10-04-14 19:23:06  [*] Compilation Failed.
10-04-14 19:23:06 Shutting down server...
« Last Edit: April 14, 2010, 12:24:23 pm by DarkCrusade »

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Question Thread
« Reply #138 on: April 14, 2010, 01:11:15 pm »
Dear lord that's ugly.. Let me give a shot at teaching you a bit and let's go over your code. I'm assuming this is in AppOnIdle
And please use 2 spaces for indentations and not tabs. Tabs suck, they're being treated differently all the time. A space is always a sincle char space.

Code: [Select]
// Special Gun (duration = 5 seconds)
for DC := 1 to 32 do
  if GetPlayerStat(DC, 'Alive') = true then
So, you're checking wether all 32 players are alive every second? Are you sure that's needed?

Code: [Select]
       if Klasse[DC] = 'Engineer' then
         if ticks mod (60 * 5) = 5 then
           DrawText(DC,'5 seconds left',60,Color,(255,255,255),5,50);
Now this piece of code work every 5th second, if a player is alive and an engineer.

Code: [Select]
if ticks mod (60 * 5) = 4 then
  DrawText(DC,'4 seconds left',60,Color,(255,255,255),5,50);
if ticks mod (60 * 5) = 3 then
  DrawText(DC,'3 seconds left',60,Color,(255,255,255),5,50);
if ticks mod (60 * 5) = 2 then
  DrawText(DC,'2 seconds left',60,Color,(255,255,255),5,50);
if ticks mod (60 * 5) = 1 then
  DrawText(DC,'1 second left',60,Color,(255,255,255),5,50);   
if ticks mod (60 * 5) = 0 then
  DrawText(DC,'Gun removed',60,Color,(255,255,255),5,50);
ForceWeapon(DC,14,14,0);
You forgot to use begin-end. That's a pity cause i explained it when you started this topic.. because it's hella important.
If..then (as well as many other commands) will BY DEFAULT only read the next line as statement (statement = what happens after then). So basically above code will be calle EVERY apponidle. And DC will ALWAYS be 32 because the loop ended. Basically the 32th player will be harrased with a message almost every second, and his weapon will be forced EVERY second.

Honestly It's not clear to me what you're trying to accomplish here. But I'm sure it'll be easier to simply add a global variable to the script and call it EngineerTimer or something. Then use apponidle to increase/decrease it every second and make something like:
Code: [Select]
If EngineerTimer < 6 then begin
  if EngineerTImer < 1 then begin
    EngineerTimer = STARTTIME;
    //remove gun
  end else
    DrawText(DC,inttostr(EngineerTimer)+' second left',60,Color,(255,255,255),5,50);
end;
EngineerTimer := EngineerTimer - 1;

Good luck DC, but to be honest I'm starting to get the impression you're not really a coder.. That's a bit personal, because I think programming requires more talent than practice. Oh, you shouldn't mind me too much ;)
   
Come join: EliteCTF
Listen to: My Music

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Question Thread
« Reply #139 on: April 14, 2010, 01:12:28 pm »
Pfft, nvm JFK was faster :D

You need to use RGB(R, G, B);
For the timer you need a var.
To display it:
Code: [Select]
if (TimerVar < 6) and (TimerVar > 0) then // If you set the first number to 11 it would display 10..1 seconds; the 0 is there so it doesn't say "0 seconds left"
  DrawText(DC, inttostr(TimerVar) + ' seconds left', 180, Color, RGB(255,255,255), 50, 300); // Delay: 1 second = 60 ticks :D, it should be atleast sth. around 3 seconds

if TimerVar = 0 then // check if timer var is zero and say the gun was removed
  DrawText(DC, 'Gun removed..', 180, Color, RGB(255,255,255), 50, 300);