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

0 Members and 3 Guests 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