Jump to content


Photo

Repairing a building


3 replies to this topic

#1 bionicus

bionicus
  • New Members
  • 1 posts

Posted 04 April 2005 - 01:53 PM

Hey people,

I'm new to this forum, but first, i have to congratulate you for this amazing AI. I tried to find out, how to repair a building. In the SCAR file of mission #4, there is a part, that those idling grotz has to repair the building. Now I want to find out, how this SCAR stuff could be used in the AI, or how this SCAR is bridged to lua. The DoRepair function has got a simple building entity as parameter. Does anyone know, how I could find out the "health" of a building? I'm searching through the docs for hours and can't find anything. Maybe someone of you could help me.

Greetings,
bionicus

#2 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 04 April 2005 - 01:59 PM

Welcome. AFAIK you can't get the building damage status.

#3 giskard

giskard
  • Members
  • 155 posts

Posted 04 April 2005 - 04:15 PM

No way we have found so far but if you hit upon a clue be sure to post it.

Giskard

#4 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 04 April 2005 - 04:40 PM

No way we have found so far but if you hit upon a clue be sure to post it.

Giskard

<{POST_SNAPBACK}>


This is a semi-huge objective trying to get the AI to repair buildings. Yes we're looking into it although its not a big priority per se. I mean, it would be a nice "frill" although for one to repair a building does require resources although not much (depends on how damaged building is). Orks really don't need to worry about repairing buildings (all theirs auto-repair quickly).

Still.. The AI actually does, on occassion, repair pre-existing damaged buildings but its so rare its a sight to behold. We have no idea why he does this seemingly super-rare event! Here is an area that has always held a key to perhaps finding out how to do it:

File: buildbuildingplan.ai
local building = build_manager:FindUnfinishedBuilding( self.item_id )
	if building then
  Plan.SetNeeds( self, "fixing building...", BuildBuildingPlan.ObtainNewBuilder )
  Plan.SetState( self, "Try to fix building: "..self.item_name, BuildBuildingPlan.FixState )
	end
function BuildBuildingPlan:FixState()

	if self.building == nil or self.builder == nil then
  return
	end
	
	self.started_building = false
	self.builder:DoFinishBuilding( self.building )

	Plan.SetState( self, "Fixing a "..self.item_name, BuildPlan.BuildingState )
	
end
and
function BuildBuildingPlan:Update()

	--take into account if my builder dies
	if self.builder ~= nil and not self.builder:IsValid() then
	
  --reset builder
  Plan.UnlockResource( self, self.builder )
  self.builder = nil

  --set my state to try to fix the building
  Plan.SetNeeds( self, "Asking for new builder", BuildBuildingPlan.ObtainNewBuilder )
  Plan.SetState( self, "Try to fix building: "..self.item_name, BuildBuildingPlan.FixState )
	
	end
	
	Plan.Update( self )
	
end
We've never been truely able to determine how to do it and the above suggests more building new buildings and repairing them if the previous builder died when trying to build the new building then trying to repair an existing one!

We're still exploring the issue.

Edited by thudo, 04 April 2005 - 04:41 PM.

Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users