A bunch of questions.

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

A bunch of questions.

Post by thelegend »

During the past weeks I have been working on many things. I first wanted to get them working properly then starting to continue something else. Anyway during the past weeks I collected a lot of questions and bugs I had during this time and wanted to start asking them all at once. Some are actually simple to answer (I guess) and some others..are quite time-consuming. I hope you can help me with these. I would be very grateful if you could help me.


1. [Solved] Loosing reinforcements when a certain object gets destructed. I already know about OnObject and AddReinforcementsCount but never got them working for minus-numbers. I was only able to add them but removing some...Is that even possible? Let's say I have 500 people remaining and want to remove 100. Is that possible?


2. I think it's because of the game itself. But it's pobably worth asking. In my map I have 11 turret chairs. When I play as General Grievous (Or any other melee wielding character) his sabers don't cause any damage. Now to the strange part. When I remove this line: SetMemoryPoolSize("EntityRemoteTerminal",11)
Melee wield characters will do damage again like before I added remote able turrets. I also added this above my ReadDataFile part:

Code: Select all

	SetMemoryPoolSize ("ClothData",20)
    SetMemoryPoolSize ("Combo",50)              -- should be ~ 2x number of jedi classes
    SetMemoryPoolSize ("Combo::State",650)      -- should be ~12x #Combo
    SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Condition",650)  -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Attack",550)     -- should be ~8-12x #Combo
    SetMemoryPoolSize ("Combo::DamageSample",6000)  -- should be ~8-12x #Combo::Attack
    SetMemoryPoolSize ("Combo::Deflect",100)     -- should be ~1x #combo
But there was no change either.


3. SetSpawnDelay(10.0, 0.25) What do the numbers mean/do?


4. How do I make a function when a certain number/amount of points have been reached per team? Let's say if team 1 gets 180 points then it should lead to an instant victory? Somehow, for me, it is not working properly and I think it can be fixed if there's someking of a "check for certain number of team points" script or function.


5. How can I remove this white box in the upper right corner?
Hidden/Spoiler:
Image
I am loading the ObjectiveSpaceAssault.lua script in order to get some new stuff working but I do not have any critical systems there. How can I remove the two supposed textures?

Thank you very much for helping me. I really appreciate this.
Last edited by thelegend on Mon Jun 27, 2016 4:29 pm, edited 2 times in total.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1254
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: A bunch of questions.

Post by AnthonyBF2 »

If your reinforcements are 500, Use SetReinforcementCount(1, 400)

1 or 2 for the team, using ATT/DEF or REP/CIS should also work.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: A bunch of questions.

Post by Anakin »

5. your white texture seams to be the the two capital ships. try to load the texture in a custom lvl but completely transparency. it looks like the engine wanna show this texture, but didn't load it. Or find the part in the script that loads this texture and remove it
User avatar
AnthonyBF2
Sith
Sith
Posts: 1254
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: A bunch of questions.

Post by AnthonyBF2 »

Anakin wrote:5. your white texture seams to be the the two capital ships. try to load the texture in a custom lvl but completely transparency. it looks like the engine wanna show this texture, but didn't load it. Or find the part in the script that loads this texture and remove it
It could also be a HUD item.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: A bunch of questions.

Post by Anakin »

in that case the hud needs to be activated. there needs to be an event or something and it need to be triggered somewhere in the lua script. otherwise it would be always there. and the transparency texture would work in any case
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: A bunch of questions.

Post by thelegend »

Thanks for the answers. I guess Anakin was right about the texture not being loaded (In case there would be two actually). I'd need to figure out how to let the script search for these textures so I may can make them transparent.
AnthonyBF2 wrote:If your reinforcements are 500, Use SetReinforcementCount(1, 400)

1 or 2 for the team, using ATT/DEF or REP/CIS should also work.
Thanks but...excuse me if I was not clear enough in the first post...but I believe this won't work for dynamic changing reinforcement counts? The number 500 was just an example. It could be any number ranging from 800-0.
Let's say I have 198 people still in my team and something/some kind of an event happens/triggers my current in-reinforcements would decrease by 100 so there would be 98 people left.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1254
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: A bunch of questions.

Post by AnthonyBF2 »

thelegend wrote:Thanks for the answers. I guess Anakin was right about the texture not being loaded (In case there would be two actually). I'd need to figure out how to let the script search for these textures so I may can make them transparent.
AnthonyBF2 wrote:If your reinforcements are 500, Use SetReinforcementCount(1, 400)

