PDA

View Full Version : [UT2004] Mutator Modifying Adrenaline


SlayerDragon
22nd Apr 2004, 09:23 AM
I am trying to randomly set the amount of points a pill gives you to a negative amount. Here is the code:

var() float chanceOfDowner;

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
local AdrenalinePickup P;
if( AdrenalinePickup(Other)!=NONE )
{
if( FRand() <= chanceOfDowner )
P = AdrenalinePickup(Other);
P.AdrenalineAmount = - P.AdrenalineAmount; //invert adrenaline amount
}
return false; //don't replace
}

defaultproperties
{
chanceOfDowner = 0.5;
}


This refuses to change the AdrenalineAmount! I have tried doing it like this:


P.default.AdrenalineAmount = - P.default.AdrenalineAmount;


Still, no effect. I tried changing the pickup message, and this is the only one that worked:


P.default.PickupMessage = "Downer ";


However, this changes the pickup message for ALL pills in the level.

:( Anyone know what I am doing wrong?

Mychaeel
22nd Apr 2004, 10:16 AM
Check the code:auto state Pickup
{
function Touch( actor Other )
{
local Pawn P;

if ( ValidTouch(Other) )
{
P = Pawn(Other);
P.Controller.AwardAdrenaline(2);
AnnouncePickup(P);
SetRespawn();
}
}
}

Looks like the amount of adrenaline given by the pickup is hard-coded, despite the (misleading) presence of that variable. Bad luck. :hmm:

SlayerDragon
22nd Apr 2004, 12:29 PM
Bah. Thanks. I was working on that before I went to bed last night so it was bothering me this morning while I'm at school. Looks like I will have to replace the pickup with my own then. :)