XCOM 2
Second Wave Reborn
 This topic has been pinned, so it's probably important
EladDv  [developer] 15 Feb, 2016 @ 4:34pm
Q&A and Tutorials
This is the place to ask for instructions, help with the features and ini edit and whatever else comes to your mind (as long as it's not concerned with the other 2 discussions- that's just a waste of time and you should put it there)
< >
Showing 1-15 of 42 comments
Mertius 16 Feb, 2016 @ 1:35pm 
Hi there! I'm sorry to bother you, but as the Mod creator I was hoping to get your help, well, modding your mod. I too was trying to make a Second Wave Reborn mod (albeit, it's now Second Wave Revitalized, so I don't have to ruin the "SWR" theme I have with the other mods :P), and had done a few small ini tweak-based mods, until I got stuck on Not Created Equally because of the unreal scripting. I tried my hand at it, but ended up with a mess of code trying to piggyback off a modified rankup. Then I saw your code, which appeared vastly superior.

That said, I was hoping to strip down your code into a more "vanilla" state, taking out Red Fog and some of the newer stat boosts. I tend to prefer modular over total conversion, and boosts only to the main stats like offense, mobility, will, and hacking (since hacking, while new, can be balanced around the median 5). Anyway, I changed the SecondWave script and .ini files around to use fewer stats and ignore redfog, and also to implement the old "Rollstat" function, but now I'm stuck with the listener. The way I understand it, it currently polls history for every statechange in "unit" whenever a new screen is initialized or focused, correct? Then, after, it checks the stats of the unit and if needed randomizes them? I was wondering if that could be refined to only notice on unit creation, removing some of the need for double checking, and some of the lag that'd be caused by checking each screen. (If I'm understanding correctly, which may not be true since I'm crud a scripting....)

Also, did you need to initialize in DownloadableContentInfo to get it running?
Thanks for any help, and again, sorry to bother you!
Mertius 16 Feb, 2016 @ 1:41pm 
Oh, also, I saw you over on Hidden Potential. One of the first mods I tried to make was that (was beaten to the punch. It's getting to be a habit... ) and I can assure you that the only way I've seen it implemented is through ini tweaking for abusing astatprogression. Basically, astatprogression has spots for randstatamount and capstatamount since Will is already random (betweeen 4-12), which means you can tweak the ini dealing with rankups (XComClassData) to make every rank give a random stat amount alongside the basic statamount. RandStatAmount[0 -> (x-1)]

Anyway, since it's just an Ini tweak, nothing currently exists that lets you turn it off if the mod is installed. If you were to implement it the same way in your mod, it would need to be always on.
EladDv  [developer] 16 Feb, 2016 @ 1:47pm 
Well it's nice to see other modders getting at my code, i decided to not override the vanilla code since it's a pain to get reliably working, what i did was get the UI listener to look through each unit and get it's stats and then compare it to see if it's a stock rookie, if it is then you want to randomize it, now because i am filtering them out with if commands the filters are quite efficiant and really even at 50-100 troops it'd take a little time to filter them. it could be on unit creation but overriding vanilla classes as i said is trickey right now, about the DCI - no i didnt really need to initilize it there since the listener is called upon automatically,it's also not checking each screen but only the avengerHUD screen which is called mainly on the actual startegy layer.

My mod is modular and that is my goal- to provide everything you want but keep them as seperate as i can, i try to minimize bulk of mods and intercompatibility problems along with the hassle of getting multiple mods maintained and looked after.

I'd love to see your code sometime,
Sincerely EladDv
EladDv  [developer] 16 Feb, 2016 @ 1:50pm 
That's why i am looking at way of getting it in code Mertius, after i finish fixing Red fog(...) i have a couple of ideas i'd like to implement
Last edited by EladDv; 16 Feb, 2016 @ 2:39pm
Mertius 16 Feb, 2016 @ 2:31pm 
Hmm, ok. I'll have to take a look, since It's still not quite listening properly since I removed some pieces. I thought I'd only removed RedFog related items, but I must have pulled something else out. As for doing it straight out of creation, I was hoping I could manage it without needing to rewrite scripts...hmm. Alright, I'll take another look.

As for modular, I mean it more in the sense of "these four mods work together, and are meant to be installed together, but in no way have to be." It's just easier (personally, for me) to do it at the startup screen rather than ini. Although, now that I think about it, it would be nice to turn off functionality while the mod remains installed...

As for my original code, it was pretty crappy. I was just trying to trick the game into considering rookie a rank that recieved a rankup, then modify the rankup for that level to actually use the old rollstat function. Theoretically, it should have worked, but wasn't triggering properly, leaving my troops with zero across the board (I set stats to 0 for testing). In the end, your code was far more intuitive, and actually had a history of working, so I just started cutting away at the redfog stuff and "excess" stats, and then implemented the old rollstat. (It's kind of nice because by not using your point system, you could get supersoldiers or plain terrible soldiers like in EW. Plus, adjustable intervals per stat). Honestly, the code at this point looks pretty similar, save for a changed class name or how/what it actually rolls. Now I just need it to actually do it's job. :P