1 or 2 for the team, using ATT/DEF or REP/CIS should also work.
Thanks but...excuse me if I was not clear enough in the first post...but I believe this won't work for dynamic changing reinforcement counts? The number 500 was just an example. It could be any number ranging from 800-0.
Let's say I have 198 people still in my team and something/some kind of an event happens/triggers my current in-reinforcements would decrease by 100 so there would be 98 people left.
SetReinforcementCount changes the current number to whatever you want it to be at any time. If you have 198 and want 98, use that function and the value of 98.
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: A bunch of questions.

Post by thelegend »

But wouldn't SetReinforcementCount set my current reinforcements to a static number? What If I had less than..198 people in my team? The -100 wouldn't work very well. And I do not want to set the reinforcements to something...I would like to reduce them down (Or decrease them). Like AddReinforcementCount just with negative values. These never worked for me and probably do not seem to work (or do they?).
User avatar
AnthonyBF2
Sith
Sith
Posts: 1254
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: A bunch of questions.

Post by AnthonyBF2 »

thelegend wrote:But wouldn't SetReinforcementCount set my current reinforcements to a static number? What If I had less than..198 people in my team? The -100 wouldn't work very well. And I do not want to set the reinforcements to something...I would like to reduce them down (Or decrease them). Like AddReinforcementCount just with negative values. These never worked for me and probably do not seem to work (or do they?).
I just tested AddReinforcements live in code console. I used AddReinforcements(1, -100) as Empire in Mos Eisley, the number dropped from 150 to 50.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: A bunch of questions.

Post by Anakin »

thelegend wrote:Thanks for the answers. I guess Anakin was right about the texture not being loaded (In case there would be two actually). I'd need to figure out how to let the script search for these textures so I may can make them transparent.

just search in the stock assets for the proper texture, copy it to the project, make it invisible (you can simply scale it, too) and add it to the proper file (ingame, common, world,....). But you need to take the original name.
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: A bunch of questions.

Post by AQT »

If I understand correctly what you want to do with the reinforcements:

Code: Select all

if GetReinforcementCount(ATT) > 100 then
	SetReinforcementCount(ATT, GetReinforcementCount(ATT) - 100)
end
Only works if the current attacking team's reinforcement is greater than 100: Takes the attacking team's reinforcement count, subtracts 100 from whatever it is currently, and sets the difference as the new reinforcement count. You obviously want to nest this in your OnObject function.
thelegend wrote:4. How do I make a function when a certain number/amount of points have been reached per team? Let's say if team 1 gets 180 points then it should lead to an instant victory? Somehow, for me, it is not working properly and I think it can be fixed if there's someking of a "check for certain number of team points" script or function.

Code: Select all

if GetTeamPoints(ATT) >= 180 then
	MissionVictory(ATT)
end
You will want to nest this in all your functions that check for the different ways the attacking team can gain points.

You can find all the SWBF2 lua functions in these topics:
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: A bunch of questions.

Post by thelegend »

AddReinforcements(ATT, -100) works very fine. Thanks Anthony.

@AQT: Somehow this* doesn't work for my custom mode. The mode is actually Space Assault just without the Assault objectives (critical systems, shields and frigates stuff). But whenever I (or my team) or the enemies reach 180 points (Maximum score) nothing happens. Even when I use your lines.

*if GetTeamPoints(ATT) >= 180 then
MissionVictory(ATT)
end


Here's my .lua (Upper parts only).
Hidden/Spoiler:
[code]
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
-- BF3: Coruscant - Fighter Squadron

-- load the gametype script
ScriptCB_DoFile("Objective")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("ObjectiveSpaceAssault")
ScriptCB_DoFile("LinkedDestroyables")
ScriptCB_DoFile("setup_teams")

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



function ScriptPostLoad()
DisableSmallMapMiniMap()
SetupDestroyables()
SetupObjectives()

--AllowAISpawn(1, false) --Both commands are for debug purposes
--AllowAISpawn(2, false)

if not ScriptCB_InMultiplayer() then --No new commands for MP
--The following code makes it possible to reduce the texture resolutions of most of the world textures (Code by anthonybf2):
---
---
SupportsCustomFCCommands = true

local moreCommands = nil
if AddFCCommands ~= nil then
moreCommands = AddFCCommands
end

AddFCCommands = function()

