Author Topic: Idea for a script, is it feasible?  (Read 6370 times)

0 Members and 1 Guest are viewing this topic.

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Idea for a script, is it feasible?
« on: December 12, 2009, 06:01:57 pm »
I've got an idea for a game mode that's kind of complicated, and I was wondering if it would be possible to make a server script that could make this game mode work.

The college I go to hosts Nerf battles on Saturday nights, and my idea is based off a game we sometimes play called Super Villains. The basic rules for the Nerf game are as follows:
-Each person starts on their own individual team (if 12 people are playing, at the beginning there are 12 teams)
-If you get shot, you are now on whichever team the person who shot you is on
-If the leader of a team is shot, all people on that team are free (back on their own team)
-The game ends when everyone is on the same team, and whoever is the leader of that team wins

For the server, I think the general format of the game would be the same as above, but with a few additions to account for this being a Soldat game:
-No bonuses
-A time limit to end the game after a certain time if no one has won yet
-A scoring system
    -1 point for killing someone
    -1 point to the leader of the team whenever a member of that team kills someone
-A way to tell who is on your team (have your clothes change to look the same as your leader? have people on your team emit flames?)
-A limit to how many people can join, probably max 10-12

So that's the basics of my idea. My question is, is it possible to write a script that can handle these rules? Is there a way to modify how points are given to people? Is there a way for the server to keep track of who is on what team and modify players clothes colors or other "team visual awareness system" accordingly?

-edit-
I've thrown together a script. This is my first soldat script, so keep that in mind. Hopefully I've commented on stuff well enough to give an idea about what I was trying to do. If you notice anything that looks potentially problematic, please point it out. I still need to put in the way to identify your team, but the basic system is all there.

-edit May 15, 2010-
I've added to the script:
- now the script will know when a team wins, and there's a way for the game to end that might work, but I need to test it, or for someone to tell me if it will or won't.

However, I won't be able to test the script for a few days while I'm on the road, so there are some things I'm concerned about on which I would appreciate input:
- I'm having trouble figuring out the syntax for a few things. Namely, the giant if-then statement that begins on line 31, I'm pretty sure there are semicolon errors within the procedure.
- The DrawText function on line 59: I want it to say "Team" + (whoever won) + "wins!" I just guessed +'s might work, what should I actually use to combine those?


Code: (Pascal) [Select]
//SuperVillians Script v0.3
 //concocted and shoddily put together by Londonbrig0
 
 var
VTeam: array[1..12] of string; //VTeam is supposed to stand for "villian team"
Leader: array[1..12] of boolean; //and 12 is current max number of players
i: integer; //used for id of players
Winner: boolean; //variable used to end game when everyone is on the same team

//When someone joins, set their team to their own name, and make them a leader
procedure OnJoinGame(ID, Team: byte);
begin
VTeam[ID] := +IDToName(ID);
if VTeam[ID] = +IDToName(ID) then
Leader[ID] := true;
end;

//this is so I can check teams when I'm testing
//I'll probably leave this in to let players check the teams ingame if they want.
function OnCommand(ID: Byte; Text: string): boolean;
begin
if (Text = '/teams') then
for i := 1 to 12 do begin
WriteConsole(ID, +IDToName(i) +' is on team ' +VTeam[i], $EE81FAA1)
end;
end;

//what happens when someone is killed
procedure OnPlayerKill(Killer, Victim: byte;Weapon: byte);
begin
if VTeam[Victim] = VTeam[Killer] then //if it was somehow a team kill
SetScore(Killer,GetPlayerStat(Killer, 'Kills') - 1) //take away the point the killer got
else
begin
VTeam[Victim] := VTeam[Killer]; //they are now fighting on the team of their killer
SetScore(NameToID(VTeam[Killer]),GetPlayerStat(NameToID(VTeam[Killer]), 'Kills') + 1); //the leader of the killer's team get's a bonus point
if Leader[Victim] = true then //if the victim was a leader
begin
Leader[Victim] := false; //the victim is now no longer a leader
for i := 1 to 12 do
begin
if VTeam[i] = +IDToName(Victim) then //everyone who was fighting for the victim
begin
VTeam[i] := +IDToName(i); //are now free
Leader[i] := true //and leaders again
end;
end;
end;
end;
//There are probably issues with semicolons between line 26 and here
Winner := true; //temporarily set end game variable
for i := 1 to 12 do
begin
if VTeam[i] != +IDToName(Killer) then //is there anyone not on the killer's team?
Winner := false; //if so, no one has won yet
end;
if Winner = true then //if there is a winner
begin
DrawText(0,2,'Team' + VTeam[Killer] + 'wins!',330,RGB(255,0,0),0.20,40,240);
TimeLeft := 0; //end the game (will this work?)
end;
end;
« Last Edit: May 15, 2010, 09:01:58 pm by Londonbrig0 »
I could have sworn I had something witty to put here...