And good luck with getting hidden potential into the actual code. I'm ok with the ini tweak, but the ability to turn off functionality while the mod remains installed could be really nice. That, plus I swear I never get my max rolls....obviously a bug of the current implementation. XD
EladDv  [developer] 16 Feb, 2016 @ 2:41pm 
Yeah You probably pulled something out that wasnt meant to be but really the only thing connecting redfog and NCE is the UI listener, as long as you dont take out a vital part of the "NCE" class it'll function correctly, basically you just want to do a Unit.SetMaxBaseStat and Unit.SetCurrentStat together to the same value or it'll be weird
kairoradeus 16 Feb, 2016 @ 3:20pm 
Im trying to tweak out my rookie stats with NCE (like the aim range being 60-80) but im at a loss at what the COST line is for each stat? I mean, High and Low thats self explanetory... but im confused at that COST line.
EladDv  [developer] 16 Feb, 2016 @ 3:23pm 
each stat has a cost per stat above the LOW. At the end it is all gathered up and compared to the points stat in the ini file and the tolarance, so if you have 90 points and 10 tol it would accept soldiers with a number of points "spent" on the stats between 80-100
Mertius 16 Feb, 2016 @ 3:38pm 
I'm pretty sure I'm screwing something up with the listener...

The NCE class should be fine. I just cut it down a little. It should work. :/
class XComGameState_NCE extends Object Config(NCE);


//--------------- NCE Vars-----------------------------------

var Object SelfObject;
var int ValuesFromINI[9];
//----------- Config Vars------------------------------------
var config int Offense_high;
var config int Offense_low;
var config int Offense_Int;
var config int Mobility_high;
var config int Mobility_low;
var config int Mobility_Int;
var config int Will_high;
var config int Will_low;
var config int Will_Int;
var config int Hacking_high;
var config int Hacking_low;
var config int Hacking_Int;

function RandomStats(XComGameState_Unit Soldier)
{
local int Interval[4];
local int vfiLength; //Number of Values from InI
local array<int> RandomStats;
local int i;
local int currentStat;

Interval[0]=Offense_Int;
Interval[2]=Mobility_Int;
Interval[4]=Will_Int;
Interval[6]=Hacking_Int;

ValuesFromINI[0]=Offense_high;
ValuesFromINI[1]=Offense_low;
ValuesFromINI[2]=Mobility_high;
ValuesFromINI[3]=Mobility_low;
ValuesFromINI[4]=Will_high;
ValuesFromINI[5]=Will_low;
ValuesFromINI[6]=Hacking_high;
ValuesFromINI[7]=Hacking_low;

vfiLength=9;

for(i=0;i<vfiLength;i=i+2)
{
currentStat= EWRollStat( ValuesFromINI[i+1], ValuesFromINI, Interval );
RandomStats.addItem(currentStat);
}


Soldier.setBaseMaxStat(eStat_Offense,RandomStats[0]);
Soldier.setBaseMaxStat(eStat_Mobility,RandomStats[1]);
Soldier.setBaseMaxStat(eStat_Will,RandomStats[2]);
Soldier.setBaseMaxStat(eStat_Hacking,RandomStats[3]);

Soldier.setCurrentStat(eStat_Offense,RandomStats[0]);
Soldier.setCurrentStat(eStat_Mobility,RandomStats[1]);
Soldier.setCurrentStat(eStat_Will,RandomStats[2]);
Soldier.setCurrentStat(eStat_Hacking,RandomStats[3]);
}