ff_AddCommand(
"Reduce Texture Resolutions", -- name of the new fake console button
"This function will load smaller texture resolutions to make the map run more smooth. Note: Once activated the original resolutions can no longer be loaded again UNLESS you restart the map", -- description
function()
ReadDataFile("dc:SIDE\\low_textures.lvl", "low_textures")

return moreCommands()

end
)
end
---
---
end

SetAIDifficulty(10 , 10 )


AddAIGoal(ATT, "Deathmatch", 1000)
AddAIGoal(DEF, "Deathmatch", 1000)
SetMapNorthAngle(180, 1)
SetUberMode(1);



SetProperty("rep_frigate_space", "MaxHealth", "1e+37")
SetProperty("rep_frigate_space", "CurHealth", "1e+37")
SetProperty("cis_frigate_space", "MaxHealth", "1e+37")
SetProperty("cis_frigate_space", "CurHealth", "1e+37")

SetProperty("rep_frigate_space_an", "MaxHealth", "1e+37")
SetProperty("rep_frigate_space_an", "CurHealth", "1e+37")
SetProperty("cis_frigate_space_an", "MaxHealth", "1e+37")
SetProperty("cis_frigate_space_an", "CurHealth", "1e+37")


SetProperty("rep_frigate_space_1", "MaxHealth", "1e+37")
SetProperty("rep_frigate_space_1", "CurHealth", "1e+37")
SetProperty("rep_frigate_space_2", "MaxHealth", "1e+37")
SetProperty("rep_frigate_space_2", "CurHealth", "1e+37")
SetProperty("rep_frigate_space_3", "MaxHealth", "1e+37")
SetProperty("rep_frigate_space_3", "CurHealth", "1e+37")

SetProperty("cis_frigate_space_1", "MaxHealth", "1e+37")
SetProperty("cis_frigate_space_1", "CurHealth", "1e+37")
SetProperty("cis_frigate_space_2", "MaxHealth", "1e+37")
SetProperty("cis_frigate_space_2", "CurHealth", "1e+37")
SetProperty("cis_frigate_space_3", "MaxHealth", "1e+37")
SetProperty("cis_frigate_space_3", "CurHealth", "1e+37")


SetProperty("rep_frigate_space", "HideHealthBar", "1")
SetProperty("rep_frigate_space_an", "HideHealthBar", "1")
SetProperty("rep_frigate_space_1", "HideHealthBar", "1")
SetProperty("rep_frigate_space_2", "HideHealthBar", "1")
SetProperty("rep_frigate_space_3", "HideHealthBar", "1")

SetProperty("cis_frigate_space", "HideHealthBar", "1")
SetProperty("cis_frigate_space_an", "HideHealthBar", "1")
SetProperty("cis_frigate_space_1", "HideHealthBar", "1")
SetProperty("cis_frigate_space_2", "HideHealthBar", "1")
SetProperty("cis_frigate_space_3", "HideHealthBar", "1")


-----------------------------------------------------------------------------
----------------------OBJECTIVES STUFF---------------------------------------
-----------------------------------------------------------------------------





objectives = math.random(1,4) --There are four possible waiting periods. From a very short one to a one which takes three times as the very short one.
if objectives == 1 then
objectives = CreateTimer("objectives") --Set timer for objectives countdown
SetTimerValue(objectives, (60.0)) --One minutes
elseif objectives == 2 then
objectives = CreateTimer("objectives") --Set timer for objectives countdown
SetTimerValue(objectives, (85.0)) --85 seconds
elseif objectives == 3 then
objectives = CreateTimer("objectives") --Set timer for objectives countdown
SetTimerValue(objectives, (130.0)) --Two minutes+10 seconds
elseif objectives == 4 then
objectives = CreateTimer("objectives") --Set timer for objectives countdown
SetTimerValue(objectives, (180.0)) --Three minutes
end

if GetTeamPoints(ATT) >= 180 then
MissionVictory(ATT)
end

if GetTeamPoints(DEF) >= 180 then
MissionVictory(DEF)
end

StartTimer(objectives)
OnTimerElapse(
function(timer)

ShowMessageText("level.co3.space.frigates.rep.a", ATT)
ShowMessageText("level.co3.space.frigates.cis.a", DEF)

MapAddEntityMarker("rep_frigate_space_1", "hud_objective_icon_circle", 6.0, DEF, "RED", true, true, true)
MapAddEntityMarker("rep_frigate_space_2", "hud_objective_icon_circle", 6.0, DEF, "RED", true, true, true)
MapAddEntityMarker("rep_frigate_space_3", "hud_objective_icon_circle", 6.0, DEF, "RED", true, true, true)

MapAddEntityMarker("cis_frigate_space_1", "hud_objective_icon_circle", 6.0, ATT, "RED", true, true, true)
MapAddEntityMarker("cis_frigate_space_2", "hud_objective_icon_circle", 6.0, ATT, "RED", true, true, true)
MapAddEntityMarker("cis_frigate_space_3", "hud_objective_icon_circle", 6.0, ATT, "RED", true, true, true)

SetProperty("rep_frigate_space_1", "CurShield", "50000")
SetProperty("rep_frigate_space_1", "MaxShield", "50000")
SetProperty("rep_frigate_space_1", "MaxHealth", "100000")
SetProperty("rep_frigate_space_1", "CurHealth", "100000")
SetProperty("rep_frigate_space_2", "CurShield", "50000")
SetProperty("rep_frigate_space_2", "MaxShield", "50000")
SetProperty("rep_frigate_space_2", "MaxHealth", "100000")
SetProperty("rep_frigate_space_2", "CurHealth", "100000")
SetProperty("rep_frigate_space_3", "CurShield", "50000")
SetProperty("rep_frigate_space_3", "MaxShield", "50000")
SetProperty("rep_frigate_space_3", "MaxHealth", "100000")
SetProperty("rep_frigate_space_3", "CurHealth", "100000")

SetProperty("cis_frigate_space_1", "CurShield", "50000")
SetProperty("cis_frigate_space_1", "MaxShield", "50000")
SetProperty("cis_frigate_space_1", "MaxHealth", "100000")
SetProperty("cis_frigate_space_1", "CurHealth", "100000")
SetProperty("cis_frigate_space_2", "CurShield", "50000")
SetProperty("cis_frigate_space_2", "MaxShield", "50000")
SetProperty("cis_frigate_space_2", "MaxHealth", "100000")
SetProperty("cis_frigate_space_2", "CurHealth", "100000")
SetProperty("cis_frigate_space_3", "CurShield", "50000")
SetProperty("cis_frigate_space_3", "MaxShield", "50000")
SetProperty("cis_frigate_space_3", "MaxHealth", "100000")
SetProperty("cis_frigate_space_3", "CurHealth", "100000")

ClearAIGoals(ATT)
ClearAIGoals(DEF)

AddAIGoal(ATT, "Destroy", 10, cis_frigate_space_1 )
AddAIGoal(DEF, "Defend", 10, cis_frigate_space_1 )

AddAIGoal(ATT, "Destroy", 10, cis_frigate_space_2 )
AddAIGoal(DEF, "Defend", 10, cis_frigate_space_2 )

AddAIGoal(ATT, "Destroy", 10, cis_frigate_space_3 )
AddAIGoal(DEF, "Defend", 10, cis_frigate_space_3 )

AddAIGoal(DEF, "Destroy", 10, rep_frigate_space_1 )
AddAIGoal(ATT, "Defend", 10, rep_frigate_space_1 )

AddAIGoal(DEF, "Destroy", 10, rep_frigate_space_2 )
AddAIGoal(ATT, "Defend", 10, rep_frigate_space_2 )

AddAIGoal(DEF, "Destroy", 10, rep_frigate_space_3 )
AddAIGoal(ATT, "Defend", 10, rep_frigate_space_3 )

AddAIGoal(ATT, "Deathmatch", 40)
AddAIGoal(DEF, "Deathmatch", 40)

--Objectives 1 On Finish
rep_frigate_1 = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "rep_frigate_space_1" then
AddTeamPoints(DEF, 20)
SetProperty("rep_frigate_space_closed1", "CurHealth", "0")
SetProperty("rep_frigate_space_closed1", "MaxHealth", "0")
end
end
)

rep_frigate_2 = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "rep_frigate_space_2" then
AddTeamPoints(DEF, 20)
SetProperty("rep_frigate_space_closed2", "CurHealth", "0")
SetProperty("rep_frigate_space_closed2", "MaxHealth", "0")
end
end
)

rep_frigate_3 = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "rep_frigate_space_3" then
AddTeamPoints(DEF, 20)
SetProperty("rep_frigate_space_closed3", "CurHealth", "0")
SetProperty("rep_frigate_space_closed3", "MaxHealth", "0")
end
end
)

