Is there code for removing cps from conquest?

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
Jaspo
Command Sergeant Major
Command Sergeant Major
Posts: 282
Joined: Sun Mar 01, 2009 4:34 am
Projects :: AotC DoW+++Boonta Eve Classic
Games I'm Playing :: WoT MBWBVC Robocraft
xbox live or psn: No gamertag set
Contact:

Is there code for removing cps from conquest?

Post by Jaspo »

I'm making a map which involves removing cps during the course of the battle (conquest) and currently I am doing so by setting the cps' team to 0 and killing the cp objects. While this keeps the AI from spawning, removes the cp models from play, and removes the icons from the minimap, it unfortunately doesn't alter the reinforcement drain rates that are set when the cps are initially added to the objective. Is there code for removing them from the objective?
Hint: replacing the word "Add" with "Remove" doesn't work...rather it crashes the map.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Is there code for removing cps from conquest?

Post by DarthD.U.C.K. »

i suppose you could modify the killcommanndpost function in the objectiveconquest.lua

Code: Select all

	-- command post kill
	OnCommandPostKill(
		function (postPtr)
			if self.isComplete then	return end
			if not self.commandPosts[GetEntityName(postPtr)] then return end
			
			if not self.multiplayerRules then
				MapRemoveEntityMarker(postPtr, self.teamATT)
			end
			
			UpdateState()
		end
		)	
and insert these two lines from the addcommandpost function with a "-" istead of a "+"

Code: Select all

	self.totalBleedValue[self.teamATT] = self.totalBleedValue[self.teamATT] + GetCommandPostBleedValue(cp.name, self.teamATT)
	self.totalBleedValue[self.teamDEF] = self.totalBleedValue[self.teamDEF] + GetCommandPostBleedValue(cp.name, self.teamDEF)
you somehow have to get the name from the ptr though..
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Is there code for removing cps from conquest?

Post by lucasfart »

Out of curiosity, what is the ptr?
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Is there code for removing cps from conquest?

Post by DarthD.U.C.K. »

hmm, according to the scriptingsystem.doc its the actual object rather than its name. it seems like an object name and its ptr can be used synonymously, so you probably can probably replace cp.name with postptr..
Jaspo
Command Sergeant Major
Command Sergeant Major
Posts: 282
Joined: Sun Mar 01, 2009 4:34 am
Projects :: AotC DoW+++Boonta Eve Classic
Games I'm Playing :: WoT MBWBVC Robocraft
xbox live or psn: No gamertag set
Contact:

Re: Is there code for removing cps from conquest?

Post by Jaspo »

Disregard the former contents of this post. It wasn't working because I put the code on the wrong side of an "end." It works now. Thanks.
Post Reply