Honestly, the best thing you can do is create a Win Condition Pack. That way, you can use it on any map in multiplayer.
Create a Win Condition Pack as seen in my tutorials.
Then, download this and extract ONLY the data folder to your mod.
Find "local function WinCondition_Init()" in default.scar and put the code I posted on the previous page in that function.
Camera mod
19 Nov 2015, 18:59 PM
#21
Posts: 756 | Subs: 8
19 Nov 2015, 19:13 PM
#22
Posts: 67
Right this is what I have I managed to create the basic win condition pack in mod builder and followed you video when finished clicked build tried in game but nothing has changed.
import("ScarUtil.scar")
import("Fatalities/Fatalities.scar")
function WinCondition_GameOver(winningTeam, losingTeam)
-- Set the winning team (this will fire win/loss events for each player).
World_SetTeamWin(winningTeam)
local winningPlayers = Team_GetPlayers(winningTeam)
local losingPlayers = Team_GetPlayers(losingTeam)
Fatality_Execute(winningPlayers, losingPlayers)
end
function WinCondition_Check()
local results = {}
-- Check every player on each team for ownership of the "annihilation_condition" entity.
for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)
local team = Player_GetTeam(player)
results[team] = results[team] or { surrender_count = 0, annihilation_condition_count = 0 }
-- If any player on a team has surrendered, that team loses.
if (Player_IsSurrendered(player)) then
results[team].surrender_count = results[team].surrender_count + 1
end
-- If at least one player on a given team owns an "annihilation_condition" entity, then that team has not yet lost.
if (Player_IsAlive(player)) then
local entities = Player_GetEntities(player)
for entityCount = 1, EGroup_CountSpawned(entities) do
local entity = EGroup_GetSpawnedEntityAt(entities, entityCount)
if (Entity_IsOfType(entity, "annihilation_condition")) then
results[team].annihilation_condition_count = results[team].annihilation_condition_count + 1
break
end
end
end
end
-- Check if any team has lost.
for team,result in pairs(results) do
if (result.surrender_count > 0 or result.annihilation_condition_count == 0) then
Rule_RemoveAll()
local winningTeam = Team_GetEnemyTeam(team)
local losingTeam = team
WinCondition_GameOver(winningTeam, losingTeam)
end
end
local distmin = 5;
local distMax = 50;
Camera_SetTuningValue(TV_DistMin, distmin);
Camera_SetTuningValue(TV_DistMax, distmax);
Camera_SetZoomDist(distMax);
local function WinCondition_Init()
Rule_AddInterval(WinCondition_Check, 3)
end
Scar_AddInit(WinCondition_Init)
import("ScarUtil.scar")
import("Fatalities/Fatalities.scar")
function WinCondition_GameOver(winningTeam, losingTeam)
-- Set the winning team (this will fire win/loss events for each player).
World_SetTeamWin(winningTeam)
local winningPlayers = Team_GetPlayers(winningTeam)
local losingPlayers = Team_GetPlayers(losingTeam)
Fatality_Execute(winningPlayers, losingPlayers)
end
function WinCondition_Check()
local results = {}
-- Check every player on each team for ownership of the "annihilation_condition" entity.
for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)
local team = Player_GetTeam(player)
results[team] = results[team] or { surrender_count = 0, annihilation_condition_count = 0 }
-- If any player on a team has surrendered, that team loses.
if (Player_IsSurrendered(player)) then
results[team].surrender_count = results[team].surrender_count + 1
end
-- If at least one player on a given team owns an "annihilation_condition" entity, then that team has not yet lost.
if (Player_IsAlive(player)) then
local entities = Player_GetEntities(player)
for entityCount = 1, EGroup_CountSpawned(entities) do
local entity = EGroup_GetSpawnedEntityAt(entities, entityCount)
if (Entity_IsOfType(entity, "annihilation_condition")) then
results[team].annihilation_condition_count = results[team].annihilation_condition_count + 1
break
end
end
end
end
-- Check if any team has lost.
for team,result in pairs(results) do
if (result.surrender_count > 0 or result.annihilation_condition_count == 0) then
Rule_RemoveAll()
local winningTeam = Team_GetEnemyTeam(team)
local losingTeam = team
WinCondition_GameOver(winningTeam, losingTeam)
end
end
local distmin = 5;
local distMax = 50;
Camera_SetTuningValue(TV_DistMin, distmin);
Camera_SetTuningValue(TV_DistMax, distmax);
Camera_SetZoomDist(distMax);
local function WinCondition_Init()
Rule_AddInterval(WinCondition_Check, 3)
end
Scar_AddInit(WinCondition_Init)
19 Nov 2015, 19:29 PM
#23
Posts: 67
right I have got it now all sorted but the game only does victory point and I normaly play anih.
19 Nov 2015, 19:31 PM
#24
Posts: 67
thank you fur time and patience im a bit long in the tooth for all this programing lark my first pc was a zx spectrum lol !!!!.
thank you
thank you
19 Nov 2015, 19:49 PM
#25
Posts: 756 | Subs: 8
Did you specify a .win and .scar file or check "Requires VP Ticker" when creating the Win Condition Pack? If so, that would be why. If not, the data folder you should have extracted is for Annihilate.
Also, you have:
which should be:
Also, you have:
Code
local distmin = 5;
local distMax = 50;
Camera_SetTuningValue(TV_DistMin, distmin);
Camera_SetTuningValue(TV_DistMax, distmax);
Camera_SetZoomDist(distMax);
local function WinCondition_Init()
Rule_AddInterval(WinCondition_Check, 3)
end
which should be:
Code
local function WinCondition_Init()
local distmin = 5;
local distMax = 50;
Camera_SetTuningValue(TV_DistMin, distmin);
Camera_SetTuningValue(TV_DistMax, distmax);
Camera_SetZoomDist(distMax);
Rule_AddInterval(WinCondition_Check, 3)
end
19 Nov 2015, 22:02 PM
#26
Posts: 67
yeh its ok I realized what I did so I have both vp and anih thanks for all your help I can sleep properly now lol.
1 user is browsing this thread:
1 guest
Livestreams
24 | |||||
6 | |||||
4 |
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.655231.739+15
- 2.842223.791+5
- 3.940410.696+6
- 4.35459.857-1
- 5.599234.719+7
- 6.278108.720+29
- 7.307114.729+3
- 8.645.928+5
- 9.10629.785+7
- 10.527.881+18
Replay highlight
VS
- cblanco ★
- 보드카 중대
- VonManteuffel
- Heartless Jäger
Einhoven Country
Honor it
11
Download
1265