No announcement yet.

Overdose Mutator Help Please

  • Filter
  • Time
  • Show
Clear All
new posts

    Overdose Mutator Help Please

    Ok, I'm a very noob at programming :noob:

    I'm making a mutator that once you've picked up an extra 15 adrenaline after you have maxed out at 100 you start to lose health every second.

    What I'm having trouble is with finding out and setting an pawn (P)'s adrenaline, I know how to watched Buzz's VTMs and I know how to find out weaponName and health etc.

    But what is the one for adrenaline?

    Here is my code so far...Please give and tips or pointers. Thanks very much! :up:
    (It's probably full of mistakes :cry: )

    Code removed to save space
    This problem is now fixed for me. new problem later down

    Try Pawn.Controller.Adrenaline. Might work.


      P.Controller.Adrenaline worked instead, thanks for you help.


        New problem, basically the mutator doesn't work :bored: helpful, yes I know it isn't

        I think the problem is recognising when an adrenaline is picked up.

        This is my code so far

        Class Overdose Extends AdrenalinePickup;
        var int OD; //Number of Adrenaline picked up after reached 100
        auto state Pickup
        	function Touch( actor Other )
                        local Pawn P;
        		if ( ValidTouch(Other) )
                                P = Pawn(Other);
                                log("Adrenaline was picked up!");
                        if (P.Controller.Adrenaline >= 100)
                                SetTimer(1, True);
                                log("Overdose Number is now:"@OD);
                                OD = 0;
        function Timer()
                local xPawn P;
                if (OD > 5)
                        PickupMessage="Slightly Overdosed!";
                        P.Health -= 1;
                if (OD > 15)
                        P.GroundSpeed = (P.GroundSpeed) * 0.5;
                        P.Health -= 3;
        There's a timer and stuff after which I think works as it looks good.

        I was looking around AdrenalinePickup class and realised that I needed it to increase OD if your adrenaline is 100 or more and to SetTimer to perform in the Pickup state, I even put a log there to see if it is working, My code is the bold bits, The other bits are copied from AdrenalinePickup because Super.Touch wasn't working (I tried different versions such as Super.Touch( actor Other ) but I kept getting this error F:\UT2004\Overdose\Classes\Overdose.uc(15) : Error, Call to 'Touch': bad or missing parameter 1 )

        I think the error lies in the Pickup because when I run the mutator, my log doesn't appear or anything, so my guess it isn't just working.

        I'm sorry but I'm such a noob and I will be grateful for any help. I guess I should go back to watching all the VTMs.again :noob:


          I think you're looking at this the wrong way. You pickup your overdose pickup class, and the code executes, you pick up another, and it's code executes. Every instance of your 'overdose' class has the variable "OD", and what happens in the code of one instance doesn't change what happens in the others. This is the rundown of how it will look to the machine:

          You pickup Overdose, and your adrenaline is 100, so the code adds one to OD, making it 1.
          You pick up another, and your adrenaline is 100, so the code adds one to OD, making it 1 (Here's the importiant part) The reason is NOT because you have "OD = 0" in the defaultproperties, but because the "OD" variable in the new instance of the class (The SECOND Overdose you picked up), is 0 by default.

          Since Overdose is a pickup, it's code gets executed then it is thrown away. Basically you changed a variable (OD), and then the code refering to that variable got thrown away.

          I'm not sure how one would deal with this situation, but I do not believe the way you are going about doing this will work.

          Here's how I would try it:

          Make an inventory item (Just for fun, We'll call it 'SwollenLiver')

          Your Overdose class will check to see if the player has 100 adrenaline, and if so, check to see if the player has a 'swollenLiver'. If it doesn't, it gives the player one, if the player DOES have one already, Overdose increments a value in 'SwollenLiver', We'll call that value "ExcessPills"

          SwollenLiver, will be responsible for a few things:
          Keeping track of the "ExcessPills"
          Destroying itself if the player's adrenaline goes BELOW 100
          Doing whatever is needed when "ExcessPills" gets above whatever amount you want.

          I'm sure there are a few people here that can elaborate on this, but I think this would be one of the best routes.
          There are a few weapons that use this type of approach. I've seen (and used), an inventory item for keeping track of everything that happens when a person is set on fire. There's an inventory item that keeps track of a player's tempature, makes a flame effect and attaches it to the player, and deals out damage over time, to name a few.


            How 'bout taking this in a slightly different direction and lifting the 100 adrenaline maximum? Then you could simply check the adrenaline count. Balance would not be endangered, because nobody wants to overdose.