Karel2015 Posted May 26, 2016 Share Posted May 26, 2016 Ok, So basically what I am trying to accomplish, Is that I want every time an effect is triggered, it will add +1 to a global Value. When dispelling the magic effect, it will -1. My mod is set up to allow you to recruit Minutemen. Basically I want it to work as you recruit each Minutemen, You add +1, and set a maximum level so you can only have a certain amount of Minutemen with you at any time. Here's what I have so far for each effect, Now If I put in -1, it works just fine. If I put in say "1-2-3-4" just a number for set value, it works just fine. But there is no way to do +1, So what is the proper format or function to add +1 to the global variable ?Event OnEffectStart(Actor akTarget, Actor akCastor) akTarget.setplayerTeammate(true) akTarget.SetCommandState(true) akTarget.setcandocommand(true) akTarget.AddKeyword(DontUseAmmo) SoldiersRecruited.SetValue(+1)EndEvent Event OnEffectStart(Actor akTarget, Actor akCastor) akTarget.setplayerTeammate(false) akTarget.SetCommandState(false) akTarget.setcandocommand(false) akTarget.RemoveKeyword(DontUseAmmo) SoldiersBuilt.SetValue(-1)EndEvent Link to comment Share on other sites More sharing options...
DarthWayne Posted May 26, 2016 Share Posted May 26, 2016 I think what you want to do is something like this: SoldiersRecruited.setValueInt(SoldiersRecruited.getValueInt() + 1) SoldiersRecruited.setValueInt(SoldiersRecruited.getValueInt() - 1) Link to comment Share on other sites More sharing options...
Karel2015 Posted May 26, 2016 Author Share Posted May 26, 2016 Yes! You are my hero :) haha ty -1 for some reason will work with: SoldiersBuilt.SetValue(-1) but the +1 wouldn't work. Just woke up to your message and you just saved me some time so tyvm! Link to comment Share on other sites More sharing options...
JonathanOstrus Posted May 27, 2016 Share Posted May 27, 2016 Yes! You are my hero :smile: haha ty -1 for some reason will work with: SoldiersBuilt.SetValue(-1) but the +1 wouldn't work. Just woke up to your message and you just saved me some time so tyvm!It's likely that the SetValue(-1) is setting it to absolute "-1" not subtracting 1. Link to comment Share on other sites More sharing options...
Pokepunch Posted May 27, 2016 Share Posted May 27, 2016 (edited) You could also try using Mod instead of SetValue. SoldiersRecruited.Mod(1) SoldiersRecruited.Mod(-1) Edited May 27, 2016 by Pokepunch Link to comment Share on other sites More sharing options...
Recommended Posts