Offline GSx_Major

  • Major
  • *
  • Posts: 97
Re: Idea for a server, is it feasible?
« Reply #1 on: December 12, 2009, 06:15:29 pm »
Everything other than a way to visually identify peoples team is possible.
...and headbutt the sucker through your banana suit!

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: Idea for a script, is it feasible?
« Reply #2 on: December 13, 2009, 05:08:29 am »
Sure it is, even easy. I dont have time to create this. Ask someone else =P

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #3 on: December 13, 2009, 01:09:16 pm »
I've got time to do it myself, I just wanted to know if it was possible before I dove in.

Any suggestions for the team identification thing?
I could have sworn I had something witty to put here...

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Idea for a script, is it feasible?
« Reply #4 on: December 13, 2009, 01:37:20 pm »
Soldat has only 4 teams(and spectator). It's possible but will suck ass.

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Idea for a script, is it feasible?
« Reply #5 on: December 15, 2009, 01:10:50 am »
Why don't you just use the teams to show which team they are on (wow, ingenious)

Start with Alpha and Bravo teams, if a Bravo kills an Alpha, that Alpha joins Bravo, and vice versa.
Win is when all are on one team.

Then you could either randomise teams so two teams are formed again, or store the teams in variable, and reset them on next map.

also you might want to consider mid game joiners, probably put them in spec until the next round starts, and then add them.

Those are my thoughts, definitely possible.
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline LORD KILLA

  • Camper
  • ***
  • Posts: 254
  • Happie
Re: Idea for a script, is it feasible?
« Reply #6 on: December 15, 2009, 11:21:20 am »
Soldat has only 4 teams(and spectator). It's possible but will suck ass.

Maybe custom teams?
OnDamage:
Code: [Select]
begin
  if player[shooter].team = player[victim].team then result := 0; // Or something like this
end;

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #7 on: December 15, 2009, 11:36:10 am »
Why don't you just use the teams to show which team they are on (wow, ingenious)

Yeah, I  could do that, but like I said, up to 12 people need the ability to be on their own team at the start of the game
I could have sworn I had something witty to put here...

Offline GSx_Major

  • Major
  • *
  • Posts: 97
Re: Idea for a script, is it feasible?
« Reply #8 on: December 15, 2009, 01:04:01 pm »
I already covered everything in the very first reply...
...and headbutt the sucker through your banana suit!

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #9 on: December 15, 2009, 03:52:57 pm »
I already covered everything in the very first reply...

Please accept my sincerest apologies that I don't consider your words the be all and end all of this question.
I could have sworn I had something witty to put here...

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Idea for a script, is it feasible?
« Reply #10 on: December 15, 2009, 09:14:20 pm »
Why don't you just use the teams to show which team they are on (wow, ingenious)

Yeah, I  could do that, but like I said, up to 12 people need the ability to be on their own team at the start of the game
And saving players teams and resetting them at the end of a round OR splitting teams up randomly doesn't solve this problem?

Or am I not understanding you...
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Idea for a script, is it feasible?
« Reply #11 on: December 16, 2009, 04:44:16 am »
You could have displayed which player was your leader, and how many people are on that same team, but without visual markings on players as to which team they are on, it'd be bloody hard to do it beyond 4-5 players with your original concept.
When life hands you High Fructose Corn Syrup, Citric Acid, Ascorbic Acid, Maltodextrin, Sodium Acid Pyrophosphate,
Magnesium Oxide, Calcium Fumarate, Yellow 5, Tocopherol and Less Than 2% Natural Flavour... make Lemonade!

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #12 on: December 16, 2009, 10:32:50 am »
Why don't you just use the teams to show which team they are on (wow, ingenious)

Yeah, I  could do that, but like I said, up to 12 people need the ability to be on their own team at the start of the game
And saving players teams and resetting them at the end of a round OR splitting teams up randomly doesn't solve this problem?

