Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: Flashy on April 28, 2010, 12:59:02 PM

Title: Alternative Repair Ai
Post by: Flashy on April 28, 2010, 12:59:02 PM
Because my compiler refuses to work with Eddy-B's repair code, I want my AI to cheat.
Initproc
Code: [Select]
CreateTimeTrigger(1, 0, 20000, "Repairallaibuildings");
After AIproc
Code: [Select]
SCRIPT_API void Repairallaibuildings()
{
Unit u;
PlayerBuildingEnum enum1(2, mapNone);
while (enum1.GetNext(u))
{
if (u.IsVehicle()) continue;
{
SetDamage(0);
}
}
}
But it can't find SetDamage.
Can you help me, and does it work after all?
Title: Alternative Repair Ai
Post by: Hidiot on April 28, 2010, 02:01:30 PM
u.SetDamage(0);


Also, that will make vehicles indestructible, because IsVehicle will return false for buildings.
Title: Alternative Repair Ai
Post by: Flashy on April 28, 2010, 02:18:20 PM
Is there a IsBuilding?
And why did you say undestructible? I thought my TimeTrigger fires only once(in 200 marks)?
Title: Alternative Repair Ai
Post by: Hidiot on April 28, 2010, 02:24:24 PM
Oh, it's not in AIProc. My bad.

Still, IsVehicle() will return true if the object is a vehicle and false if it's not. (eg. u.IsVehicle() will return a false if u is a building)

But, you're using a building enumerator. That only counts buildings, so adding that if is redundant.
Title: Alternative Repair Ai
Post by: Flashy on April 28, 2010, 02:55:28 PM
It works now! Thanks.
(And by replacing the 20000 by 15, the buildings indeed are invincible)
Title: Alternative Repair Ai
Post by: evecolonycamander on April 28, 2010, 03:43:15 PM
Hey this is kinda ovious(pardon spelling) but won't an enmy that self repairs its self in the middle of battle be Realy unfair?
Title: Alternative Repair Ai
Post by: Sirbomber on April 28, 2010, 06:40:36 PM
You bet!  Welcome to the primitive world of OP2 AI!
Title: Alternative Repair Ai
Post by: CK9 on April 28, 2010, 09:19:12 PM
If I ever get around to it, a certain map of mine will impliment this AI "cheating" to make it actually difficult.