Announcement

Collapse
No announcement yet.

Weird interaction problem...

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

    Weird interaction problem...

    Hope someone can help.

    I'm trying to add a hud interaction. This is from my HUD class:

    Code:
    simulated function Tick(float deltaTime){
       if(tickEnabled){
          Level.Game.Broadcast(self, ("TESTING"));
          PlayerOwner.Player.InteractionMaster.AddInteraction("MyMod.MapInteraction", PlayerOwner.Player);
       }
    }

    This is in the interaction class
    Code:
    function Initialize(){
       ViewportOwner.Actor.ClientMessage("Initialized");
       MyMod(ViewportOwner.Actor.myHUD).setDrawMap(false);
       PlayerOwner = ViewportOwner.Actor;
       if (PlayerOwner != none){
          MyMod(ViewportOwner.Actor.myHUD).disableTheTick();
       }
    }
    Code:
    function bool KeyEvent(EInputKey Key, EInputAction Action, FLOAT Delta )
    {
        if ((Action == IST_Press) && (Key == IK_M)){
            ViewportOwner.Actor.ClientMessage("Pressed m");
            ViewportOwner.Actor.ClientMessage(MyMod(ViewportOwner.Actor.myHud).getTickEnabled());
            if(MyMod(ViewportOwner.Actor.myHUD).getDrawMap() == false){
               ViewportOwner.Actor.ClientMessage("Drawing map.");
               MyMod(ViewportOwner.Actor.myHUD).setDrawMap(true);
            }
            else{
               MyMod(ViewportOwner.Actor.myHUD).setDrawMap(false);
            }
        }
        return false;
    }

    So, I start the mod and the first map it loads everything works fine, you press M and it draws the map. Second map loads, it prints "TESTING" so the tick is getting ran, it prints "Initialized" so the interaction gets added, if you press "m" it prints "pressed m", BUT it doesn't draw the map. Load the third map and everything works, load 4th map same as 2nd map, etc. Any ideas why it would do this?

    #2
    Ok.... so I couldn't find the answer when I was looking for it on the forums, but I just found it right after posting while searching for something completly different:

    Code:
    event NotifyLevelChange() {
    	Master.RemoveInteraction(self);
    	MyHUD.Destroy();
    }

    Comment

    Working...
    X