News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 22nd Apr 2004, 08:23 AM   #1
SlayerDragon
LLLLLLLLLLLLLLLLLADIES
 
SlayerDragon's Avatar
 
Join Date: Feb. 3rd, 2003
Posts: 7,665
[UT2004] Mutator Modifying Adrenaline

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?
__________________
Code:
        __   ,    _   __   ,
 |   | /  \_/ \_|/ \_/  \_/ \_
  \_/|/\__/  \/ |__/ \__/  \/
    /|         /|  
    \|         \|
SlayerDragon is offline   Reply With Quote
Old 22nd Apr 2004, 09:16 AM   #2
Mychaeel
 
Join Date: Oct. 3rd, 2001
Location: Frankfurt/Main, Germany
Posts: 3,829
Check the code:
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.
Mychaeel is offline   Reply With Quote
Old 22nd Apr 2004, 11:29 AM   #3
SlayerDragon
LLLLLLLLLLLLLLLLLADIES
 
SlayerDragon's Avatar
 
Join Date: Feb. 3rd, 2003
Posts: 7,665
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.
__________________
Code:
        __   ,    _   __   ,
 |   | /  \_/ \_|/ \_/  \_/ \_
  \_/|/\__/  \/ |__/ \__/  \/
    /|         /|  
    \|         \|
SlayerDragon is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:17 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer