Fix to Linked Destroyables (FAQ)

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
xwingguy

Fix to Linked Destroyables (FAQ)

Post by xwingguy »

Problem is that if you repair the internal critical system and then somebody else blows up the EXTERNAL critical system YOU TAKE THE BLAME FOR THE DEATH OF THE INTERNAL SYSTEM. That's a whopping
-18 points.

IF YOU ARE MAKING A SPACE MODE WITH CRITICAL SYSTEMS, THIS IS VERY IMPORTANT!!!!!!!!

Here's how to fix it. (It's really easy)

Code: Select all

LinkedDestroyables = 
{
objectSets = nil,		
New = function(self, o)
	o = o or {}
	setmetatable(o, self)
	self.__index = self
	return o
	end,
	
	
	Init = function(self)
		--------------------
		-- Local functions
		--
	local ObjectKilled = function(setIndex)
	for _, objectName in pairs(self.objectSets[setIndex]) do
	if IsObjectAlive(objectName) then
		return
		end
	end
			
	--if you reach reach here, all the objects in the set are dead, so 
	--we need to now go and kill all the objects in the other sets
	for setIdx, set in pairs(self.objectSets) do
	if setIdx ~= setIndex then
	for _, objectName in pairs(set) do
	if IsObjectAlive(objectName) then
	SetProperty(objectName, "Team", 0) --<---INSERT THIS LINE!
	KillObject(objectName)
What that single extra line does is make the critical system worth 0 points. Problem Solved!!!

Edit: Clarification: this makes it so when the external system is destroyed the just internal system becomes 0 points and vice versa. So points are only awarded to the player who ultimately triggered the destruction.
Last edited by xwingguy on Mon May 15, 2006 3:28 am, edited 1 time in total.
MercuryNoodles
Jedi
Jedi
Posts: 1003
Joined: Sun Mar 12, 2006 7:16 pm
Projects :: Space - Boarding Action
xbox live or psn: No gamertag set

Post by MercuryNoodles »

Edit: This goes in Common/scripts/LinkedDestroyables.lua

Just to save everyone time and spare us questions.
Post Reply