How can I prevent SuddenDeath in BaseRace Beta2


(Mysery) #1

I am running a server and I want to know how I can make BaseRace Beta2 not stop on this map when noone is there or prevent sudden death, just leave it as a tie. I know that I would have to either create a new script or put in a modifed script, but know very little about scripting.

Can anyone post the how to do this with the correct script? Thanks a bunch.


(Ragnar_40k) #2

http://bani.anime.net/banimod/forums/viewtopic.php?p=52695#52695


(Mysery) #3

The original script portion that appears to control sudden death is the following. Do I replace all occurrences of “wm_setwinner 0” with “wm_setwinner -1”. It appears it did not work.
To enable the changed mapscripts you can zip them into a .pk3 or you use the b_mapscriptdirectory cvar from ETPro.

game_manager
{
spawn
{
wm_axis_respawntime 30
wm_allied_respawntime 30
wm_number_of_objectives 7
wm_set_round_timelimit 30

  wm_set_main_objective	1	0
  wm_set_main_objective	1	1

  wm_objective_status	1 1 0
  wm_objective_status 	1 0 0
  wm_objective_status	2 1 0
  wm_objective_status	2 0 0		
  wm_objective_status	3 1 0
  wm_objective_status 	4 0 0

  wm_setwinner	-1

  accum 1 set 0
  accum 2 set 0
  accum 3 set 0 //keeps track of who is winning in case time expires

}

trigger allies_win
{
wm_setwinner 1
wm_announce “^7Allied Team has PWNED the Axis and completed their base first!”

  wm_objective_status 2 1 1
  wm_objective_status 2 0 2

  wait 2000
  wm_endround

}

trigger checkgame_allies
{
accum 1 abort_if_not_equal 18
trigger self allies_win
}

trigger allies_score
{
accum 1 inc 1
accum 3 inc 1
trigger self checkgame_allies
trigger self findwinner
}

trigger axis_win
{
wm_setwinner 0
wm_announce “^7Axis Team has PWNED the Allies and completed their base first!”

  wm_objective_status 2 1 1
  wm_objective_status 2 0 2

  wait 2000
  wm_endround

}

trigger checkgame_axis
{
accum 2 abort_if_not_equal 18
trigger self axis_win
}

trigger axis_score
{
accum 2 inc 1
accum 3 inc -1
trigger self checkgame_axis
trigger self findwinner
}

trigger findwinner
{
wm_setwinner -1
accum 3 abort_if_equal 0
wm_setwinner 1
accum 3 abort_if_greater_than -1
wm_setwinner 0
}

trigger superspawn_axis
{
wm_axis_respawntime 22
wait 1000
wm_announce “^1the Axis Team respawns faster!” //announce
}

trigger superspawn_allied
{
wm_allied_respawntime 22
wait 1000
wm_announce “^4the Allied Team respawns faster!” //announce
}
}

What does resp. of the original reponse mean.

Alter the mapscripts. Basically this is to replace all occurrences of “wm_setwinner 0” resp. “wm_setwinner 1” with “wm_setwinner -1”.
To enable the changed mapscripts you can zip them into a .pk3 or you use the b_mapscriptdirectory cvar from ETPro.


(Ragnar_40k) #4

Oops, remove the “wm_endround” command. This is responsible for ending a round.
The “wm_setwinner” command only sets the winning team so can leave it unchanged.


(Mysery) #5

I can have either Axis or Allies win the round on a timelimit tie, but I do not know how to make it end in a tie without sudden death. Is there a way? To end it on the Axis winning I only change the first occurnace of wm_setwinner to 0 which is Axis.