cis_frigate_1 = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "cis_frigate_space_1" then
AddTeamPoints(ATT, 20)
SetProperty("cis_frigate_space_closed1", "CurHealth", "0")
SetProperty("cis_frigate_space_closed1", "MaxHealth", "0")
end
end
)

cis_frigate_2 = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "cis_frigate_space_2" then
AddTeamPoints(ATT, 20)
SetProperty("cis_frigate_space_closed2", "CurHealth", "0")
SetProperty("cis_frigate_space_closed2", "MaxHealth", "0")
end
end
)

cis_frigate_3 = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "cis_frigate_space_3" then
AddTeamPoints(ATT, 20)
SetProperty("cis_frigate_space_closed3", "CurHealth", "0")
SetProperty("cis_frigate_space_closed3", "MaxHealth", "0")
end
end
)



objective_box_a_rep = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "objectives_a_rep" then
AddTeamPoints(DEF, 10)
ClearAIGoals(DEF)

ShowMessageText("level.co3.space.frigates.cis.b", DEF)

AddAIGoal(DEF, "Destroy", 50, rep_frigate_space_an )
AddAIGoal(DEF, "Defend", 10, cis_frigate_space_1 )
AddAIGoal(DEF, "Defend", 10, cis_frigate_space_2 )
AddAIGoal(DEF, "Defend", 10, cis_frigate_space_3 )
AddAIGoal(DEF, "Deathmatch", 20)

SetProperty("rep_frigate_space_an", "MaxShield", "80000")
SetProperty("rep_frigate_space_an", "CurShield", "80000")
SetProperty("rep_frigate_space_an", "MaxHealth", "200000")
SetProperty("rep_frigate_space_an", "CurHealth", "200000")

MapAddEntityMarker("rep_frigate_space_an", "hud_objective_icon_circle", 7.0, DEF, "RED", true, true, true)

end
end
)

objective_box_a_cis = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "objectives_a_cis" then
AddTeamPoints(ATT, 10)
ClearAIGoals(ATT)

ShowMessageText("level.co3.space.frigates.rep.b", ATT)


AddAIGoal(ATT, "Destroy", 50, cis_frigate_space_an )
AddAIGoal(ATT, "Defend", 10, rep_frigate_space_1 )
AddAIGoal(ATT, "Defend", 10, rep_frigate_space_2 )
AddAIGoal(ATT, "Defend", 10, rep_frigate_space_3 )
AddAIGoal(ATT, "Deathmatch", 20)

SetProperty("cis_frigate_space_an", "MaxShield", "80000")
SetProperty("cis_frigate_space_an", "CurShield", "80000")
SetProperty("cis_frigate_space_an", "MaxHealth", "200000")
SetProperty("cis_frigate_space_an", "CurHealth", "200000")

MapAddEntityMarker("cis_frigate_space_an", "hud_objective_icon_circle", 7.0, ATT, "RED", true, true, true)

end
end
)

--Objectives 2 On Finish

cis_frigate_animated = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "cis_frigate_space_an" then
AddTeamPoints(ATT, 40)

SetProperty("cis_frigate_space_closed_an", "CurHealth", "0")
SetProperty("cis_frigate_space_closed_an", "MaxHealth", "0")

ShowMessageText("level.co3.space.frigates.rep.c", ATT)

MapAddEntityMarker("cis_frigate_space", "hud_objective_icon_circle", 8.0, ATT, "RED", true, true, true)

ClearAIGoals(ATT)

AddAIGoal(ATT, "Destroy", 40, cis_frigate_space )
AddAIGoal(ATT, "Defend", 10, rep_frigate_space )
AddAIGoal(ATT, "Defend", 10, rep_frigate_space )
AddAIGoal(ATT, "Deathmatch", 40)

SetProperty("cis_frigate_space", "MaxShield", "100000")
SetProperty("cis_frigate_space", "CurShield", "100000")
SetProperty("cis_frigate_space", "MaxHealth", "350000")
SetProperty("cis_frigate_space", "CurHealth", "350000")


end
end
)

rep_frigate_animated = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "rep_frigate_space_an" then
AddTeamPoints(DEF, 40)
SetProperty("rep_frigate_space_closed_an", "CurHealth", "0")
SetProperty("rep_frigate_space_closed_an", "MaxHealth", "0")

ShowMessageText("level.co3.space.frigates.cis.c", DEF)

