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
34 | |||||
178 | |||||
13 | |||||
2 | |||||
1 |
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.831222.789+37
- 2.34957.860+14
- 3.589215.733+4
- 4.1099614.642-1
- 5.280162.633+8
- 6.305114.728+1
- 7.916405.693-2
- 8.271108.715+22
- 9.721440.621+3
- 10.1041674.607-2
Replay highlight
VS
- cblanco ★
- 보드카 중대
- VonManteuffel
- Heartless Jäger
Einhoven Country
Honor it
9
Download
1231
Board Info
516 users are online:
516 guests
1 post in the last 24h
7 posts in the last week
39 posts in the last month
7 posts in the last week
39 posts in the last month
Registered members: 49061
Welcome our newest member, Rihedcfrd
Most online: 2043 users on 29 Oct 2023, 01:04 AM
Welcome our newest member, Rihedcfrd
Most online: 2043 users on 29 Oct 2023, 01:04 AM