[Logo]
 
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Proposal: DruidArtifactLoaded change - Pinata fix!  XML
Forum Index -> Druids RPG Development
Author Message
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

I put in a "PreventDeath" to DAL:

Code:
 static function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> DamageType, vector HitLocation, int AbilityLevel, bool bAlreadyPrevented)
 {
 	Local Inventory inv;
 	local bool gotghost;
 	local bool gotdal;
 	local int GhostLevel;
 	local RPGStatsInv StatsInv;
 	local int y;
 	local Pawn MyCar;
 
 	if(Killed.isA('Vehicle'))
 	{
 		MyCar = Killed;
 		Killed = Vehicle(Killed).Driver;
 	}
 
 	if (bAlreadyPrevented)
 		return false;
 
 // Fix for Ghost - this does icky things if we don't run ghost first.
 // Once we "fix" ?death, things like this won't be an issue.
 	StatsInv = RPGStatsInv(Killed.FindInventoryType(class'RPGStatsInv'));
 // Loop through - stop when you find ghost.  Ghost needs to run first.
 	if (StatsInv != None)
 	{
 		for (y = 0; y < StatsInv.Data.Abilities.length && !gotghost; y++)
 		{
 			if (StatsInv.Data.Abilities[y] == class'DruidGhost')
 			{
 				gotghost = true;
 				GhostLevel = StatsInv.Data.AbilityLevels[y];
 			}
 			if (StatsInv.Data.Abilities[y] == class'DruidArtifactLoaded')
 			{
 				gotdal = true;
 			}
 		}
 	}
 
 	if (gotghost && gotdal)
 	{
 // If DruidGhost returns true, we need to return true - and the bAP check in Ghost
 // should result in DruidGhost's PD (when run by RPGRules) doing nothing.  Note that
 // we call PD here with "MyCar" as we have not ejected the driver yet!
 		if(class'DruidGhost'.static.PreventDeath(MyCar, Killer, DamageType, HitLocation, GhostLevel, bAlreadyPrevented))
 			return true;
 	}
 // End Ghost fix.
 
 	for (inv=Killed.Inventory ; inv != None ; inv=inv.Inventory)
 	{
 		if(ClassIsChildOf(inv.class, class'UT2004RPG.RPGArtifact'))
 		{
 // Important note: *NO* artifact currently in possession will get dropped!
 			inv.PickupClass = None;
 		}
 	}
 
 	return false;
 }
 


You'll note that it contains my "Ghost" fix similar to what's in DruidNoWeaponDrop.

This will prevent all artifacts held by the user being dropped on death. The AM is still able to drop all regularly droppable artifacts manually though.

EDIT: I've also got a minor edit to DruidNoWeaponDrop to go in that covers unejected vehicle occupants similar to above.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
TheDruidXpawX

Wicked Sick!
[Avatar]

Joined: 12/19/2004 18:32:13
Messages: 1946
Offline

That looks good! Does it appear to workie all good on your end? If so I approve!

Skin download: http://www.disastrousconsequences.com/dcforum/posts/list/1189.page

The fundamental problem is this: The first word we learn as children is NO. From that point forward society teaches women that saying no isn't polite, and society teaches men to respect those who wont take no for an answer.

The world is what you make of it, my friend. If it doesn't fit, you make alterations. -- Stella, The Morning Star
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

So far it's been tested with regular INV - I haven't actually tested VINV yet but I noted that there could have been a possible issue with calling PD with someone in a vehicle and passing only the dead guy, not the vehicle. So I have patches (as per my edit above) to both this and Denial that I'm going to make an effort in testing. Once I'm "happy" or near apathetic I'll commit both.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

Crap on a cracker!

There's a lot of wonkiness going on when a vehicle is blown up. In my VINV test matches, it always results in a "death" (little D denoting it can be prevented). Thing is, if somewhere along the line Ghost kicks in, it almost looks like the PD routine in RPGRules is kicked off for both the vehicle and the driver! And at one point, when the vehicle's PD sequences are running, and somewhere some Ability tries to assign the vehicle's driver to "Killed", it becomes "None". Further confusing issues is that bAlreadyPrevented can become "True" (due to a successful ghosting) for one, but "False" for "the Vehicle".

Right now I've got a patch in my working copy that checks after the point where a "Killed" vehicle's "Driver" is assigned to "Killed", and if "Killed" is "None", bombs out.

IT's still wierd though ...

I'm fixing this issue both in DAL and DNWD as I go ... I'll let you know when something's been committed.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

