Jump to content

[Delayed][WIP]Building Integrity


Recommended Posts

Building Integrity

"Once something's been set on fire, it's never as good as it was prior..."

A building currently has 4000 health and every ounce of it can be repaired.

What I am making a mutator to do, is to:

-->> give Buildings 4800 "total" health (still barely destroyable if every ounce of technician c4 is dumped onto a MCT at the same time and nobody repaired a single point of health)

-->> divide the 4800 into 1400 "armor" and 3400 "health"

-->> If "Healing" is invoked, it repairs only the armor but never the health so any damage over 1400 in the same setting is essentially permanent

I am doing this because, gameplaywise, any damage done to a structure will become gradually permanent if enough is done at once. As health is chipped away, structures grow weaker, possibly until a structure has 2000 total health left (half a structure's original health), and an engineer can destroy it solo or a rush only needs on good surge of alpha damage to destroy it. If balanced right, this can reduce the games we see go over an hour, but the same game will be played in the same fun way. Who knows, perhaps with a higher skill ceiling with rushes being so effective and counter-intellegence allowing repairmen to save precious building integrity.

I have fully read the script for the "Pawn", "Weapon Repair Gun", and "Building". A lot of misspelled "ammounts" :eek::P;):o:rolleyes: ... What I need help on likely, is:

-->> Suggestions on how to implement the above. No, not the armor, I pretty much think I know how to give a building armor, but how to have healing ignore health and skip straight to filling up armor.

-->> A courteous operator at EKT or TMX, preferably EKT as this targets Marathon slightly more than AOW (Successfully, this can merge the two as time/score will finally be replaced with "can always destroy the damned base"). This needs hosted and tested. I can use my own server to test the code and see if it "works", but I need to see what 16 players actively playing does to the game mechanics when implemented. I am hopefully looking at Goku for this.

Edited by Guest
Link to comment
Share on other sites

And I have my first question. Assuming I copy-paste the way RX_Pawn gives infantry "Armor"...

//----------------------------------------------------------------------------
// Armor Related
//----------------------------------------------------------------------------
var int Armor;
/** note.  if MaxArmor isnot set in the defualt properties it will set MaxArmor
*  to waht is the current Armor in the default properties */
var int ArmorMax;

...and the way that damage starts on armor and continues onto health...

{	ArmorTemp = Armor - ActualDamage;
	if(	 ArmorTemp < 0 )
	{	Armor = 0;
		ArmorTemp *= -1;
		Health -= ArmorTemp;}
	else
	{	Armor = ArmorTemp;}}

...then the HealDamage by default heals health and then armor. One idea, is that it has a value for "damage type" that acts as a healing type. Is there a way to specify that as heal armor but not health? Sort of like reverse-armor-piercing?

Alternatively...

simulated function RepairPawn(Rx_Pawn pawn, float DeltaTime)
{	if (!IsEnemy(pawn) && pawn.Health > 0 && (pawn.Health < pawn.HealthMax || pawn.Armor < pawn.ArmorMax) )
{	Repair(pawn,DeltaTime);}
else
{	bHealing = false;}
}

is it possible to make in the repairgun in simulated function RepairPawn, to target just armor and bypass health?

Link to comment
Share on other sites

there's a function called 'HealDamage' I think, so you might want to look at that

This was actually mildly useful...

function bool HealDamage(int Amount, Controller Healer, class DamageType)
{	local int HealthAmmount,ArmorAmmount, TotalAmmount;
local float Score;
if (Health <= 0 || Amount <= 0 || Healer == None || (Health >= HealthMax && Armor >= ArmorMax))
	return false;
HealthAmmount = Min(Amount, HealthMax - Health);
Health += HealthAmmount;
ArmorAmmount = Min(Amount - HealthAmmount, ArmorMax - Armor);
Armor += ArmorAmmount;
TotalAmmount = HealthAmmount + ArmorAmmount;
// Give score to the healer
if (TotalAmmount > 0)
{	Score = TotalAmmount * class(CurrCharClassInfo).default.HealPointsMultiplier;
	Rx_PRI(Healer.PlayerReplicationInfo).AddScoreToPlayerAndTeam(Score);}

So what, if I remove the parts about health altogether, from the "healdamage" bool, then it won't heal health, but if I leave the parts mentioning armor it will repair the armor?

function bool HealDamage(int Amount, Controller Healer, class DamageType)
{	local int ArmorAmmount, TotalAmmount;
local float Score;
if (Amount <= 0 || Healer == None || (Armor >= ArmorMax))
	return false;
ArmorAmmount = Min(Amount - HealthAmmount, ArmorMax - Armor);
Armor += ArmorAmmount;
TotalAmmount = HealthAmmount + ArmorAmmount;
// Give score to the healer
if (TotalAmmount > 0)
{	Score = TotalAmmount * class(CurrCharClassInfo).default.HealPointsMultiplier;
	Rx_PRI(Healer.PlayerReplicationInfo).AddScoreToPlayerAndTeam(Score);}

Like that? Worth a preliminary shot...

Link to comment
Share on other sites

Okay, so far, I have 1 class file, and am stuck at it failing to compile in Unreal Frontend. It is finding it, but throwing the warning "Missing ";" in "Class"". This is the entire Rx_BuildingModified.u file that I am trying to have compiled:

class Rx_BuildingModified extends Rx_Building

var(RenX_Buildings) int     Health;       // Starting Health for the building
var(RenX_Buildings) int     HealthMax; // Max Health for the building
var(RenX_Buildings) int    Armor;	    // Starting Armor for the building
var(RenX_Buildings) int    ArmorMax;  // Max Armor for the building

event TakeDamage(int DamageAmount, Controller EventInstigator, vector HitLocation, vector Momentum, class DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
local int ActualDamage;
local int ArmorTemp;

Super(Actor).TakeDamage(ActualDamage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);

{
	ArmorTemp = Armor - ActualDamage;
	if( ArmorTemp < 0 )
	{
		Armor = 0;
		ArmorTemp *= -1;
		Health -= ArmorTemp;
	}
	else
	{
		Armor = ArmorTemp;
	}
}
}

event bool HealDamage(int Amount, Controller Healer, class DamageType)
{
local int HealthAmmount,ArmorAmmount, TotalAmmount;
local float Score;
if (Health <= 0 || Amount <= 0 || Healer == None || (Armor >= ArmorMax))
	return false;

HealthAmmount = Min(Amount, HealthMax - Health);
Health += 0;

ArmorAmmount = Min(Amount, ArmorMax - Armor);
Armor += ArmorAmmount;

return true;
}

simulated function int GetHealth() 
{
	return Armor;		
}

simulated function int GetMaxHealth() 
{
return ArmorMax;	
}

defaultproperties
{
HealthMax           = 3600
Health              = 3600
Armor             	= 1200
ArmorMax			= 1200
}

Anyone have any clue? If this were .json I would suspect I had left out a ; , but I clearly didn't and there are only 3 times "class" is typed and all of them have the right syntax... I bet the code is just too sloppy for Unreal Frontend to read (I did use straight up value=value or value=0 when I needed it, I wasn't sure if it would work correctly without bugs until I got in-game)

EDIT: I did in fact at least forget two brackets at the very end. Testing again... And there must be something prior to it bugging, because the brackets didn't help...

Link to comment
Share on other sites

should be: class Rx_BuildingModified extends Rx_Building;

Omg if that is the problem I'll snap, because the files I used as reference distinctly lacked that semicolon...

EDIT: That is most uncool, cousin of Miles Prower... So it worked but now there are 6 other. Unreal 3 script isn't so much different in practice with the inheritance style of modding, but the code itself is a mess strung across 5 files of 20k character documents...

NEXT PROBLEMS

Okay, this isn't so bad:

1) A syntax error. I... guess I have an extra "{" somewhere... sigh, oh well, i'll figure it out. I am using Notepad++ with user defined unrealscript language import, but apparently they can still hide? Not anymore, fix'd

2) Then, "Health" and "HealthMax" allegedly "Conflict with Rx_Building". I assumed that was the point, such as in FlakCannonModified "Shotcost = 2" and in ShotgunModified the "spread = .25" and "ironsightspread = .15"... How else would you go about overwriting the structure health ffs?

3) I am sure this is right, but it says healthammount, totalammount, and score are unused variables. I can accept that, they really are... And now they are gone, fix'd

So seriously, the 2 errors about using health and healthmax, those are explicitly what I am supposed to use, what else was I supposed to do! EDIT: Wait, the way the Balance Mutator lowers Orca Health is an extension of UT_Mutator... I... guess I can look up and try that...?

Edited by Guest
Link to comment
Share on other sites

2) Then, "Health" and "HealthMax" allegedly "Conflict with Rx_Building". I assumed that was the point, such as in FlakCannonModified "Shotcost = 2" and in ShotgunModified the "spread = .25" and "ironsightspread = .15"... How else would you go about overwriting the structure health ffs?

You "extend" Rx_Building meaning all the variables are inherited by your class automatically. So you already have "Health" and "HealthMax" wich is why defining them again in your class gives you the conflict error.

Most likely the biggest problem you will run into though is that i dont think its possible to replace the building or building_internals classes with a mutator right now. They are not going through the CheckReplaceMent function of the mutator and you also cant exchange the BuildingInternalsClass setting of the normal building classes as BuildingInternalsClass is set to be const. I will look into opening it up more so that a mutator to atleast replace the building_internals classes would be possible. Replacing the Rx_Building classes themselves might already be impossible as they are part of the map and not spawned at runtime. So i think the map itself would need to be updated to use modified buildings.

But we separated Buildings in their map part (Rx_Building) and their "internals", logic oriented, part Rx_Building_Internals (wich is spawned at runtime and therefore should be accessible to a mutator somehow but not right now i think). Replacing the Building_Internals should be enough to do such a mutator but again i dont think that is even possible right now. So i think you need to change your mutator to extend of Rx_Building_Internals instead of Rx_Building and then you will most likely also have to wait for the next patch with changes to make this buildingmodification possible with a mutator (but maybe im wrong and it is possible but atm i see no way how).

