• 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/

[Mutator] Nade Warn

Phada

Grizzled Veteran
Aug 24, 2010
190
62
France
phada.2ya.com
This mutator will show a big icon and danger text (optional) for all or only your own grenades at close range.


Uploaded with ImageShack.us - click here if the image doesn't show properly.


Update #4: 5 April 2011
-No change, only corrected the icon transparency option description.

Update #3: 27 March 2011
-Network code and optimizations by Marco
-Slightly increased the detection radius to make the warning more safe, from 480 (+14%) to 500 (+19%). Grenade damage radius = 420.

Update #2: 24 March 2011
-Added Icon transparency % option as requested by RoBoT.
-Added warn delay for own nade option as requested by RoBoT.

Update #1: 22 March 2011
-Fixed the crash issue. Thanks to Marco.
-Danger text is now blinking red/yellow.
-Small code optimizaion.

Created: 19 March 2011


Download from MediaFire.
 

Attachments

  • KFNadeWarn.zip
    5.6 KB · Views: 8
  • KFNadeWarn_src.zip
    3.2 KB · Views: 3
Last edited:
Awesome mut! I like it! Thanks to you Phada. But there is a some bag...
I am using this mut on my server, and players after they death get this error from game client
Code:
Build UT2004_Build_[2004-11-11_10.48]
General protection fault!
History: UObject::ProcessEvent <- (InteractionMaster Package.InteractionMaster, Function Engine.InteractionMaster.Process_PostRender) <- UInteractionMaster::MasterProcessPostRender <- FPlayerSceneNode::Render <- UGameEngine::Draw <- WindowsViewport::Repaint <- UWindowsClient::Tick <- ClientTick <- UGameEngine::Tick <- Level UnderGround v2 <- UpdateWorld <- MainLoop <- FMallocWindows::Free <- FMallocWindows::Free
 
Upvote 0
I can tell you that crash happens from this in interaction:
Code:
var Pawn P;
When pawn is destroyed, it is not set to None, instead it's left with invalid pointer so to fix this, use "local Pawn P;" instead:
Code:
function PostRender(Canvas C)
{
    local Grenade G;
    local Pawn P;

    P = ViewportOwner.Actor.Pawn;

    if ( P!=None && P.Health>0 )
        foreach P.VisibleCollidingActors(class'Grenade', G, WARN_RADIUS, P.Location, true)
            if (G != None)
                if (!class'KFNadeWarn.MutNadeWarn'.default.bOwnNadeOnly || G.Instigator == P)
                    NadeRender(C, G.Location);
}
Crash fixed.
 
Upvote 0
Thank you very much to have take a look, and for this explaination :)

I am wondering if isn't better to put the canvas code into hud overlay instead of interaction (old ut2003 system?), I've tried and it work as well. Which one do you recommend?

If hud overlay, I should put this orange line just in case?
Code:
[...]
local Pawn P;

[COLOR=Orange]if (HUD(Owner) != None)[/COLOR]
    P = HUD(Owner).PawnOwner;

if (P != None && P.Health > 0)
[...]
Because the owner is set to HUD just after the overlay spawn while using "PC.myHUD.AddHUDOverlay(NewOverlay);".
 
Upvote 0
I am wondering if isn't better to put the canvas code into hud overlay instead of interaction (old ut2003 system?), I've tried and it work as well. Which one do you recommend?

If hud overlay, I should put this orange line just in case?
Personally I would prefer to use HUDOverlay whenever possible and it's not necessary to check if HUD(Owner)!=None because HUD should always be there.
 
Upvote 0
I have a request of few changes:
- Making an option to remove "danger word"
- Resize the grenade warn smaller.
- More transparency to the grenade warn (optional)
- Put timer when the grenade warn shows after throwing it, example.. throwing the grenade then after 1.5 second the grenade warn shows instead of covering ur screen once u throw it.

that would be great though :)
 
  • Like
Reactions: Phada
Upvote 0
Thanks for suggestions Robot :)

The danger text is already optional you can disable it in options.

The icon transparency is set around 60% and the icon size is scaled from x3 at point blank to x0.7 at the maximum warn distance, after many tests.
It's intended to be very visible, but I can easily add a option to set the icon transparency, and maybe for the max and min size.

About the timer before showing the grenade, it's a good idea, I will take a look if I can find a clean solution without modifying the grenades or pawn code himself because I wants to keep the mutator as simple as possible without modifying things to make sure he will remain 100% compatible.

@kedirakevo
I am waiting for some more feedbacks or bug reports then I will request to put this on whitelist. (that's why there is no version for now)
 
Upvote 0