Or am I not understanding you...

I don't think using the built-in teams is the way to go, it would have to be a free-for-all. Is it possible to have the script make players display text above their heads as if they were saying something?

In lieu of a way to identify who is on your team, like spiltcoffee said, the script could just display to each player "you are on team (team leader name)" along with how many people are on their team, maybe list the names of the players on their team, how many are on other teams, and have it prevent the player from doing damage to their teammates like Lord Killa suggested.
« Last Edit: December 16, 2009, 10:35:43 am by Londonbrig0 »
I could have sworn I had something witty to put here...

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Idea for a script, is it feasible?
« Reply #13 on: December 16, 2009, 04:50:25 pm »
You could put the leader of alpha team on charlie, and bravo's leader on delta, then script it so the team can't kill their leader and away we go.

Now we have:

A way of seeing who is on what team, and who the leader of each team is.
And a way of having up to 32 people to be in two teams: alpha-charlie, bravo-delta

does that satisfy you?

it would have to be a free-for-all
Why?
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #14 on: December 16, 2009, 06:09:51 pm »
You could put the leader of alpha team on charlie, and bravo's leader on delta, then script it so the team can't kill their leader and away we go.

Now we have:

A way of seeing who is on what team, and who the leader of each team is.
And a way of having up to 32 people to be in two teams: alpha-charlie, bravo-delta

does that satisfy you?

it would have to be a free-for-all
Why?

Because up to 12 people (or whatever the max turns out to be) need to be on individual teams at the beginning. Assuming there are 12 people playing, at the beginning of the game there are 12 teams and 12 team leaders.
I could have sworn I had something witty to put here...

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Idea for a script, is it feasible?
« Reply #15 on: December 16, 2009, 11:30:41 pm »
Oh shoot, I see.

I was thinking every one started on one of two teams, which is how I have played it in the past.

:s
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #16 on: December 17, 2009, 12:01:15 am »
Sorry for not making it clear
I could have sworn I had something witty to put here...

Offline Neosano

  • Camper
  • ***
  • Posts: 253
  • IIAWAK!
Re: Idea for a script, is it feasible?
« Reply #17 on: December 17, 2009, 02:15:41 am »
http://www.enesce.com/help/index.html?Functions/WorldImage.html
or
http://www.enesce.com/help/html/Functions/WorldText.html

Display a text above heads. Use different colors. Be happy :]

How are you going to negate m79 shot btw?
KAWAAAAAAAIIIIIIIIII

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #18 on: December 17, 2009, 07:10:15 am »
http://www.enesce.com/help/index.html?Functions/WorldImage.html
or
http://www.enesce.com/help/html/Functions/WorldText.html

Display a text above heads. Use different colors. Be happy :]

I think I love you. Scripting will commence today! :D

Quote
How are you going to negate m79 shot btw?

Do I need to?
I could have sworn I had something witty to put here...

Offline Neosano

  • Camper
  • ***
  • Posts: 253
  • IIAWAK!
Re: Idea for a script, is it feasible?
« Reply #19 on: December 17, 2009, 09:16:47 am »
Yea, it will be possible to kill your teammates even if you set damage to 0. That's how these fucking m79 bullets work.
KAWAAAAAAAIIIIIIIIII

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Idea for a script, is it feasible?
« Reply #20 on: December 17, 2009, 09:54:41 am »
Yea, it will be possible to kill your teammates even if you set damage to 0. That's how these f**king m79 bullets work.
Bulls**t.

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #21 on: December 17, 2009, 12:06:23 pm »
Yea, it will be possible to kill your teammates even if you set damage to 0. That's how these f**king m79 bullets work.

Oh, I didn't know that. Do grenades and the Law do the same thing, or is just the m79? It wouldn't really be a problem, if someone gets killed by their teammate they would just respawn on the same team. I would just have to make sure that in the script a teamkill resulting in the death of the leader doesn't screw everything up.
I could have sworn I had something witty to put here...

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Idea for a script, is it feasible?
« Reply #22 on: December 17, 2009, 01:07:27 pm »
Yea, it will be possible to kill your teammates even if you set damage to 0. That's how these f**king m79 bullets work.

Oh, I didn't know that. Do grenades and the Law do the same thing, or is just the m79? It wouldn't really be a problem, if someone gets killed by their teammate they would just respawn on the same team. I would just have to make sure that in the script a teamkill resulting in the death of the leader doesn't screw everything up.
Yea, it will be possible to kill your teammates even if you set damage to 0. That's how these f**king m79 bullets work.
Bulls**t.

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #23 on: December 17, 2009, 01:27:58 pm »
Well so far I've got one person telling me it's true and another telling me it's false, looks like I'll have to find out myself.
I could have sworn I had something witty to put here...

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Idea for a script, is it feasible?
« Reply #24 on: December 18, 2009, 11:12:58 am »
When I'm sure it's false - it's false.

Offline Serial K!ller

  • Camper
  • ***
  • Posts: 408
    • Soldat Mods Archive
Re: Idea for a script, is it feasible?
« Reply #25 on: December 18, 2009, 11:35:37 am »
I tried it for my friendly-fire script and it is possible to kill players with law/m79 even when the damage is set to 0 in onplayerdamage(), but only on direct hits because it's hard coded in the server...

Same reason why the m79/law is always stays a 1-hit kill weapon when changing the damage value in weapons.ini even if it's negative damage.
« Last Edit: December 18, 2009, 02:51:27 pm by Serial K!ller »

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Idea for a script, is it feasible?
« Reply #26 on: December 18, 2009, 02:17:50 pm »
I set it to 0 and direct hits didn't kill.  :o

Offline Neosano

  • Camper
  • ***
  • Posts: 253
  • IIAWAK!
Re: Idea for a script, is it feasible?
« Reply #27 on: December 19, 2009, 06:15:08 am »
Gizd, Serial K!ller server versions??
KAWAAAAAAAIIIIIIIIII

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Idea for a script, is it feasible?
« Reply #28 on: December 19, 2009, 06:15:41 am »
2.6.5+

Offline Keldorn

  • Soldier
  • **
  • Posts: 177
Re: Idea for a script, is it feasible?
« Reply #29 on: December 19, 2009, 06:54:14 am »
Just a question about the game mode itself...

If victory can only be achieved by being the leader of the winning team...why would anyone actually play. I mean, if you get killed by someone, you join their team.
Now, unless either your team leader dies you can't win.
So every player who "joins" another team will just try to get their leader killed.
So pretty much the only way to win is if you kill everyone really quickly, while everyone on your "team" is trying to fuck you up.
That seems...I dunno...counter-intuitive?
Anyone play KOL?

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Idea for a script, is it feasible?
« Reply #30 on: December 19, 2009, 07:17:54 am »
Just a question about the game mode itself...

If victory can only be achieved by being the leader of the winning team...why would anyone actually play. I mean, if you get killed by someone, you join their team.
Now, unless either your team leader dies you can't win.
So every player who "joins" another team will just try to get their leader killed.
So pretty much the only way to win is if you kill everyone really quickly, while everyone on your "team" is trying to f**k you up.
That seems...I dunno...counter-intuitive?
I doubt that...

Offline Neosano

  • Camper
  • ***
  • Posts: 253
  • IIAWAK!
Re: Idea for a script, is it feasible?
« Reply #31 on: December 19, 2009, 11:49:58 am »
If the leader got killed - all his team is moving to another team or only the leader?
First one will solve this.
KAWAAAAAAAIIIIIIIIII

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #32 on: December 19, 2009, 12:44:27 pm »
If the leader got killed - all his team is moving to another team or only the leader?
First one will solve this.

If the leader gets killed, the leader is now a member of the team who killed him, and everyone who was on his team are now free, fighting for themselves and free to grow their own team.

Just a question about the game mode itself...

If victory can only be achieved by being the leader of the winning team...why would anyone actually play. I mean, if you get killed by someone, you join their team.
Now, unless either your team leader dies you can't win.
So every player who "joins" another team will just try to get their leader killed.
So pretty much the only way to win is if you kill everyone really quickly, while everyone on your "team" is trying to f**k you up.
That seems...I dunno...counter-intuitive?

In my experience playing this game in real life, there are always "agents of chaos" as we call them, who run around trying to prolong the game by targeting team leaders. But there's not really much you can to do kill your own leader while you're on their team, so people either decide to fight for whatever team they are on as best they can, or go off on their own and try to screw things up. Either way, the games are interesting.

In addition, I think the scoring system could help. There are possible scenarios where the leader of the winning team might not have the most points (although he does have a big advantage), so I could possibly make it so that whoever has the most points wins, even if it's not the leader of the winning team.

