Announcement

Collapse
No announcement yet.

My Custom PostProcessVolume

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    My Custom PostProcessVolume

    Hey guys,

    I'm working at a very simple PostProcessVolume but everytime I want to compile it I get the Warning "local variable used before assigned a value". I know I my script wont't work this way, but what can I do?

    class DarknessEffect extends PostProcessVolume
    placeable;
    function tick(float deltatime)
    {
    local UberPostProcessEffect red;
    local UberPostProcessEffect grey;
    local UberPostProcessEffect dark;
    local UTPlayerController foundController;

    foreach WorldInfo.AllControllers(class'UTPlayerController' ,foundController)
    {
    `log("foundController"@foundController.Name);
    break;
    }

    red.SceneColorize.X=3/(foundController.Pawn.Health);
    red.SceneColorize.Y=1;
    red.SceneColorize.Z=1;

    grey.SceneDesaturation=0;

    dark.SceneShadows.X=1;
    dark.SceneShadows.Y=3/(foundController.Pawn.Health);
    dark.SceneShadows.Z=1;
    }
    defaultproperties
    {
    }
    Can someone gimme a hint?

    Thanks a lot,
    Stefan

    #2
    The error is pointing to the lines
    Code:
    local UberPostProcessEffect red;
    local UberPostProcessEffect grey;
    local UberPostProcessEffect dark;
    This is a deklaration/definition of a variable. In order to use these variables, you need to "give them" a value. This is called initialization (in this case assignment).

    You could spawn a UberPostProcessEffect and add this to the LocalPlayer's PostProcessChain. Otherwise, nothing will be shown.

    Code:
    dark = new class'UberPostProcessEffect';
    
    // now add this to the LocalPlayer's PostProcessChain
    // something like LocalPlayer(PC).InsertPostProcessingChain (...)
    // but you need to create a PostProcessChain in the editor
    But i don't know if this would work. My approach would be something like this.
    Code:
    // PP highlighting based on Beserk pickup
    class CustomPostProcessVolume extends Volume
        placeable;
    
    var vector PP_Scene_HighLights;
    var float PP_Scene_Desaturation;
    
    simulated event Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal ) {
        local UTPlayerController PC;
        super.Touch(Other, OtherComp, HitLocation, HitNormal);
    
    
        if (Pawn(Other) != none) {
            if (Pawn(Other).Controller) {
                PC = UTPlayerController(Pawn(Other).Controller);
                if (PC == None && P.DrivenVehicle != None) {
                    PC = UTPlayerController(Pawn(Other).DrivenVehicle.Controller);
                }
                if (PC != None) {
                    PC.PostProcessModifier.Scene_HighLights -= PP_Scene_Highlights;
                    PC.PostProcessModifier.Scene_Desaturation -= PP_Scene_Desaturation;
                }
            }
        }
    }
    
    simulated event UnTouch( Actor Other ) {
        local UTPlayerController PC;
        
        super.UnTouch(Other);
    
        if (Pawn(Other) != none) {
            if (Pawn(Other).Controller) {
                PC = UTPlayerController(Pawn(Other).Controller);
                if (PC == None && P.DrivenVehicle != None) {
                    PC = UTPlayerController(Pawn(Other).DrivenVehicle.Controller);
                }
                if (PC != None) {
                    PC.PostProcessModifier.Scene_HighLights += PP_Scene_Highlights;
                    PC.PostProcessModifier.Scene_Desaturation += PP_Scene_Desaturation;
                }
            }
        }
    }
    
    defaultproperties
    {
        PP_Scene_Highlights=(X=-0.15,Y=-0.08,Z=0.05)
    }

    Comment

    Working...
    X