[Solved] Can't seem to cast to Long War classes?
Posted: Sat May 13, 2017 1:36 am
Hey, I'm super new to this so I've probably just messed something up here, but I can't seem to downcast to long war declared classes. Casting to base game classes works fine.
Example!
This causes massive amounts of redscreen errors on startup and a crash when loading a game:
This works fine:
I've noticed this happening in all sorts of cases, this is just the one that I found easiest. Long war IS definitely being loaded, and, while I wouldn't think it would matter, it's definitely being loaded first too. This is the workshop version of Long War 2.
I'm seeing nothing useful at all in the log so I'm kind of at a loss. Help from anyone would be very appreciated if you have a moment.
EDIT: I should also note that for some reason, this class is a bit temperamental and failing in ways the documentation says it should work as well, so it's possible not all is right with the world here. Setting ScreenClass to anything other than `none` causes a failure, and casting anything outside of the `IsA` block also doesn't work well. I have my environment set up as per here: https://www.reddit.com/r/xcom2mods/comm ... ong_war_2/
EDIT2: Okay so I reinstalled the SDK and created a non-lw2 based mod and the problems mentioned in the edit went away so there's almost certainly something wonky going on with my build process here, and perhaps the steps mentioned in the reddit post above might not work quite right. I'll update as I go for documentation, but it no longer looks like a bug with lw2 modding specifically, and more my specific set-up.
EDIT3: It seems the problem comes when I add the unrealengine lines. So I guess the problem is I'm somehow not building my LW2 dependencies correctly?
Example!
This causes massive amounts of redscreen errors on startup and a crash when loading a game:
Code: Select all
class TestScreenListener extends UIScreenListener;
event OnInit(UIScreen screen)
{
local UIOutpostManagement baby;
if(screen.IsA('UIOutpostManagement'))
{
baby = UIOutpostManagement(screen);
}
}
defaultproperties
{
ScreenClass = none;
}
Code: Select all
class TestScreenListener extends UIScreenListener;
event OnInit(UIScreen screen)
{
local UIStrategyMap baby;
if(screen.IsA('UIStrategyMap'))
{
baby = UIStrategyMap(screen);
}
}
defaultproperties
{
ScreenClass = none;
}
I'm seeing nothing useful at all in the log so I'm kind of at a loss. Help from anyone would be very appreciated if you have a moment.
EDIT: I should also note that for some reason, this class is a bit temperamental and failing in ways the documentation says it should work as well, so it's possible not all is right with the world here. Setting ScreenClass to anything other than `none` causes a failure, and casting anything outside of the `IsA` block also doesn't work well. I have my environment set up as per here: https://www.reddit.com/r/xcom2mods/comm ... ong_war_2/
EDIT2: Okay so I reinstalled the SDK and created a non-lw2 based mod and the problems mentioned in the edit went away so there's almost certainly something wonky going on with my build process here, and perhaps the steps mentioned in the reddit post above might not work quite right. I'll update as I go for documentation, but it no longer looks like a bug with lw2 modding specifically, and more my specific set-up.
EDIT3: It seems the problem comes when I add the unrealengine lines. So I guess the problem is I'm somehow not building my LW2 dependencies correctly?