Meanwhile, I tried to do some testing with killing while damage is set to 0, and from the limited testing I did, I found that I couldn't kill my teammates, but I could kill myself if I directly hit myself with a law or m79.
I could have sworn I had something witty to put here...

Offline Neosano

  • Camper
  • ***
  • Posts: 253
  • IIAWAK!
Re: Idea for a script, is it feasible?
« Reply #33 on: December 20, 2009, 06:09:08 am »
was it DM btw?
KAWAAAAAAAIIIIIIIIII

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #34 on: December 20, 2009, 03:56:27 pm »
I could have sworn I had something witty to put here...

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Idea for a script, is it feasible?
« Reply #35 on: December 21, 2009, 08:46:29 am »
deathmatch

Offline ~Niko~

  • Rainbow Warrior
  • *****
  • Posts: 2410
Re: Idea for a script, is it feasible?
« Reply #36 on: December 21, 2009, 04:05:19 pm »
I gave it a try, if it works out ill tell you.

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #37 on: December 21, 2009, 11:47:04 pm »
In my testing I was in team match and unable to kill my teammate with the m79 or law
but in death match, with damage set to 0 I was able to kill myself with the m79 and law

in other news: I've got a draft of the script up, take a look at it
I could have sworn I had something witty to put here...

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #38 on: May 15, 2010, 08:00:13 pm »
After an extended hiatus due to hellacious college classes, I'm continuing to work on this project.

I've added to the script:
- now the script will know when a team wins, and there's a way for the game to end that might work, but I need to test it, or for someone to tell me if it will or won't.

However, I won't be able to test the script for a few days while I'm on the road, so there are some things I'm concerned about on which I would appreciate input:
- I'm having trouble figuring out the syntax for a few things. Namely, the giant if-then statement that begins on line 31, I'm pretty sure there are semicolon errors within the procedure.
- The DrawText function on line 59: I want it to say "Team" + (whoever won) + "wins!" I just guessed +'s might work, what should I actually use to combine those?

Any advice is much appreciated, thank you.

Code: (Pascal) [Select]
//SuperVillians Script v0.3
 //concocted and shoddily put together by Londonbrig0
 
 var
VTeam: array[1..12] of string; //VTeam is supposed to stand for "villian team"
Leader: array[1..12] of boolean; //and 12 is current max number of players
i: integer; //used for id of players
Winner: boolean; //variable used to end game when everyone is on the same team

//When someone joins, set their team to their own name, and make them a leader
procedure OnJoinGame(ID, Team: byte);
begin
VTeam[ID] := +IDToName(ID);
if VTeam[ID] = +IDToName(ID) then
Leader[ID] := true;
end;

//this is so I can check teams when I'm testing
//I'll probably leave this in to let players check the teams ingame if they want.
function OnCommand(ID: Byte; Text: string): boolean;
begin
if (Text = '/teams') then
for i := 1 to 12 do begin
WriteConsole(ID, +IDToName(i) +' is on team ' +VTeam[i], $EE81FAA1)
end;
end;

//what happens when someone is killed
procedure OnPlayerKill(Killer, Victim: byte;Weapon: byte);
begin
if VTeam[Victim] = VTeam[Killer] then //if it was somehow a team kill
SetScore(Killer,GetPlayerStat(Killer, 'Kills') - 1) //take away the point the killer got
else
begin
VTeam[Victim] := VTeam[Killer]; //they are now fighting on the team of their killer
SetScore(NameToID(VTeam[Killer]),GetPlayerStat(NameToID(VTeam[Killer]), 'Kills') + 1); //the leader of the killer's team get's a bonus point
if Leader[Victim] = true then //if the victim was a leader
begin
Leader[Victim] := false; //the victim is now no longer a leader
for i := 1 to 12 do
begin
if VTeam[i] = +IDToName(Victim) then //everyone who was fighting for the victim
begin
VTeam[i] := +IDToName(i); //are now free
Leader[i] := true //and leaders again
end;
end;
end;
end;
//There are probably issues with semicolons between line 26 and here
Winner := true; //temporarily set end game variable
for i := 1 to 12 do
begin
if VTeam[i] != +IDToName(Killer) then //is there anyone not on the killer's team?
Winner := false; //if so, no one has won yet
end;
if Winner = true then //if there is a winner
begin
DrawText(0,2,'Team' + VTeam[Killer] + 'wins!',330,RGB(255,0,0),0.20,40,240);
TimeLeft := 0; //end the game (will this work?)
end;
end;
« Last Edit: May 15, 2010, 08:58:42 pm by Londonbrig0 »
I could have sworn I had something witty to put here...

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Idea for a script, is it feasible?
« Reply #39 on: May 15, 2010, 08:58:51 pm »
[...]