Link to comment
Share on other sites

I suppose it wouldn't be possible to do what the Orca and Apache does in the Balance Mutator, and extend UT_Mutator?

Or, if I leave the armor and the way the structure handles damage and healing, could I just leave the health vanilla and see if it works?

Link to comment
Share on other sites

Yes doing it like the Orca and Apache changes in the BalanceMutator would be how i would try to exchange the BuildingInternalsClass aswell. But this wont work atm cause it is set to be a "const" variable so it can not be assigned something else with the mutator and trying it would give you an error when compiling the mutator. But we will remove the "const" with the next RX patch as i see no purpose for it.

"Or, if I leave the armor and the way the structure handles damage and healing, could I just leave the health vanilla and see if it works?"

Yeah something like that. But you will need to extend Rx_Building_Internals and you will also need to do that for every different Building_internals there is (one for every building) as only the specific types Rx_Building_Internals_Barracks etc are spawned and thus only them are "real" objects in the game, Rx_Building_Internals is just an abstract version of it that doesent exist in the game world and therefore cant be replaced with a mutator. But i dont want it to sound too complicated. You already figured out a lot in a short ammount of time and you are on the right track.

Link to comment
Share on other sites

I want to try this idea out badly aswell so since it seems this cant be modded in atm and needs a game update anyway i can incorporate this into the main game aswell while im at it so that a mutator wouldnt be needed. Would have gladly helped you to do this as a mutator but i really dont know how.

If i incorporate it into the game with the next patch i´ll make sure the armor and health values can be tweaked through ini´s and that it coudl be modified more with mutators.

Link to comment
Share on other sites

I want to try this idea out badly aswell so since it seems this cant be modded in atm and needs a game update anyway i can incorporate this into the main game aswell while im at it so that a mutator wouldnt be needed. Would have gladly helped you to do this as a mutator but i really dont know how.

If i incorporate it into the game with the next patch i´ll make sure the armor and health values can be tweaked through ini´s and that it coudl be modified more with mutators.

Well you don't really need to do tha... well, if you DID do it then TECHNICALLY anyone could go old-school mode by giving a structure 1hp and 3999 armor, or making a simple mutator to re-enable healdamage on structures...

Okay, well if you noticed, I hacked the building-icon as far as damage by "making the icon read armor rather than health" so it would go red if armor was low and not health. Possibly, the better implementation to this, would be to have the game request the total=health+armor and having the building icon instigate from the total rather than the gethealth or the armor.

Link to comment
Share on other sites

Yeah i´ll make sure it can be deactivated.

For the health bar what about showing health and armor together in the box but armor would be shown in a different color ? Like silver or blue for armor maybe. So then the health bar could show health and armor at the same time.

Link to comment
Share on other sites

  • Totem Arts Staff

Well, actually it's the buildings that spawns internal classes so I don't think Internal classes should be included in the mutator.

Another problem I see is that the buildings are StaticMeshes with static lightings (you even needs to rebuild when you change their locations)

Link to comment
Share on other sites

Yeah i´ll make sure it can be deactivated.

For the health bar what about showing health and armor together in the box but armor would be shown in a different color ? Like silver or blue for armor maybe. So then the health bar could show health and armor at the same time.

Now that sounds a lot like work, but you can do that. The ways it can be done:

-->>showing 1 bar on top and 1 bar touching the border below and in 2 separate colors. Sort of like Halo Overshield.

-->>showing 1 bar that fills once for health and refills again in a different color for armor, sort of like TF2 overheal.

-->>the easiest way I originally mentioned is what infantry does now and just fill 1 bar 1 color but it is "total vitality" that is the sum of health and armor. Functional, less informative.

Well, actually it's the buildings that spawns internal classes so I don't think Internal classes should be included in the mutator.

Another problem I see is that the buildings are StaticMeshes with static lightings (you even needs to rebuild when you change their locations)

The internals pass their state to the structure, thus sharing health while taking damage separately (with different armor values modifying the damage per structure outside and MCT inside). Theoretically, changing the internals can change the structure.

Also, I am not certain that changing the structure stats would force relighting the structure, unless the game literally needs to relight for an identical yet different structure. It might, which is a good reason to change internals instead.

Link to comment
Share on other sites

  • Totem Arts Staff

The internals pass their state to the structure, thus sharing health while taking damage separately (with different armor values modifying the damage per structure outside and MCT inside). Theoretically, changing the internals can change the structure.

Also, I am not certain that changing the structure stats would force relighting the structure, unless the game literally needs to relight for an identical yet different structure. It might, which is a good reason to change internals instead.

Most codings are indeed in the Internal class.

And yep, unfortunately it does need to relight... at least as far as I know. Changing a single number in static light will cause the Lighting needs to be rebuilt to pop up

Link to comment
Share on other sites

... at least as far as I know. Changing a single number in static light will cause the Lighting needs to be rebuilt to pop up

Does it warn that lighting needs rebuilt via popup, if you change a building stat that is not directly related to lighting? Such as "building health"?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...