Jump to content

perk checking


azxeus

Recommended Posts

okay, you were right putting the check in getperkinclasstree wasnt the best choice, but something you said gave me a great idea, m_arrRandomPerks isn't being used in non-TR games so i could use that to store the perktree, so the game knows which perks i had before i got my perk tree and which were assigned after.

i've almost finished implementing this but for some reason the game crashes if i try to alter what is going into the m_arrRandomPerks and i just can't figure out why the only clue i have is this weird thing appearing in the log

[0040.00] ScriptWarning: Accessed array 'XGStrategySoldier_7.m_arrRandomPerks' out of bounds (3/0)
XGStrategySoldier Command1.TheWorld:PersistentLevel.XGStrategySoldier_7
Function XComStrategyGame.XGStrategySoldier:GetPerkInClassTree:00DA

 

 

which is strange because i never altered how getperkinclasstree accesses m_RandomPerks apart from that it now does so in non-TR games also

 

EDIT: no.. that's not causing the crash.. there are more of them further up. i really have no idea

Edited by azxeus
Link to comment
Share on other sites

ePerk is an array of perk enum values, but GetPerk() in the perk manager returns a TPerk struct. You just need to use ePerk[0] = (byte)71 if you always want to force it to be that perk.

 

But bear in mind that you can re-roll that same perk again, and wind up with 71 in the tree more than once. You might want to actually put the check in IsRandomPerkValidToAdd(). e.g. after the check for m_arrRandomPerks.Find(Perk) != -1 {} add :

 

if (HasPerk(Perk)) return false;

Link to comment
Share on other sites

yeah, (byte)71 is what i tried in the first place and that crashes the game too, i really don't know why.. since 71 is mind control and shouldnt appear in the normal perk tree i was going to remove it in getperkinclasstree but i cant get it to work at all..

i already have if (HasPerk(Perk)) return false; in the israndomperkvalidtoadd as the training roulette version of this mod, was much easier than what you suggested xD

Edited by azxeus
Link to comment
Share on other sites

OKAY NEVERMIND

 

looks like i had 14 (LetBool) instead of 0F (Let) for my = ...

NO WONDER IT WASN'T WORKING!

 

I feel like such an idiot, i've been looking at this scratching my head trying to figure out why it was crashing for days.. sigh

well the mod is finished now haha, i just replace it with 0 and it removes the perk, i'll post the link here once i have it up

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...