No no no. I have an image that I placed into the HUD through the script. The issue is that it shows over things that it shouldn't. I am wondering if there was a way to force the image to the background without moving the chunk of code to the top of the whole script.Change the position of... The Screen itself? As in.. the game window?
function HudOverlay::AddHudElements(%this)
{
parent::AddHudElements(%this);
// Line 1 message text
%index = %this.addHudElement();
%this.setHudElementPosition(%index, 490, 125);
%this.setHudElementPositionAnchor(%index, "VCenter", "HCenter");
%this.setHudElementScreenAnchor(%index, "Top", "HCenter");
%this.setHudElementBaseTextureSize(%index, 820, 116);
%this.setHudElementColor(%index, 255, 255, 255, 0);
%this.setHudElementParent(%index, $HudElement::BaseContainer);
%this.setHudElementRenderWhenDead(%index, true);
$HudElement::KP1MessageText = %index;
// BG1
%index = %this.AddHudElement();
%this.setHudElementPosition(%index, 490, 125);
%this.setHudElementTexture($HudElement::KP1MessageText, "mods/autoexec/Koncept/BG");
%this.setHudElementParent(%index, $HudElement::BaseContainer);
%this.setHudElementPositionAnchor(%index, "HCenter", "VCenter");
%this.setHudElementRenderWhenDead(%index, true);
//%this.setHudElementDrawRect(%index, true);
$HudOverlay::BackgroundOne = %index;
%this.setHudElementTexture($HudElement::KP1MessageText, "mods/autoexec/Koncept/BG");
Exactly what I can't do. I'm adding a BG to the KillPop script. The second chunk responds to the first chunk so it has to be after it or else it causes some major issues in showing the HUD elements.Uh... You could call it higher up in the script?
What is this for?
%this.setHudElementTexture($HudElement::KP1MessageText, "mods/autoexec/Koncept/BG");
function HudOverlay::AddHudElements(%this)
{
parent::AddHudElements(%this);
// BG1
%index = %this.AddHudElement();
%this.setHudElementPosition(%index, 490, 125);
%this.setHudElementParent(%index, $HudElement::BaseContainer);
%this.setHudElementPositionAnchor(%index, "HCenter", "VCenter");
%this.setHudElementRenderWhenDead(%index, true);
//%this.setHudElementDrawRect(%index, true);
%this.setHudElementTexture(%index, "mods/autoexec/Koncept/BG");
$HudOverlay::BackgroundOne = %index;
// Line 1 message text
%index = %this.addHudElement();
%this.setHudElementPosition(%index, 490, 125);
%this.setHudElementPositionAnchor(%index, "VCenter", "HCenter");
%this.setHudElementScreenAnchor(%index, "Top", "HCenter");
%this.setHudElementBaseTextureSize(%index, 820, 116);
%this.setHudElementColor(%index, 255, 255, 255, 0);
%this.setHudElementParent(%index, $HudElement::BaseContainer);
%this.setHudElementRenderWhenDead(%index, true);
$HudElement::KP1MessageText = %index;
}
That would do it but only one problem. I'm trying to make the background respond to the "Line 1 message text" chunk so when text appears when you kill someone, so does the BG (and disappears when the text goes away). Placing it above that chunk of code causes issues when I want to have it respond to it.Code:function HudOverlay::AddHudElements(%this) { parent::AddHudElements(%this); // BG1 %index = %this.AddHudElement(); %this.setHudElementPosition(%index, 490, 125); %this.setHudElementParent(%index, $HudElement::BaseContainer); %this.setHudElementPositionAnchor(%index, "HCenter", "VCenter"); %this.setHudElementRenderWhenDead(%index, true); //%this.setHudElementDrawRect(%index, true); %this.setHudElementTexture(%index, "mods/autoexec/Koncept/BG"); $HudOverlay::BackgroundOne = %index; // Line 1 message text %index = %this.addHudElement(); %this.setHudElementPosition(%index, 490, 125); %this.setHudElementPositionAnchor(%index, "VCenter", "HCenter"); %this.setHudElementScreenAnchor(%index, "Top", "HCenter"); %this.setHudElementBaseTextureSize(%index, 820, 116); %this.setHudElementColor(%index, 255, 255, 255, 0); %this.setHudElementParent(%index, $HudElement::BaseContainer); %this.setHudElementRenderWhenDead(%index, true); $HudElement::KP1MessageText = %index; }
function FadeInKP1()
{
$KP1act=true;
HudOverlay.AnimateHudElementAlpha($HudElement::KP1MessageText, 255, 0.2);
HudOverlay.AnimateHudElementAlpha($HudElement::BackgroundOne, 255, 0.2);