Author Topic: Team reset after score.  (Read 2379 times)

0 Members and 1 Guest are viewing this topic.

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Team reset after score.
« on: April 03, 2008, 01:30:14 pm »
So, I have problem to make:
When Team 1 (e.g Bravo) scores, All players moves to Bravo team. And random player will stay on Alpha?! Huh?! Anyone?  :-X
[saw]  on 1.5.1

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Team reset after score.
« Reply #1 on: April 03, 2008, 01:43:15 pm »
Well, this should do it. Only that instead of leaving someone on alpha, it moves all to bravo and then moves a random player back.
Code: [Select]
procedure OnFlagScore(ID, TeamFlag: Byte);
var i: Integer;
begin

// if its alpha flag
if TeamFlag = 1 then begin

// First, move all to bravo
for i := 1 to 32 do
Command('/setteam2 ' + inttostr(i));

// Then, repeat this loop until someone is on alpha
while AlphaPlayers < 1 do
Command('/setteam1 ' + inttostr(Random(1, 32)));
end;
end;

I haven't tested it, but it should work. Or at least give you an idea on how to do it.

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Team reset after score.
« Reply #2 on: April 03, 2008, 02:39:10 pm »
i suppose he's trying to avoid the colour bug. You could move all the players to spec first, store their IDs in an array and then move them to bravo in AppOnIdle

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Team reset after score.
« Reply #3 on: April 03, 2008, 02:44:29 pm »
I thought he wanted it :D

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Team reset after score.
« Reply #4 on: April 03, 2008, 03:02:46 pm »
i suppose he's trying to avoid the colour bug. You could move all the players to spec first, store their IDs in an array and then move them to bravo in AppOnIdle
Whats the color bug? Whenever I setteamed, unless it deals with setting a player to team 0, it seemed the players are the proper color..

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Team reset after score.
« Reply #5 on: April 03, 2008, 06:21:48 pm »
i suppose he's trying to avoid the colour bug. You could move all the players to spec first, store their IDs in an array and then move them to bravo in AppOnIdle
Whats the color bug? Whenever I setteamed, unless it deals with setting a player to team 0, it seemed the players are the proper color..

While you're at it, i am trying to let people keep their own color for a zombie script. I found out that a player HAS to (voluntarily) join spec first before they can be setteamed to 0 and keep their colors. Am i right, or is there another way?
And while *I* am at it :p, is there anyway to force a flag back to its place while a player has it in his hands?
Come join: EliteCTF
Listen to: My Music

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Team reset after score.
« Reply #6 on: April 03, 2008, 06:34:34 pm »
Flag, KillObject. I'm not sure about how the flags work, you might have to use GetObjectStat or something to find the flag?

Offline BombSki

  • Flagrunner
  • ****
  • Posts: 927
    • Climbing-soldiers.net
Re: Team reset after score.
« Reply #7 on: April 03, 2008, 07:01:48 pm »
search 'returnflag' in scripting releases forum

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Team reset after score.
« Reply #8 on: April 04, 2008, 07:06:42 am »
search 'returnflag' in scripting releases forum

Aaaah, thanks, bomb.
and thanks J-Factor :)
Come join: EliteCTF
Listen to: My Music

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Re: Team reset after score.
« Reply #9 on: April 04, 2008, 10:49:00 am »
Well, this should do it. Only that instead of leaving someone on alpha, it moves all to bravo and then moves a random player back.
Code: [Select]
procedure OnFlagScore(ID, TeamFlag: Byte);
var i: Integer;
begin

// if its alpha flag
if TeamFlag = 1 then begin

// First, move all to bravo
for i := 1 to 32 do
Command('/setteam2 ' + inttostr(i));

// Then, repeat this loop until someone is on alpha
while AlphaPlayers < 1 do
Command('/setteam1 ' + inttostr(Random(1, 32)));
end;
end;

I haven't tested it, but it should work. Or at least give you an idea on how to do it.

Doesn't work even this. :O
[saw]  on 1.5.1

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Team reset after score.
« Reply #10 on: April 04, 2008, 10:57:37 am »
What doesn't work? does it compile? does it put all players to bravo, but not one to alpha? Maybe wrong TeamFlag?
the code seems valid.
Come join: EliteCTF
Listen to: My Music

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Re: Team reset after score.
« Reply #11 on: April 04, 2008, 11:05:41 am »
It doesn't compile at all. Something more advanced:
1. If Alpha = 0 Players, then random player (1) will be joined Bravo.
2. if Bravo scores, All Players goes to Bravo team and then Random player (1) goes to Alpha team. Like at 1.
3. if All Bravo players killed and moved to Alpha then again move all players to Bravo and random player (1) goes to Alpha. And Maybe some Alpha gets 25 (flag) point bonus.
[saw]  on 1.5.1

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Team reset after score.
« Reply #12 on: April 04, 2008, 11:54:34 am »
One step at a time :p

What is the error message you get?
maybe see: http://forums.soldat.pl/index.php?topic=26011.0
Come join: EliteCTF
Listen to: My Music

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Re: Team reset after score.
« Reply #13 on: April 04, 2008, 12:10:15 pm »
So here's what i get with debug.
[saw]  on 1.5.1

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Team reset after score.
« Reply #14 on: April 04, 2008, 12:21:55 pm »
(2:1) syntax error
would have been enough.
this is a nice one, a syntax error in the first line of the script. I don't see anything wrong here in Boble's post, so i think you forgot a letter while copying the script. I bet it says 'rocedure' instead of 'procedure'.
Come join: EliteCTF
Listen to: My Music

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Re: Team reset after score.
« Reply #15 on: April 04, 2008, 01:02:03 pm »
Yeah Thanks i got it working now. But with bots it doesn't work Yeah?

So:
How to add score (for Alpha)?
If Bravo player killed move to Alpha?
« Last Edit: April 04, 2008, 03:54:04 pm by Mercury92 »
[saw]  on 1.5.1

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Team reset after score.
« Reply #16 on: April 04, 2008, 08:47:57 pm »
Bob for short, eh...


Not sure what you mean with "if bravo player killed move to alpha", but to change score, use
Code: [Select]
SetTeamScore(1, AlphaScore + 1)
(adds 1 to alphas score)

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Re: Team reset after score.
« Reply #17 on: April 05, 2008, 03:35:18 am »
I meant, if Bravo player was killed then move him to Alpha team.
Thanks for score!
[saw]  on 1.5.1

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Team reset after score.
« Reply #18 on: April 05, 2008, 10:42:34 am »
Code: [Select]
// This will run every time a player is killed
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin

  // if the victim is on team two, move to team one
  if GetPlayerStat(Victim, 'Team') = 2 then begin
    Command('/setteam1 ' + IntToStr(Victim));
  end;


  // this will also work (without begin/end, it just does the first line after)
  if GetPlayerStat(Victim, 'Team') = 2 then
    Command('/setteam1 ' + IntToStr(Victim));

end;

Offline Mercury92

  • Camper
  • ***
  • Posts: 284
Re: Team reset after score.
« Reply #19 on: April 05, 2008, 11:12:34 am »
Thanks Boblekonvolutt. With bots it wont work, yeah?
[saw]  on 1.5.1