MapAddEntityMarker("rep_frigate_space", "hud_objective_icon_circle", 8.0, DEF, "RED", true, true, true)

ClearAIGoals(DEF)

AddAIGoal(DEF, "Destroy", 40, rep_frigate_space )
AddAIGoal(DEF, "Defend", 10, cis_frigate_space )
AddAIGoal(DEF, "Defend", 10, cis_frigate_space )
AddAIGoal(DEF, "Deathmatch", 40)

SetProperty("rep_frigate_space", "MaxShield", "100000")
SetProperty("rep_frigate_space", "CurShield", "100000")
SetProperty("rep_frigate_space", "MaxHealth", "350000")
SetProperty("rep_frigate_space", "CurHealth", "350000")
end
end
)


--Objective 3 On Finish - Instant Victory for Winning Team

victory_ATT = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "cis_frigate_space" then

MissionVictory(ATT)

end
end
)

victory_DEF = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "rep_frigate_space" then

MissionVictory(DEF)

end
end
)

DestroyTimer(timer)
end,
objectives
)

SetMapNorthAngle(180, 1)
SetUberMode(1);

-- EnableFlyerPath(team1_fly,1)
-- EnableFlyerPath(team2_fly,1)

end

function SetupObjectives()
assault = ObjectiveSpaceAssault:New{teamATT = 1, teamDEF = 2, textATT = "game.modes.space", textDEF = "game.modes.space", multiplayerRules = true, isCelebrityDeathmatch = true}

assault:Start()

end

function SetupDestroyables()

Republic_Frigates = LinkedDestroyables:New{ objectSets = {{"rep_frigate_space_1", "rep_frigate_space_2", "rep_frigate_space_3"}, {"objectives_a_rep"}} }
Republic_Frigates:Init()

CIS_Frigates = LinkedDestroyables:New{ objectSets = {{"cis_frigate_space_1", "cis_frigate_space_2", "cis_frigate_space_3"}, {"objectives_a_cis"}} }
CIS_Frigates:Init()

end
[/code]
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: A bunch of questions.

Post by AQT »

thelegend wrote:@AQT: Somehow this* doesn't work for my custom mode. The mode is actually Space Assault just without the Assault objectives (critical systems, shields and frigates stuff). But whenever I (or my team) or the enemies reach 180 points (Maximum score) nothing happens. Even when I use your lines.
Like I wrote:
AQT wrote:You will want to nest this in all your functions that check for the different ways the attacking team can gain points.
If you just use the lines as given, the game won't be constantly checking how many points each team has so far to determine who has 180+ points or not. Which is why you will have to determine all of the different ways points can be gained by a given team, meaning you will have create functions to keep track of all of it. For example, it looks like you gain points for destroying enemy frigates, so if the attacking team destroys a defending team's frigate, you would check to see if the attacking team has 180+ points or not.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: A bunch of questions.

Post by Marth8880 »

thelegend wrote:*if GetTeamPoints(ATT) >= 180 then
MissionVictory(ATT)
end
Put that in a function, maybe call it UpdatePoints(). You should probably initialize the function somewhere before ScriptPostLoad, and you should probably initialize it as a local function (by simply writing local function functionnameblahblahblah() ). Then, in every place where you call AddTeamPoints, insert a call for your new function *after* it. For example:

Code: Select all

AddTeamPoints(ATT, 10)
UpdatePoints()
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: A bunch of questions.

Post by thelegend »

So...like this ?
(Please don't fall in shock when unhinding the following)
Hidden/Spoiler:
[code]local function UpdatePoints()

if GetTeamPoints(ATT) >= 180 then
MissionVictory(ATT)
end

if GetTeamPoints(DEF) >= 180 then
MissionVictory(DEF)
end
end[/code]
I put this, and only this, above scriptpostload. And put UpdatePoints() below any AddTeamPoints I found.

EDIT: The code works. Thanks Marth and AQT. But somehow this does work for the destruction of objects only (Which use this AddTeamPoints). When I have 170 points (team points) for example and destroy a frigate I receive 30 points (Instant victory because of the 180 rule). But if all frigates (Except for the last one which leads to an instant victory) have been destroyed (Which makes about 130 points in total (out of 180)), I wouldn't win in the end when I continue attacking enemy fighters, which give me 4 points.
That's really strange (And I hope you understood me). I should try to find out how to receive points when any certain enemy fighters get destroyed so I can apply the UpdatePoints() there too.
Post Reply