Any advice is much appreciated, thank you.

[...]

Go "if Winner Then", instead of "if Winner = True". Same thing for "Leader[Victim] = True". Go "if Leader[Victim] Then"..

About the Script, I don't understand quite what you're asking.
www.soldatx.com.br - The brazilian Soldat community.

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #40 on: May 15, 2010, 09:09:52 pm »
Go "if Winner Then", instead of "if Winner = True". Same thing for "Leader[Victim] = True". Go "if Leader[Victim] Then"..

Ah yes, good advice, thank you.

Quote
About the Script, I don't understand quite what you're asking.

1. Basically, I'm not sure when I shouldn't have semicolons in the middle of if then else statements.
2. I want to know how to combine some text and a string variable into one string, for example the variable VTeam[Killer] and the text 'wins!'
3. Can I end the game by setting TimeLeft to 0?
« Last Edit: May 15, 2010, 09:14:10 pm by Londonbrig0 »
I could have sworn I had something witty to put here...

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Idea for a script, is it feasible?
« Reply #41 on: May 15, 2010, 09:30:47 pm »
[...]

1. Basically, I'm not sure when I shouldn't have semicolons in the middle of if then else statements.
2. I want to know how to combine some text and a string variable into one string, for example the variable VTeam[Killer] and the text 'wins!'
3. Can I end the game by setting TimeLeft to 0?

1 - You just don't use ";" after:

If,Else,Begin,Then,Try,Except,Const,Type,Var.

You DO use ";" after ")", and everything else.

//~~~

2 - You mean like..

Code: (pascal) [Select]

[...]

 if VTeam[Killer] = 'Blablabla' Then WriteConsole(Killer,'Wins!',$FFFFFF);

Like that? I still don't got it :P

//~~~

3 - To end the game, just go "Command('/nextmap'); :P
www.soldatx.com.br - The brazilian Soldat community.

DarkCrusade

  • Guest
Re: Idea for a script, is it feasible?
« Reply #42 on: May 16, 2010, 12:43:15 am »
Just go for

Code: (pascal) [Select]
const
  White = $FFFFFF;