function int EWRollStat( int iLow, int iHigh, int iMultiple )
{
local int iSpread, iNewStat;

iSpread = iHigh - iLow;

iNewStat = iLow + `SYNC_RAND( iSpread/iMultiple + 1 ) * iMultiple;

if( iNewStat == iHigh && `SYNC_RAND(2) == 0 )
iNewStat += iMultiple;

return iNewStat;
}

with the .ini as

[SWRNotCreatedEqual.XComGameState_NCE]

; Vanilla: eStat_Offense=65
; Vanilla: eStat_Mobility=12
; Vanilla: eStat_Will=40
; Vanilla: eStat_Hacking=5

Offense_high=80 ;Wiki range.
Offense_low=50
Offense_Int=5
Mobility_high=14 ;given a little extra range, closer to LW.
Mobility_low=10
Mobility_Int=1
Will_high=51 ;Should fall in the traditional 26-50 range from EW.
Will_low=25
Will_Int=2
Hacking_high=10 ;Median falls at base 5.
Hacking_low=0
Hacking_Int=5

See, really familiar, right? It's pretty much the same thing since I cut out all my code. They should work so long as their called, hence why I'm trying to fiddle with the listener.
Mertius 16 Feb, 2016 @ 3:47pm 
Oh, and the hasabnormalstats is left out on purpose this time. I've been trying to tweak it from character creation. However, I did try it with the base listener, with and without abstats, and with those checks set to regular basestats and my test stats of 0.
EladDv  [developer] 16 Feb, 2016 @ 3:58pm 
The HasAbnormalStats is a check for the reset switch i put in as a quick and dirty fix, but i guess it could work as filter. Honestly the current class for the UIListener is the only one i identified to get foucsed when i needed it to- that means on the main base screen,rookie recruit screen and getting soldier gifts. The Interval[4] and Interval[6] values are wrong, you defined an array with 4 slots, you should put them in 0-3, VfiLength should be 8(or you'll encounter null values) and you are passing arrays into the EWrollStats for no reason and that's probably breaking it because you are treating them like single int objects. that's about everything i see wrong but it's late so there might be some more stuff there.

You might want to come to
http://forums.nexusmods.com/index.php?/forum/3615-xcom-2-mod-talk/
me and a lot of great modders are there and they will always be happy to help, here it's not really optimal
Last edited by EladDv; 16 Feb, 2016 @ 3:58pm
Mertius 16 Feb, 2016 @ 4:48pm 
Thanks for the catch on the vfi length and interval. I switched interval over to [i/2] so that the array just went 0-3. As for EW rollstats, it should still interpret the arrays to my (admittedly poor) knowledge, although I guess I could just do it directly....Hmm.

I'll check out the Nexus forums while I'm at it. Thanks again for all the help.
Mertius 16 Feb, 2016 @ 7:12pm 
Hah! Got it working! Strangely enough, the DCI needed to be updated, since I was running it in debug strategy, which required it to initialize. Although, this raised a bug concern, and I was wondering if you had encountered the same issue.

Does your Reborn mod normally compensate for spawning squaddies? As in, if you get a squaddie from a quest reward or recruitment, does it upgrade from base stats or from random. Right now, I'm spawning from base stats, and I just thought I'd ask.

Ok, now back to trying to listen for char creation. :P
Mertius 17 Feb, 2016 @ 12:35pm 
Hey, sorry for spamming your thread, but I wanted to say thanks again for the help! The mod for you mod is now officially up, offering vanilla EW Randomstats for sticklers like me. XD
EladDv  [developer] 17 Feb, 2016 @ 1:16pm 
Hey hey no problem. If you have any questions come to me and I'll try to help as best as I can
< >
Showing 1-15 of 42 comments
Per page: 1530 50