[UT2004] Mutator Modifying Adrenaline

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

SlayerDragon

LLLLLLLLLLLLLLLLLADIES
Feb 3, 2003
7,666
0
36
40
I am trying to randomly set the amount of points a pill gives you to a negative amount. Here is the code:
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:

Code:
	P.default.AdrenalineAmount = - P.default.AdrenalineAmount;

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

Code:
	P.default.PickupMessage = "Downer ";

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

:( Anyone know what I am doing wrong?
 

Mychaeel

New Member
Check the code:
Code:
auto state Pickup
{   
    function Touch( actor Other )
    {
        local Pawn P;
            
        if ( ValidTouch(Other) ) 
        {           
            P = Pawn(Other);    
            [b]P.Controller.AwardAdrenaline(2);[/b]
            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

LLLLLLLLLLLLLLLLLADIES
Feb 3, 2003
7,666
0
36
40
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. :)