Hey!
I'm hoping someone a bit more logical and script-savvy will be able to help me out with something. I know what I want to do, but don't know to go about it properly...
The gist is : My Mod adds a new 'Magic' which is inside the Player (plot wise). As time passes, the Magic grows stronger, and will periodically result in one of two events: Either the Player will gain a new Perk, or they will gain the next version of a Perk they already have. All the Perks are added by my Mod.
So for example, we have Perk A:1, Perk A:2, Perk B:1 and Perk B:2. The Player has Perk B:1. When the next update occurs, they can either gain Perk B:2, or Perk A:1.
Here's a rough code I put together, untested/checked, but it should explain what I'm trying to do:
If ( PerkUnlock >= 1 ) WhichOption = Utility.RandomInt(1, 100) If ( WhichOption <= 30 ) WhichPerk = Utility.RandomInt(1, 100) If ( WhichPerk <= 33 ) If ( PlayerRef.HasPerk(ZCDMDECloudGiftPerk01) == 0 ) PlayerRef.AddPerk(ZCDMDECloudGiftPerk01) PerkUnlock = ( PerkUnlock - 1 ) EndIf ElseIf ( WhichPerk <= 66 ) If ( PlayerRef.HasPerk(ZCDMDEFireGiftPerk01) == 0 ) PlayerRef.AddPerk(ZCDMDEFireGiftPerk01) PerkUnlock = ( PerkUnlock - 1 ) EndIf ElseIf ( WhichPerk <= 100 ) If ( PlayerRef.HasPerk(ZCDMDETimeGiftPerk01) == 0 ) PlayerRef.AddPerk(ZCDMDETimeGiftPerk01) PerkUnlock = ( PerkUnlock - 1 ) EndIf EndIf ElseIf ( WhichOption > 30 ) If ( PlayerRef.HasPerk(ZCDMDECloudGiftPerk01) == 1 ) PlayerRef.AddPerk(ZCDMDECloudGiftPerk02) PerkUnlock = ( PerkUnlock - 1 ) ElseIf ( PlayerRef.HasPerk(ZCDMDECloudGiftPerk02) == 1 ) PlayerRef.AddPerk(ZCDMDECloudGiftPerk03) PerkUnlock = ( PerkUnlock - 1 ) ElseIf ( PlayerRef.HasPerk(ZCDMDECloudGiftPerk01) == 1 ) PlayerRef.AddPerk(ZCDMDECloudGiftPerk02) PerkUnlock = ( PerkUnlock - 1 ) ElseIf ( PlayerRef.HasPerk(ZCDMDECloudGiftPerk02) == 1 ) PlayerRef.AddPerk(ZCDMDECloudGiftPerk03) PerkUnlock = ( PerkUnlock - 1 ) ElseIf ( PlayerRef.HasPerk(ZCDMDETimeGiftPerk01) == 1 ) PlayerRef.AddPerk(ZCDMDETimeGiftPerk02) PerkUnlock = ( PerkUnlock - 1 ) ElseIf ( PlayerRef.HasPerk(ZCDMDETimeGiftPerk02) == 1 ) PlayerRef.AddPerk(ZCDMDETimeGiftPerk03) PerkUnlock = ( PerkUnlock - 1 ) Else WhichOption = 1 EndIf EndIfEndIf
What I'm having trouble with is randomising which Perk gets enhanced, and still keeping it able to check through every Perk the player might have. Fr now, I have it just go through in order, but that's not really suitable for what I want to happen in-game... If anyone could help, that would be great.
I would also like to maybe be able to 'weight' certain Perks, so that they have a higher chance of being enhanced over other Perks.