Page 1 of 1

Is there code for removing cps from conquest?

Posted: Wed Nov 02, 2011 2:07 am
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.

Re: Is there code for removing cps from conquest?

Posted: Wed Nov 02, 2011 5:21 am
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..

Re: Is there code for removing cps from conquest?

Posted: Wed Nov 02, 2011 7:34 am
by lucasfart
Out of curiosity, what is the ptr?

Re: Is there code for removing cps from conquest?

Posted: Wed Nov 02, 2011 8:29 am
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..

Re: Is there code for removing cps from conquest?

Posted: Wed Nov 02, 2011 4:55 pm
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.