game_manager
{
spawn
{
wm_axis_respawntime 30
wm_allied_respawntime 30
wm_number_of_objectives 7
wm_set_round_timelimit 30

wm_set_main_objective 1 0
wm_set_main_objective 1 1

wm_objective_status 1 1 0
wm_objective_status 1 0 0
wm_objective_status 2 1 0
wm_objective_status 2 0 0
wm_objective_status 3 1 0
wm_objective_status 4 0 0

wm_setwinner 0

I found in another map, 1944_Siegried, the comments of // Winner on expiration of round timer (0=Axis, 1=Allies, -1=no winner at expiration). So from this it looks like you can set a default winner, but I was hoping I could have it end in a tie with no sudden death.


(Ragnar_40k) #6

wm_setwinner sets the winning team (e.g. when the times runs out)
wm_endround ends the round immediately (and wm_setwinner indicates the winning team). When you remove all occurences (or comment it out with //) the timelimit will end the round.
wm_set_round_timelimit sets the default timelimit for the map.


(LowLife) #7

Add this to the game_manager section, it will end the game with a tie 10 seconds after time runs out, if noone has captured anything.

trigger timelimit_hit
{
wait 10000
wm_endround
}


(Mysery) #8

Add this to the game_manager section, it will end the game with a tie 10 seconds after time runs out, if noone has captured anything.

Quote:

trigger timelimit_hit
{
wait 10000
wm_endround
}

Thanks Lowlife, I will use the original script and add this piece of code to the game_manager section. I will let you know if it works. BTW, If are you the renown map maker Lowlife, we run a lot of your maps and very much enjoy them. Thanks again.


(Mysery) #9

trigger timelimit_hit
{
wait 10000
wm_endround
}

I must be doing something wrong as sudden death continues. In my test no one captured anything, so the wm_setwinner should be -1, and we still go into sudden death. What I would like is no sudden death, just end in a tie at the timelimit if it is a tie.


(LowLife) #10

Hmmm, maybe timelimit-hit doesnt get run if winner is set to -1 , try to comment out the wm_setwinner -1 in gamemanager.


(Ifurita) #11

It might just be that the game HAS to have a winner, in which case, your only other option is to select one side or the other to be the default winner when the timelimit expires


(nUllSkillZ) #12

You have to set “wm_setwinner 1” or “wm_setwinner 0” in the game_manager-spawn scriptblock.
And “wm_setwinner -1” in the game_manger-timelimit_hit-scriptblock.
Somewhere here in the forums is a thread about this.


(Loffy) #13

Hi Mysery!
Is this what you want?:
a) The first team to complete all 18 constructions / upgrades or have the most completed when the timer runs out wins! (Just like it is today.)
b) If the score is tied (both teams have complete the same number of constructions / upgrades (e.g. 5-5, 8-8…), the game will end as a draw at full time.
c) If the score is 0-0 (no constructions / upgrades), the game will end as a draw at full time.

//Loffy


(Chruker) #14

Somewhere here in the forums is a thread about this.

Here: http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&p=66226#66226


(Mysery) #15

Loffy your are absolutely correct in what I am looking for:

a) The first team to complete all 18 constructions / upgrades or have the most completed when the timer runs out wins! (Just like it is today.)
b) If the score is tied (both teams have complete the same number of constructions / upgrades (e.g. 5-5, 8-8…), the game will end as a draw at full time.
c) If the score is 0-0 (no constructions / upgrades), the game will end as a draw at full time.

If I understand all what I have read I will need to do the following (changes in bold):
Set a default winner in game-manager-spawn

