Skeeter
14th Jan 04, 1:08 AM
Its very confusing this scripting stuff so i need some help in the form of a guide.
What i want to do is have a mp game CO-OP game where 1 person is higgaran and other is vaygr and they have to fight the progenitor ships and when u beat the progenitors u both win the game.
Also perhaps i recreation of one of the levels as the first to capture and hold the sajjuk for 8 mins wins the game. I have a great map made for this ready for the gamerule.
But i dunno how to make one. Please help me through.
varis
14th Jan 04, 6:22 AM
Did you check out the Gamerules guide and example from Relic?
Your first proposition is not necessarily a gamerule, it's essentially smuggling in the 3rd race into MP (see the race thread in advanced forum, it can be done) and making the AI play the progens (done already by Deus Ex mod I hope).
The second one... yes that sounds like a gamerules thingy alright.
Skeeter
14th Jan 04, 5:13 PM
So how would i write a rule for the capture sajjuk and win if held for different times like instant or 3,6,8 mins.
Here is a edited resorcerule im trying to alter for my capture sajjuk gamerule mod. Which i am upto i think making the rules now.
-----
GameRulesName = "Capture the Sajjuk" --Resource race
Description = "Capture and hold Sajjuk to win game" --The first player to reach the specified Target Capture and hold sajjuk wins.\nWinner take all!
Directories =
{
Levels = "data:LevelData\\Multiplayer\\Sajjukcapture\\",
AI = "data:AI\\",
}
GameSetupOptions =
{
-- options specific to ResourceRace gametype
{
name = "targetSajjuk",
locName = "Sajjuk to capture",
tooltip = "Choose A Megalith to capture",
default = 0,
visible = 0,
choices =
{
"sajjuk", "sajjuk",
},
},
{
name = "targetmegalithcapturetime",
locName = "time to hold megalith to win",
tooltip = "how long need to hold megalith to win",
default = 0,
visible = 1,
choices =
{
"instant", "0",
"3 mins", "180",
"6 mins", "360",
"8 mins", "720",
},
},
}
dofilepath("data:scripts/scar/restrict.lua")
resourcesNeeded = 0
-- Parameter indices
--
RRPI_PlayerName = 0
RRPI_PlayerProgress = 1
RRPI_PlayerColour = 2
RRPN_Parameters = 3
-- rule entry point
function OnInit()
-- restrict options for tuning resons for each player
MPRestrict();
resourcesNeeded = GetGameSettingAsNumber("targetSajjuk")
-- add this rule
Rule_Add("MainRule")
--load ATI templates specific to these game rules
ATI_LoadTemplates("data:LevelData\\Multiplayer\\Sajjukcapture\\ATI.lua")
end
-- main rule to call for this game type
function MainRule()
local playerIndex = 0;
local playerCount = Universe_PlayerCount();
-- kill any dead players
while (playerIndex < playerCount) do
if (Player_IsAlive(playerIndex) == 1 and
Player_HasShipWithBuildQueue(playerIndex)==0) then
-- kill this player
Player_Kill(playerIndex)
end
-- go to next player
playerIndex = playerIndex+1
end
local gameOver = 0;
local victoriousPlayer = 0;
-- see if any player has reached the target resource amount. Note that if two players
-- reach the target in the same frame, the player who is integrally first will win.
playerIndex = 0
while (playerIndex < playerCount) do
if (Player_IsAlive(playerIndex) == 1) then
if (Player_GetRU(playerIndex) >= resourcesNeeded) then
gameOver = 1
victoriousPlayer = playerIndex
end
end
-- go to next player
playerIndex = playerIndex+1
end
-- if the game is over, kill all other players and end the game
if (gameOver == 1) then
playerIndex = 0;
while (playerIndex < playerCount) do
if (playerIndex ~= victoriousPlayer) then
Player_Kill(playerIndex)
end
playerIndex = playerIndex + 1
end
setGameOver()
Rule_Remove("MainRule")
end
--
-- display progress ATI template
--
--display title
ATI_Clear()
local TitleRect = {0.5, 0.51, 0.5, 0.1}
ATI_CreateParameters(1)
ATI_AddString(0, "$8010")
ATI_Display2D("progressTitle", TitleRect, 0)
--display progress bar for each player
playerIndex = 0
local ATIRect = {0.5, 0.5, 0.5, 0.02}
while (playerIndex < playerCount) do
--setup parameters
ATI_CreateParameters(RRPN_Parameters)
local playerName = Player_GetName(playerIndex)
ATI_AddWString(RRPI_PlayerName, playerName)
local progress = Player_GetRU(playerIndex) / resourcesNeeded
ATI_AddFloat(RRPI_PlayerProgress, progress)
local playerColour = {1.0, 1.0, 1.0, 1.0}
ATI_AddColour(RRPI_PlayerColour, playerColour)
--actual display
ATI_Display2D("playerProgress", ATIRect, 0)
-- go to next player
ATIRect[2] = ATIRect[2] - 0.025
playerIndex = playerIndex+1
end
end
-----
Would like guidence on what to edit and possoble a description of what u sugest editing.
Cheers.
vBulletin v3.0.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.