Page 1 of 1

How do I add campaign pop up messages to conquest maps

Posted: Wed Jun 10, 2015 9:26 pm
by Lorul1
How do I add those pop up messages in the campaign maps that pause the game in my conquest map.
My conquest map is an edited version of the geonosis conquest map so it has no campaign lua content, so would I have to add anything from the campaign lua to get this to work ?

Re: How do I add campaign pop up messages to conquest maps

Posted: Thu Jun 11, 2015 4:30 am
by hunpeter12
What exactly are you trying to do? Are you adding one objective or more? What types? I think the best for you is to add this in the beginning of your LUA:

Code: Select all

ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveCTF")     
ScriptCB_DoFile("ObjectiveTDM")  
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("setup_teams")  
ScriptCB_DoFile("Ambush")
You can then define more objectives with popup texts. If you want to give only one popup text at the beginning, adding these is not necessary.

Re: How do I add campaign pop up messages to conquest maps

Posted: Thu Jun 11, 2015 3:01 pm
by Lorul1
I'm trying to add multiple pop ups through out the level , for example when I destroy something then I get a pop up is there something that I can put in a script like this :

Gametoast = OnFinishCapture(
function(post,holding)
if GetCommandPostTeam("cp11") == 1 then
SetProperty("cp11", "CaptureRegion", "xxx")
AllowAISpawn(DEF,false)
>>>enter what ever the pop up function is here<<<
end
end
)

Re: How do I add campaign pop up messages to conquest maps

Posted: Thu Jun 11, 2015 5:25 pm
by AnthonyBF2
popupText = "localization.message.you.want.to.appear"

That's the popup message ccode but I'm not sure how to code it, I think maybe you need {""}

Re: How do I add campaign pop up messages to conquest maps

Posted: Fri Jun 12, 2015 4:27 am
by hunpeter12
You don't need the curly brackets, but: Doesn't it have to be insde of an objective? Since the popupText variable is defined inside Objective.lua, which is called for in all types of mission LUA files, aren't you only able to include it in a code bit like this?

Code: Select all

Objective1 = ObjectiveConquest:New{teamATT = ATT, teamDEF = GAR, text = "level.cor1.objectives.Campaign.1",
        popupText = "level.cor1.objectives.Campaign.1_popup"}
I might be wrong, but this is how I see it.

Re: How do I add campaign pop up messages to conquest maps

Posted: Fri Jun 12, 2015 10:21 pm
by Lorul1
ok
so I have a miniature version of my lua here :
Hidden/Spoiler:
[code]
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("Ambush")

---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------

function ScriptPostLoad()
AddAIGoal(3, "Deathmatch", 100)
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"}
cp6 = CommandPost:New{name = "cp6"}
cp7 = CommandPost:New{name = "cp7"}
cp8 = CommandPost:New{name = "cp8"}
cp9 = CommandPost:New{name = "cp9"}
cp10 = CommandPost:New{name = "cp10"}
cp11 = CommandPost:New{name = "cp11"}

--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.geo1.objectives.conquest", multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
conquest:AddCommandPost(cp7)
conquest:AddCommandPost(cp8)
conquest:AddCommandPost(cp9)
conquest:AddCommandPost(cp10)
conquest:AddCommandPost(cp11)

conquest:Start()

ActivateRegion("Regirum")

Startinggame = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "sgame" then
MapAddEntityMarker("cp3", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)
MapAddEntityMarker("cp7", "hud_objective_icon_circle", 4.0, 1, "YELLOW", true)
SetProperty("CP2", "Team", 1)
AllowAISpawn(2,true)
AllowAISpawn(1,true)
end
end
)

SetUberMode(1);

AddDeathRegion("deathregion")
OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"TeleportNode4")
end,
"TeleportRegion4"
)
ActivateRegion("TeleportRegion4")

end
function ScriptInit()
StealArtistHeap(800*1024)
-- Designers, these two lines *MUST* be first.
SetPS2ModelMemory(3500000)
ReadDataFile("ingame.lvl")

-- REP Attacking (attacker is always #1)
local REP = 1
local CIS = 2
-- These variables do not change
local ATT = 1
local DEF = 2
AmbushTeam = 5
ATM = AmbushTeam

SetTeamAggressiveness(CIS, 0.4)
SetTeamAggressiveness(REP, 1.0)

SetMemoryPoolSize ("Combo",64) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",256) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",256) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",256) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",150) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",4086) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",64) -- should be ~1x #combo
SetMemoryPoolSize ("Music", 540)