game_manager
{
spawn
{
wm_axis_respawntime 30
wm_allied_respawntime 30
wm_number_of_objectives 7
wm_set_round_timelimit 30

wm_set_main_objective 1 0
wm_set_main_objective 1 1

wm_objective_status 1 1 0
wm_objective_status 1 0 0
wm_objective_status 2 1 0
wm_objective_status 2 0 0
wm_objective_status 3 1 0
wm_objective_status 4 0 0

//sets a default winner
wm_setwinner 0

accum 1 set 0
accum 2 set 0
accum 3 set 0 //keeps track of who is winning in case time expires

And to set as a time if time runs out (no winner) I would need to have a game-manager-timelimit_hit script-block like the following:

trigger timelimit_hit
{
//no winner -tie
wm_setwinner -1

wait 10000
wm_endround
}

I will test this, but can someone confirm this is what I am to do.


(nUllSkillZ) #16

Looks good.
For testing purposes you could set


wm_set_round_timelimit 30

to a smaller number like 3.


(Loffy) #17

“Loffy your are absolutely correct in what I am looking for:�
The first map that made this possible to my knowledge was 1337-mapper Loffy’s epic “loffys_ctf_prefab2�. You can download the pk3 here and it contains the script AND .map file (that’s why it is called “prefab�):
http://www.acc.umu.se/~loffy/mapping/maps/loffysctfprefab/loffysctfprefab.htm

The game starts with the score 0-0. If the score is 0-0 (or 1-1. 2-2. and so on) when the timelimit is hit, the game ends with a draw.

This is how I did it:
The game starts with setwinner 1 (or 0). Why? Well, it is just so. For some odd reason, someone must be set as a winner at game start.
Whenever a team scores, the scripts checks to see if that team has enough scores to be victorious. In my CTF-style maps (Darji2, loffy’s ctf prefab2 and Mayhem) I use the number 7. There are 7 flags/items all in all to steal.
In Baserace beta 2, “the first team to complete all 18 constructions / upgrades or have the most completed when the timer runs out wins!” (from the maps’ Read Me file).

In my map loffys_ctf-prefab2, when a team captures (scores), the script checks to see if score = 7. If yes, then setwinner 1 (again) or setwinner 0, depending on what team it is.
Then there’s a wait command (The wait is 1,5 seconds). This is important. Then the command “end round” follows. (For baserace beta2 it would be 18 instead of 7.)
So far, no problems. But there is more.
Then there is a section in my script that gets automatically triggered (by the game engine) at full time. It is the timelimit hit part discussed above. When the timelimit is hit, the winner is set to -1 (wm_setwinner -1). But there is more, since this “timelimit hit” part also triggers another part of the script.
Let’s name this part Part B. It has one task: It checks to see if any of the two teams are in the lead. For example, Axis might lead 4-3 when the timelimit is hit. Part B of the script will terminate the game right away, if a team is in the lead. And that team is declared the winner. Speed is of the essence in Part B. Remember the 1,5 sec. wait above? That wait is there just to give time enough for Part B to “see” if either team deserves to win.
I’m sorry I do not have the time to make a test-script for you, for Baserace_beta2. But I suggest that the person/-s who will do it will examine the script I wrote for loffys_ctf_prefab2, with the aid of many helping mappers here at the SD forum – the best forum.
//Loffy


(Mysery) #18

trigger kolla1
{
globalaccum 3 abort_if_less_than 10 // If less than 10 = allies are in the lead.
globalaccum 3 abort_if_equal 10 // If 10 = the game is a draw.
wm_setwinner 0 // 0 = axis
wm_endround
}

trigger kolla2
{
globalaccum 3 abort_if_greater_than 10
globalaccum 3 abort_if_equal 10 // If 10 = the game is a draw.
wm_setwinner 1 // 1 = allies
wm_endround
}

trigger timelimit_hit // This script is run, when the game-clock reaches 0.00 and the match-time is over.
{
wm_setwinner -1
trigger game_manager kolla1
trigger game_manager kolla2
wait 250 // These wait-values may have to change, to fit your map. If your script doesn’t work: Try changing some of the wait-values.
wm_setwinner -1 // This makes it a draw game, and it will end as a draw game UNLESS kolla1 or kolla2 makes it an axis or allied victory.
globalaccum 3 abort_if_not_equal 10
alertentity drawgame // A speaker.
wait 100
}

Above appears to be the critical are of the script that will help check for a tie at timelimit_hit. What I am concerned about is the variables globalaccum 3 and the number 10. How does this translate to BaseRace_beta2?


(Mysery) #19

Ok I am getting close. I examined, with my limited knowledge, Loffy’s script and put parts of it in, change the approprates 1 and -1 because it is opposite in the BaseRace_beta2 script.

I put in the accum 4 part, but I really don’t see this being used anywhere.
accum 4 set 0 // 0 = score is 0-0. All other values = score is not 0-0 anymore.

I remarked out the findwinner and any reference to “findwinner” and replaced it with the kolla1, kolla2, and timelimit_hit pieces.

//trigger findwinner
//{
//wm_setwinner -1
//accum 3 abort_if_equal 0
//wm_setwinner 1
//accum 3 abort_if_greater_than -1
//wm_setwinner 0
//}

trigger allies_score
{
accum 1 inc 1 //Allies Score
accum 3 inc 1 //lead check
accum 4 inc 1 //0-0 Check Variable
trigger self checkgame_allies
//trigger self findwinner
}

trigger kolla1
{
accum 3 abort_if_less_than 0 // If less than 0 = axis are in the lead.
accum 3 abort_if_equal 0 // If 0 = the game is a draw.
wm_setwinner 1 // 1 = allies
wm_endround
}

trigger kolla2
{
accum 3 abort_if_greater_than 0 //If greater than 0 = allies are in the lead
accum 3 abort_if_equal 0 // If 0 = the game is a draw.
wm_setwinner 0 // 0 = axis
wm_endround
}

trigger timelimit_hit // This script is run, when the game-clock reaches 0.00 and the match-time is over.
{
wm_setwinner -1
trigger game_manager kolla1
trigger game_manager kolla2
wait 250 // These wait-values may have to change, to fit your map. If your script doesn’t work: Try changing some of the wait-values.
wm_setwinner -1 // This makes it a draw game, and it will end as a draw game UNLESS kolla1 or kolla2 makes it an axis or allied victory.
accum 3 abort_if_not_equal 0
wait 1000
//alertentity drawgame // A speaker.
wait 1000

And it worked except it got hung up. I tried a number of things, but finally I took out
//alertentity drawgame // A speaker. and it seems to work. Will do more testing, but I am very close. It would be nice to have a voice or title screen at then end say draw or tie or something like this.


(Loffy) #20

Yes, I agree. If not, the game will just stop and there will be a end-screen. I would use the “End draw!” sound file from loffys_ctf_prefab2. Filename “lcp_drawgame.wav”. Then put the speaker where the end-camera is (the camera that is active when game ends in a draw). It makes the fact that it is a dra game more obvious to the players (who are sometimes… slow). (mappers’ opinions about the cognitive ability of the average players is a whole chapter in the book on mapping).
Btw, “kolla” is the Swedish word for “check”.
To conclude: I’ve written to the original author if baserace with a link to this thread.
//L