Procedure OnPlayerSpeak(ID:Byte; Text:String);
var Disable:Boolean; 
  begin
    WriteConsole(ID,'Text1' + ' Text2', White);      // Will display the text "Text1 Text2"
    WriteConsole(ID,IDToName(ID) + '''s name is cool!', White); // Displays "<XXX>'s name is cool!" ('' = ' in text')
    if LowerCase(Text) = '!disable' then begin
      Disable := not Disable;
      WriteConsole(ID,'Script got ' + iif(Disable=true,'enabled','disabled') + '.', White);
    end;
  end;

Last text will display "Script got enabled." if Disable is true and "Script got disabled." when it's false.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Idea for a script, is it feasible?
« Reply #43 on: May 16, 2010, 09:11:37 am »
Just go for

[...]

You forgot a "+" in the "IDToName()" Stuff.

And, iif(Disable,'en','dis')+'abled' should be better.

Despite that, everything's good.
www.soldatx.com.br - The brazilian Soldat community.

DarkCrusade

  • Guest
Re: Idea for a script, is it feasible?
« Reply #44 on: May 16, 2010, 09:14:59 am »
The '+' is there for ages, Squiddy ... or I don't get what you are trying to state.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Idea for a script, is it feasible?
« Reply #45 on: May 16, 2010, 09:18:34 am »
Code: (pascal) [Select]
    WriteConsole(ID,IDToName(ID) +'''s name is cool!', White);

Should be:

WriteConsole(ID,IDToName(ID)+'''+'s name is cool!',White);

See?
www.soldatx.com.br - The brazilian Soldat community.

DarkCrusade

  • Guest
Re: Idea for a script, is it feasible?
« Reply #46 on: May 16, 2010, 09:32:12 am »
Yeah I see your mistake. You don't need to seperate it.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Idea for a script, is it feasible?
« Reply #47 on: May 16, 2010, 09:43:21 am »
Wow, just noticed what I did. :P

Thanks DC.

Although, I'm still curious.

Why do you have '''s name ...', instead of 's name ...' ?

:O
www.soldatx.com.br - The brazilian Soldat community.

Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Idea for a script, is it feasible?
« Reply #48 on: May 16, 2010, 09:57:34 am »
Wow, just noticed what I did. :P

Thanks DC.

Although, I'm still curious.

Why do you have '''s name ...', instead of 's name ...' ?

:O
http://en.wikipedia.org/wiki/Apostrophe#General_principles_for_the_possessive_apostrophe


and if you guys want to be really anal about the code,
Code: (pascal) [Select]
WriteConsole(ID,'Script got ' + iif(Disable,'dis','en') + 'abled.', White);and from the looks of it, disabled should be a global var ._.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Idea for a script, is it feasible?
« Reply #49 on: May 16, 2010, 10:00:30 am »
I agree.

Usually, all my scripts has a "TurnedON" Boolean.

I'm far too busy to make some other person's scritps perfect :P

Good luck with the script, though. :)
www.soldatx.com.br - The brazilian Soldat community.

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #50 on: May 16, 2010, 10:16:58 am »
Quote
1 - You just don't use ";" after:

If,Else,Begin,Then,Try,Except,Const,Type,Var.

You DO use ";" after ")", and everything else.

Makes sense to me, thanks.

Quote
3 - To end the game, just go "Command('/nextmap'); :P

Oh right, duh, thanks  :P

Just go for

[...]

Last text will display "Script got enabled." if Disable is true and "Script got disabled." when it's false.

Thanks a ton, now I know how it's supposed to look.
I could have sworn I had something witty to put here...

DarkCrusade

  • Guest
Re: Idea for a script, is it feasible?
« Reply #51 on: May 16, 2010, 12:14:55 pm »
-A way to tell who is on your team (have your clothes change to look the same as your leader? have people on your team emit flames?)

You can create an interface that shows you the people on your team. I attached something you can work with.


Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #52 on: May 16, 2010, 10:33:08 pm »
You can create an interface that shows you the people on your team. I attached something you can work with.

Thank you, could you explain what it does basically?
I could have sworn I had something witty to put here...

DarkCrusade

  • Guest
Re: Idea for a script, is it feasible?
« Reply #53 on: May 17, 2010, 02:25:51 am »
Basically it's an inferface that will show up for everyone on the server. Everything in the procedure AppOnIdle gets called every second. If we want to work with everyones ID on the server we use a for loop:

I is a variable of type byte that you need to declare before, just look at my script.
Code: (pascal) [Select]
for I := 1 to 32 do [...]
But the problem is, that there are probably not 32 slots in use and it'd return us an error when we try to draw a text for a player who is not even there. We check now whether he's online or not:

Code: (pascal) [Select]
for I := 1 to 32 do              // Start the loop
  if GetPlayerStat(I,'Active') = true then     // Check ID
    AllDraw(I)
                                // Draw the text

The following will be a little bit more diificult. You will have 12 players at the maximum on your server, right? So I called one string for every possible ID. Now I loop through all IDs again and check whether they are in the same 'team' as the of the ID we checked in AppOnIdle. If that's so the next string will contain his name and will be drawn. Don't think much about '+ #13 + #10', it's just a nice thing that'll place one line above another instead of having one big line.

But a very important thing at least:

Code: (pascal) [Select]
Type XXX = Record
  Team: Byte;
end;

var
  Player: Array[1..32] of XXX;

It is very similiar to classes in Java, I hope you get the point. You can put more variables you want to use into the type XXX and to use it use

Code: (pascal) [Select]
<ArrayName>[<ID>].<Variable>   // Note the dot!

Now what you need to do with the script I gave you.

-You need to save the original teams of each player in an array
-You need to save ones team in an array when being killed
-You need to modify my script so it'll show up the leader of the team, too
-You need to find a solution for changing the map after one team contains all IDs that are connected to the server at that moment.

Offline Londonbrig0

  • Major(1)
  • Posts: 38
  • despite my experience, I'm a noob, deal with it
Re: Idea for a script, is it feasible?
« Reply #54 on: May 18, 2010, 12:31:57 pm »
Thanks a ton, I'll see what I can do to work it in.
I could have sworn I had something witty to put here...