ReadDataFile("dc:sound\\gzb.lvl;gzbcw")
ReadDataFile("sound\\geo.lvl;geo1cw")
ReadDataFile("SIDE\\rep.lvl",
--"rep_bldg_forwardcenter",
"rep_fly_assault_dome",
--"rep_fly_gunship",
"rep_fly_gunship_dome",
"rep_fly_jedifighter_dome",
"rep_fly_gunship_sc",
"rep_walk_oneman_atst")
ReadDataFile("SIDE\\cis.lvl",
"cis_fly_droidfighter_dome")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_fly_gunship",
"rep_fly_jedifighter",
"rep_inf_ep2_rifleman",
"rep_inf_ep2_rocketeer",
"rep_inf_ep2_engineer",
"rep_inf_ep2_sniper",
"rep_inf_ep3_marine",
"rep_inf_ep3_officer",
"rep_hover_barcspeeder",
"rep_walk_atte",
"rep_hover_fightertank",
"rep_fly_arc170fighter_sc",
"rep_inf_ep2_jettrooper")
ReadDataFile("dc:SIDE\\cis.lvl",
"cis_inf_marine",
"cis_inf_rifleman",
"cis_inf_officer",
"cis_inf_engineer",
"cis_inf_rocketeer",
"cis_inf_sniper",
"cis_fly_droidfighter_sc",
"cis_fly_tridroidfighter",
"cis_tread_hailfire",
"cis_hover_stap",
"cis_hover_aat",
"cis_walk_spider")
ReadDataFile("dc:SIDE\\geo.lvl",
"gen_inf_geonosian")
ReadDataFile("dc:SIDE\\all.lvl",
"all_inf_wookiee")
ReadDataFile("dc:SIDE\\jed.lvl",
"jed_master_01",
"jed_knight_03",
"jed_master_02")
ReadDataFile("dc:SIDE\\tur.lvl",
"tur_bldg_beam",
"tur_bldg_spa_cis_beam")

-- Level Stats

ClearWalkers()
SetMemoryPoolSize("EntityWalker", 8)
AddWalkerType(0, 3) -- 8 droidekas (special case: 0 leg pairs)
AddWalkerType(3, 3) -- 2 spider walkers with 2 leg pairs each
AddWalkerType(6, 0) -- 2 attes with 3 leg pairs each
local weaponcnt = 540
SetMemoryPoolSize("Aimer", 670)
SetMemoryPoolSize("AmmoCounter", weaponcnt)
SetMemoryPoolSize("BaseHint", 2000)
SetMemoryPoolSize("CommandWalker", 2)
SetMemoryPoolSize("EnergyBar", weaponcnt)
SetMemoryPoolSize("ParticleTransformer::ColorTransformer", 1810)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 25)
SetMemoryPoolSize("EntityHover", 30)
SetMemoryPoolSize("EntityLight", 5000)
SetMemoryPoolSize("EntitySoundStream", 1010)
SetMemoryPoolSize("EntitySoundStatic", 1032)
SetMemoryPoolSize("MountedTurret", 340)
SetMemoryPoolSize("Navigator", 550)
SetMemoryPoolSize("Obstacle", 1050)
SetMemoryPoolSize("PathFollower", 420)
SetMemoryPoolSize("EntityRemoteTerminal", 20)
SetMemoryPoolSize("PathNode", 170)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("LightFlash", 5000)
SetMemoryPoolSize("PowerupItem", 170)
SetMemoryPoolSize("FLEffectObject::OffsetMatrix", 754)
SetMemoryPoolSize("TentacleSimulator", 25)
SetMemoryPoolSize("UnitController", 800)
SetMemoryPoolSize("UnitAgent", 800)
SetMemoryPoolSize("EntityCloth", 72)
SetMemoryPoolSize("SoldierAnimation", 1880)
SetMemoryPoolSize("Weapon", weaponcnt)

SetSpawnDelay(10.0, 0.25)

SetupTeams{

rep = {
team = REP,
units = 270,
reinforcements = 4000,
soldier = { "rep_inf_ep2_rifleman",55, 65},
assault = { "rep_inf_ep2_rocketeer",18, 20},
engineer = { "rep_inf_ep2_engineer",14, 17},
sniper = { "rep_inf_ep2_sniper",12, 14},
officer = {"rep_inf_ep3_officer",14, 17},
special = { "rep_inf_ep2_jettrooper",14, 17},

},
cis = {
team = CIS,
units = 270,
reinforcements = 15000,
soldier = { "cis_inf_marine",60, 70},
assault = { "cis_inf_rocketeer",18, 20},
engineer = { "cis_inf_engineer",14, 17},
sniper = { "cis_inf_sniper",14, 17},
officer = {"cis_inf_officer",14, 17},
special = { "geo_inf_geonosian",14, 17},
},

atm = {
team = ATM,
units = 14,
reinforcements = -1,
soldier = { "cis_inf_marine", 14, 14},
}
}

