Jump to content

What am I doing wrong? (Everything) SetMaterial, Finding Actors and other woes.


Synthorange

Recommended Posts

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Sorry, I was halfway through replying, then had to run out for lunch - lucky I didn't, because I was going to wonder aloud how it could possibly be messing with it, but it was, so that's good. I guess maybe the UIAvengerHUD is fired the moment it lands, so it's getting confused because of that. It's when you enter the avenger, so that absolutely makes sense. Sorry for the false trail.

 

Keep us posted on how it's going!

Edited by zingfharn
Link to comment
Share on other sites

Will do. Thanks for all the help, knowing how to call other classes properly from another was the biggest piece of the puzzle. The rest is a lot of reloading and troubleshooting. :c

 

Now I've got to figure out why the hell the number and designations of skyrangers keeps changing. :wallbash:

Link to comment
Share on other sites

http://images.akamai.steamusercontent.com/ugc/530670181241561890/B011399B2A5AD961CBA0291ACD736E391EF6F118/

 

Well that's a sign that it's working. Unfortunately it's only partially working. The game keeps spawning and despawning Skyrangers so I usually end up with an unskinned one inside the battlescape. This is pretty damn frustrating.

 

In addition I broke stuff again and it's hanging on load/return to the Avenger again, despite me using the Armory Screen this time. Ugh what the hell is going on.

Link to comment
Share on other sites

Yeah I cant figure it out. Well actually I found what's causing the hangs, but I've no idea what's behind the weird behavior.

class UISL_AwesomeSkyranger extends UIScreenListener;
var Skyranger_Customizer Sky;
var SkeletalMeshActor Sky1, Sky2, Sky3;
var UIPersonnel SkyAvengerScreen;
var UIButton SkyrangerSkinnerButton;
var bool Skyassigncheck;


delegate OnClickedDelegate(UIButton Button);

const BUTTON_FONT_SIZE		= 26;
const BUTTON_HEIGHT			= 34;

event OnInit(UIScreen Screen)
{
	Sky = Screen.Movie.Pres.Spawn(class'Skyranger_Customizer');
	Sky.RangerSkin();
	Sky.Destroy();
/*
		Sky = Screen.Movie.Pres.Spawn(class'Skyranger_Customizer');
		SkyAvengerScreen = UIPersonnel(Screen);
		SkyrangerSkinnerButton = CreateButton(SkyAvengerScreen, 'SkyrangerSkinButton', "Skin Skyrangers", ReskinSkyrangers, class'UIUtilities'.const.ANCHOR_BOTTOM_LEFT, 200, -50);

*/
}

function ReskinSkyrangers(UIButton Button)
{

	`log("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
	`log("Button pressed, beginning skinning");
	`log("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
	Sky.RangerSkin();
}

simulated function UIButton CreateButton(UIScreen Screen, name ButtonName, string ButtonLabel, delegate<OnClickedDelegate> OnClickCallThis, int AnchorPos, int XOffset, int YOffset)
{
	local UIButton NewButton;

	NewButton = Screen.Spawn(class'UIButton', Screen);
	NewButton.InitButton(ButtonName, class'UIUtilities_Text'.static.GetSizedText(ButtonLabel, BUTTON_FONT_SIZE), OnClickCallThis);
	NewButton.SetAnchor(AnchorPos);
	NewButton.SetPosition(XOffset, YOffset);
	NewButton.SetSize(NewButton.Width, BUTTON_HEIGHT);
	
	return NewButton;
}

defaultproperties
{
	ScreenClass = UIPersonnel;

}

The stuff inside the large comment block on the OnInit is the code that makes it crash. I cleaned up the other half to handle all the searching and reskinning for the skyrangers.

 

Apparently it doesnt persist through saves either. Saving and reloading reverts the skyranger skin. Ugh.

 

edit: Well poop. Looks like 'Sky.Destroy();' is kind of vital to the game not crashing on loading / return to avenger.

 

So major hurdles:

Crashing - Found out why, dont know why.

Save persistence - Not good news.

Skyrangers getting shuffled/destryoed/recreated - The only method that works consistently is setting the screen listener to grab every screen and run the change function. what a pain!

Edited by Synthorange
Link to comment
Share on other sites

Ugh, tying it to a button and changing the ranger skins once doesnt persist at all. It seems that every time you move from the avenger to battle and from battle to the avenger, new skyrangers are created. Goddam am I going to have to have a screenlistener active at every stage?

Link to comment
Share on other sites

Hello hello. Let me catch up here a second.

 

Yeah, that's why I suggested using UIAvengerHud, because it's the first thing most players see, and they don't have to click elsewhere. But if it's crashing it..

 

What you can do is this:

if(Sky == None) { Sky = Screen.Movie.Pres.Spawn(class'Skyranger_Customizer'); }
Sky.RangerSkin();

and then drop the destroy entirely. Just remove it. That'll only assign a new Sky object if it needs to. Thinking about it, that's a better approach, sorry. That might also help with the whole persistence thing.

 

Try that and let me know.

Link to comment
Share on other sites

I tried that exact same thing trying to fix it. Unfortunately that's what led me to the conclusion that I have to destroy it. With that, it'll crash. If I do destroy it after every use, everything works fine. The UIAvengerHUD is fine, I was drawing the wrong conclusion by fixing a few things at the same time.

 

Hm, so am I going to need to set up a new template or add to a template to store info about the skyranger skin so that it'll persist between saves, and make it change the skin everytime a new skin shows up? I'm thinking that is the case. Unless there's a better way to handle 'global variables' between saves?

Link to comment
Share on other sites

Well, as I understand it (and I could be wrong, so please correct me if I am) by injecting stuff through a screenlistener, it's only until something else overrides it. If the Skyranger object is constantly being reset, then it seems like maybe you need to find out what's creating the new ones, and hit it there.

Link to comment
Share on other sites

My current best guess is that whenever a new map is loaded, the skyranger actor is replaced by the version in the map. They all share the same name though which makes tracking stuff an issue. From the code it looks like the base game still does the 'search all actors for the skyranger' when it's trying to find it to attach animations, origin points etc from so it's non-persistent.

 

I wouldnt need to call it on every screen though, just once on the Avenger screen, and once for the battle screen. I guess I need to make a new class and set that one to (ScreenClass = UIBattle;) ?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...