• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Question about converting custom gamemode to a mutator

To modify "FireInterval(ALTFIRE_FIREMODE)" and "AmmoCost(ALTFIRE_FIREMODE)" in KFWeap_Beam_Microwave.uc should I again do it via CheckReplacement similarly to multipliers because it also inherits from Actor? Like this:

Code:
function bool CheckReplacement(Actor Other)
{
        if(KFWeap_Beam_Microwave(Other) != None)  
    {
            KFWeap_Beam_Microwave(Other).FireInterval(ALTFIRE_FIREMODE)=+3.0;
            KFWeap_Beam_Microwave(Other).AmmoCost(ALTFIRE_FIREMODE)=20;        
    }
        return Super.CheckReplacement(Other);
}

If yes i get "Error, '(': Expression has no effect"

edit: When I think about it now, plenty of stuff inherits from Actor so it wouldn't all make use of CheckReplacement. Maybe through OverridePickupQuery?
 
Last edited:
Upvote 0
Right, both FireInterval and AmmoCost are arrays and you access their members via square brackets. And ALTFIRE_FIREMODE is unknown (for your mutator class) constant, if you check KFWeapon where it declared you'll see that it means "1" so either refer to its location or replace it with 1.

Code:
KFWeap_Beam_Microwave(Other).FireInterval[KFWeap_Beam_Microwave(Other).const.ALTFIRE_FIREMODE]=10;

or

Code:
KFWeap_Beam_Microwave(Other).FireInterval[1]=+3.0;

Parentheses are only used to fill arrays within defaultproperties.

Also, AmmoCost is protected variable, you'll only get access to it from the weapon class.
 
Last edited:
  • Like
Reactions: Bardyss
Upvote 0
Just to be sure: if .FireInterval is "+ and equals" not just "equals" then it will not add 1 second AND THEN 2 seconds? Meaning if I were to add this line to my mut(vanilla value):
Code:
KFWeap_Beam_Microwave(Other).FireInterval[1]=+1.0;

It wouldn't change anything right? Or it would add another second on top of vanilla delay?

edit: NVM, just tested it out. The former.
 
Last edited:
Upvote 0
Can you access variables and methods of certain class and what do you need for that? A reference to an instance of class that contains them, right?

Can you overwrite one class' function from another? Can you, probably, attempt to overwrite the variable itself?

Can you try to figure out what kind of fruit tree this fruit is belongs to? Type casting?

Hint: you've done this before in InitMutator.
 
  • Like
Reactions: Bardyss
Upvote 0