SetTeamAsFriend(ATM, CIS)
SetTeamAsFriend(CIS, ATM)
SetTeamAsEnemy(ATM, REP)
SetTeamAsEnemy(REP, ATM)
SetTeamName(ATM, CIS)
ClearAIGoals(ATM)
AddAIGoal(ATM, "Deathmatch", 100)

-- Attacker Stats

--teamATT = ConquestTeam:New{team = ATT}
--teamATT:AddBleedThreshold(21, 0.75)
--teamATT:AddBleedThreshold(11, 2.25)
--teamATT:AddBleedThreshold(1, 3.0)
--teamATT:Init()
SetTeamAsEnemy(ATT,3)
SetTeamAsEnemy(3,ATT)

-- Defender Stats

--teamDEF = ConquestTeam:New{team = DEF}
--teamDEF:AddBleedThreshold(21, 0.75)
--teamDEF:AddBleedThreshold(11, 2.25)
--teamDEF:AddBleedThreshold(1, 3.0)
--teamDEF:Init()
SetTeamAsFriend(DEF,3)

-- Local Stats
--SetTeamName(4, "locals")
--AddUnitClass(4, "rep_inf_jedimale",1)
--AddUnitClass(4, "rep_inf_jedimaleb",1)
--AddUnitClass(4, "rep_inf_jedimaley",1)
--SetUnitCount(4, 3)
--SetTeamAsFriend(4, ATT)

ReadDataFile("dc:GZB\\geo1.lvl", "geo1_conquest")

SetDenseEnvironment("false")
SetMinFlyHeight(-65)
SetMaxFlyHeight(500)
SetMaxPlayerFlyHeight(500)

-- Birdies
--SetNumBirdTypes(1)
--SetBirdType(0.0,10.0,"dragon")
--SetBirdFlockMinHeight(90.0)

-- Sound

voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "cw_music")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")
OpenAudioStream("sound\\geo.lvl", "geo1cw")
OpenAudioStream("sound\\geo.lvl", "geo1cw")

SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(1, "repleaving")
SetOutOfBoundsVoiceOver(2, "cisleaving")

SetAmbientMusic(REP, 1.0, "rep_GEO_amb_start", 0,1)
SetAmbientMusic(REP, 0.8, "rep_GEO_amb_middle", 1,1)
SetAmbientMusic(REP, 0.2, "rep_GEO_amb_end", 2,1)
SetAmbientMusic(CIS, 1.0, "cis_GEO_amb_start", 0,1)
SetAmbientMusic(CIS, 0.8, "cis_GEO_amb_middle", 1,1)
SetAmbientMusic(CIS, 0.2, "cis_GEO_amb_end", 2,1)

SetVictoryMusic(REP, "rep_geo_amb_victory")
SetDefeatMusic (REP, "rep_geo_amb_defeat")
SetVictoryMusic(CIS, "cis_geo_amb_victory")
SetDefeatMusic (CIS, "cis_geo_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")


--ActivateBonus(CIS, "SNEAK_ATTACK")
--ActivateBonus(REP, "SNEAK_ATTACK")

SetAttackingTeam(ATT)

--Opening Satalite Shot
--Geo
--Mountain
AddCameraShot(0.996091, 0.085528, -0.022005, 0.001889, -6.942698, -59.197201, 26.136919)
--Wrecked Ship
AddCameraShot(0.458111, 0.005273, -0.888821, 0.010231, -258.579163, 54.619400, 464.929382)
AddCameraShot(0.967462, -0.055710, -0.246398, -0.014188, 154.949295, -0.867839, 52.107521)
AddCameraShot(0.973089, 0.106593, 0.203078, -0.022245, 76.515656, -59.560528, 166.133728)
--War Room
AddCameraShot(0.893717, -0.160314, 0.412427, 0.073980, -169.914307, 91.959846, -813.117493)
AddCameraShot(0.829243, -0.025994, 0.558010, 0.017492, -258.491821, 14.487140, -788.087891)
end

function MoveEntityToNode(entIn,pathIn,nodeIn)
if not entIn then
print("Warning!: Entity not specified for move")
return false
elseif not pathIn then
print("Warning!: Path not specified for Entity " .. entIn .. " move")
return false
end

local node
if nodeIn then
node = nodeIn
else
node = 0
end

local locDest = GetPathPoint(pathIn,node)
local charUnit = GetCharacterUnit(entIn)
if charUnit then
SetEntityMatrix(charUnit,locDest)
return true
end
return false
end
[/code]
my question now is where do I put my "Objective1 = ObjectiveConquest" thing as hunpeter12 was saying

you should probably notice the word "local" in this part of the lua, its there since I've been editing the geonosis map so will that change anything with the Objective1 = ObjectiveConquest thing ?

Code: Select all

    --  REP Attacking (attacker is always #1)
    local REP = 1
    local CIS = 2
    --  These variables do not change
    local ATT = 1
    local DEF = 2

Re: How do I add campaign pop up messages to conquest maps

Posted: Sat Jun 13, 2015 4:56 am
by hunpeter12
The objectives go in ScriptPostLoad, but there's a problem I think: The poup text will show up at the beginning of the objective, not when you complete it by destroying/conquering etc. From what you said I believe you want to have a normal conquest map with destroyable things that give you messages (so not real objectives that go after eachother like a campaign map). That's why I suggest you consider using 'ShowMessageText' for writing out what you want. I'm no good at LUA but that's all I can come up with now.

Re: How do I add campaign pop up messages to conquest maps

Posted: Sat Jun 13, 2015 10:46 pm
by Lorul1
Yeah I've been trying to get pop ups to apear after events.
I've been using the "ShowMessageText" for other things, so that's one of the reasons I wanted to use the campaign pop ups. Thanks for all the help so far everyone. I guess I need to know if there is a way I can add campaign objectives into my conquest lua or if I can turn my conquest map into a campaign map. Dose anyone know how to do either option ?

Re: How do I add campaign pop up messages to conquest maps

Posted: Sun Jun 14, 2015 6:54 am
by hunpeter12
I suggest you: 1) look into the stock campaigns to see how they're structured 2) See the campaign mission tutorial here on GT 3) use the Mission Scripter utility available here. If I remember well, it has an option to include the campaign script in a normal conquest lua. Good luck!

Re: How do I add campaign pop up messages to conquest maps

Posted: Fri Jun 19, 2015 10:52 pm
by [RDH]Zerted
Try out these functions:
ShowPopup(<localized message>)
AddMissionHint
AddMissionObjective(<team>, <color like red/orange/green>, <localized message>)

This is similar to what v1.3 uses for all of the FC prompts:

Code: Select all

	--called when the popup is OKed/confirmed/accepted
	Popup_Prompt.fnDone = function( value )
		--close the popup
		Popup_Prompt:fnActivate(nil)
		Popup_Prompt.fnDone = nil
				
		--TODO run your custom code here, if any
	end
	
	--activate the popup
	Popup_Prompt:fnActivate(1)
	
	--set the popup's text
	gPopup_fnSetTitleStr(Popup_Prompt, "Hey look Ma, a pop-up!")
Popup_Prompt was added by v1.3 so if you use that one your map will required v1.3. However you can use one of the other popups. The code will be similar but not exactly the same. List of popups:
Metagame_Popup_ApplyBonus
Metagame_Popup_GameWinner
Metagame_Popup_NoTarget
Metagame_Popup_PickWinner
Metagame_Popup_PlanetActivated
Popup_AB
Popup_Ask_Historical
Popup_Busy
Popup_DedicatedServer
Popup_Error
Popup_LoadSave
Popup_LoadSave2
Popup_LobbyOpts
Popup_Ok
Popup_Ok_Large
Popup_Tutorial
Popup_Vote
Popup_YesNo
Popup_YesNo_Gamespy
Popup_YesNo_Large

Re: How do I add campaign pop up messages to conquest maps

Posted: Sun Jun 21, 2015 3:08 am
by hunpeter12
Oh, that's new for me. When it comes to LUA Zerted's god. Thanks, this will be handy not only to the asker.

Re: How do I add campaign pop up messages to conquest maps

Posted: Sun Jun 21, 2015 7:47 pm
by [RDH]Zerted
It all depends on where you spend your time. Almost everyone on this site can make a better map than me, but I know the most about shell modding and Linux tools (grep) makes searching through every Lua line to find something (like the list of all popups) easy:
1) Search all Lua code for "popup".
2) Skim results and notice new popups are created with a line like: "Popup_Ok = NewPopup {"
3) Search all Lua code for "NewPopup"
4) Get a nice listing of all popup types that exist at some point within the game.
5) Reformat and post on GT while accidentally leaving out ifs_opt_pckeyboard_Popup_KeyPress (which probably doesn't work ingame anyway).