Okay I've committed fixes to both DruidArtifactLoaded and DruidNoWeaponDrop.

I still haven't exactly figured out the whole PD called twice in VINV thing. This could be an issue with calling Ghost.PD outside of the normal sequence in the RPGRules.PD routine, or perhaps an issue with Ghost.PD prior to now that's gone unnoticed.

So: Pinata fixed, and a bunch of things that would have caused:
Code:
 DruidNoWeaponDrop None (Function DruidsRPGxxx.DruidNoWeaponDrop.PreventDeath:HEX#) Accessed None 'Killed'
 

Have been resolved.

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
BotFodder

Wicked Sick!
[Avatar]

Joined: 01/13/2006 15:23:41
Messages: 1239
Location: Florida
Offline

Okay I've committed fixes to both DruidArtifactLoaded and DruidNoWeaponDrop.

I still haven't exactly figured out the whole PD called twice in VINV thing. This could be an issue with calling Ghost.PD outside of the normal sequence in the RPGRules.PD routine, or perhaps an issue with Ghost.PD prior to now that's gone unnoticed.

So: Pinata fixed, and a bunch of things that would have caused:
Code:
 DruidNoWeaponDrop None (Function DruidsRPGxxx.DruidNoWeaponDrop.PreventDeath:HEX#) Accessed None 'Killed'
 

log file lines have been resolved. Full redone PD for DAL below:
Code:
 static function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> DamageType, vector HitLocation, int AbilityLevel, bool bAlreadyPrevented)
 {
 	Local Inventory inv;
 	local bool gotghost;
 	local bool gotdal;
 	local int GhostLevel;
 	local RPGStatsInv StatsInv;
 	local int y;
 	local Pawn MyCar;
 
 	if (bAlreadyPrevented)
 		return false;
 
 // Put this here - No matter what, MyCar is Killed.  Now, if we are in a
 // vehicle, Killed becomes something else, but MyCar stays the same.  This
 // is so PD, if called, is called with the right thing.
 	MyCar = Killed;
 	if(Killed.isA('Vehicle'))
 	{
 		Killed = Vehicle(Killed).Driver;
 	}
 // Wierdness - looks like sometimes PD called twice, particularly in VINV?
 // Someday might want to change this to return true - could stop a lot of
 // other wierdness.  Killed can become "None" somewhere along the line.
 	if(Killed == None)
 	{
 		return false;
 	}
 
 // Fix for Ghost - this does icky things if we don't run ghost first.
 // Once we "fix" ?death, things like this won't be an issue.
 	StatsInv = RPGStatsInv(Killed.FindInventoryType(class'RPGStatsInv'));
 // Loop through - stop when you find ghost.  Ghost needs to run first.
 	if (StatsInv != None)
 	{
 		for (y = 0; y < StatsInv.Data.Abilities.length && !gotghost; y++)
 		{
 			if (StatsInv.Data.Abilities[y] == class'DruidGhost')
 			{
 				gotghost = true;
 				GhostLevel = StatsInv.Data.AbilityLevels[y];
 			}
 			if (StatsInv.Data.Abilities[y] == class'DruidArtifactLoaded')
 			{
 				gotdal = true;
 			}
 		}
 	}
 
 	if (gotghost && gotdal)
 	{
 // If DruidGhost returns true, we need to return true - and the bAP check in Ghost
 // should result in DruidGhost's PD (when run by RPGRules) doing nothing.  Note that
 // we call PD here with "MyCar" as we have not ejected the driver yet, if Killed was
 // originally a vehicle!
 		if(class'DruidGhost'.static.PreventDeath(MyCar, Killer, DamageType, HitLocation, GhostLevel, bAlreadyPrevented))
 		{
 			return true;
 		}
 	}
 // End Ghost fix.
 
 	for (inv=Killed.Inventory ; inv != None ; inv=inv.Inventory)
 	{
 		if(ClassIsChildOf(inv.class, class'UT2004RPG.RPGArtifact'))
 		{
 // Important note: *NO* artifact currently in possession will get dropped!
 			inv.PickupClass = None;
 		}
 	}
 
 	return false;
 }
 

I use the Futurama Prof. Farnsworth Skin: http://www.disastrousconsequences.com/dcforum/posts/list/1595.page
WM: (DC)BotFodder 170
MM: (DC)BotDoctor 141
AM: (DC)BotBooster 147
http://ericdives.com/ - My DC Newbie FAQ: http://tinyurl.com/lz229
Twitter: http://twitter.com/ericdives
[WWW] aim icon [MSN]
 
Forum Index -> Druids RPG Development
Go to: