MtB Posted May 19, 2013 Share Posted May 19, 2013 In its original form this script is flawed. Any time you donated a sum of money, thescript would deduct the funds you donate plus an extra cap. To rectify this error, the script is now written where the amount now taken is one cap less than what is stated in the donations option menu - so instead of paying a flat donation of 10 caps, you pay 9 caps plus the extra one (for a total of 10) that is taken through the flawed script. Also, the script keeps rewarding Karma for the larger donations. The Karma reward should be limited to a one time reward. Can somebody rework the script so that a flat donation of caps is taken rather than what I've explained, and have the Karma reward be a one time deal. Thanks to any replies. ScriptName aaDonationBoxScript Short ButtonShort DoOnce Begin OnActivate Player If ( DoOnce == 0 ) ShowMessage aaDonations01MSG ;See below (end) Set DoOnce to 1 EndIfEnd Begin GameModeSet Button to GetButtonPressed If ( button == 0 ) && Player.GetItemCount Caps001 >=1 Player.RemoveItem Caps001 1 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG ;See below (end) Set DoOnce to 0 EndIfEndIf ElseIf ( Button == 1 ) && ( Player.GetItemCount Caps001 >= 5 ) Player.RemoveItem Caps001 4 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG Set DoOnce to 0 EndIf ElseIf ( Button == 2 ) && ( Player.GetItemCount Caps001 >= 10 ) Player.RemoveItem Caps001 9 Player.RewardKarma 1 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG Set DoOnce to 0EndIf ElseIf ( Button == 3 ) && ( Player.GetItemCount Caps001 >= 25 ) Player.RemoveItem Caps001 24 Player.RewardKarma 2 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG Set DoOnce to 0EndIf ElseIf ( Button == 4 ) && ( Player.GetItemCount Caps001 >= 50 ) Player.RemoveItem Caps001 49 Player.RewardKarma 5 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG Set DoOnce to 0 EndIf ElseIf ( Button == 5 ) Activate Player.RewardKarma -10 Set DoOnce to 0EndIf ElseIf ( Button == 6 ) ;Do Nothing Set DoOnce to 0EndIfEnd ;aaDonations01MSG;How much do you want to donate? ;1, 5, 10, 25, 50, Open the box and take the money!, None. ;aaDonations02MSG;Your donation to the church is greatly received. The destitute of the wastes;thank you. Link to comment Share on other sites More sharing options...
rickerhk Posted May 19, 2013 Share Posted May 19, 2013 You have a couple of extra 'endif's breaking your elseif chain. ScriptName aaDonationBoxScript Short Button Short DoOnce Begin OnActivate Player If ( DoOnce == 0 ) ShowMessage aaDonations01MSG ;See below (end) Set DoOnce to 1 EndIf End Begin GameMode Set Button to GetButtonPressed If ( button == 0 ) && Player.GetItemCount Caps001 >=1 Player.RemoveItem Caps001 1 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG ;See below (end) Set DoOnce to 0 EndIf ;EndIf <-- extra ElseIf ( Button == 1 ) && ( Player.GetItemCount Caps001 >= 5 ) Player.RemoveItem Caps001 4 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG Set DoOnce to 0 EndIf ElseIf ( Button == 2 ) && ( Player.GetItemCount Caps001 >= 10 ) Player.RemoveItem Caps001 9 Player.RewardKarma 1 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG Set DoOnce to 0 EndIf ElseIf ( Button == 3 ) && ( Player.GetItemCount Caps001 >= 25 ) Player.RemoveItem Caps001 24 Player.RewardKarma 2 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG Set DoOnce to 0 EndIf ElseIf ( Button == 4 ) && ( Player.GetItemCount Caps001 >= 50 ) Player.RemoveItem Caps001 49 Player.RewardKarma 5 If ( DoOnce == 1 ) ShowMessage aaDonations02MSG Set DoOnce to 0 EndIf ElseIf ( Button == 5 ) Activate Player.RewardKarma -10 Set DoOnce to 0 ;EndIf <--extra ElseIf ( Button == 6 ) ;Do Nothing Set DoOnce to 0 EndIf End ;aaDonations01MSG ;How much do you want to donate? ;1, 5, 10, 25, 50, Open the box and take the money!, None. ;aaDonations02MSG ;Your donation to the church is greatly received. The destitute of the wastes ;thank you. Link to comment Share on other sites More sharing options...
MtB Posted May 20, 2013 Author Share Posted May 20, 2013 Thanks for the reply rickerhk, however, the script you suggest (with the extra endifs removed) has the same result. An extra 1 cap is removed after the donated amount is deducted, and the karma award can be obtained multiple times. Link to comment Share on other sites More sharing options...
Belthan Posted May 21, 2013 Share Posted May 21, 2013 (edited) Do you have conditions on the donate buttons in the message that check for the appropriate number of caps? That way the users wouldn't even see the options they can't afford, and it would let you simplify the script like so: EDIT: Realized the first version I posted still allowed multiple Karma awards. This version will let the player donate as often as they like, but they will only get the Karma award (or penalty) once. ScriptName aaDonationBoxScript Short Button Short DoOnce Short AwaitingInput Short KarmaPoints Begin OnActivate Player ; If ( DoOnce == 0 ) <-- Uncomment this line if player can only activate once ShowMessage aaDonations01MSG ;See below (end) Set AwaitingInput to 1 ; EndIf <-- Uncomment this line if player can only activate once End Begin GameMode If (AwaitingInput == 1) Set Button to GetButtonPressed If (Button > -1) set AwaitingInput to 0 set KarmaPoints to 0 If ( button == 0 ) Player.RemoveItem Caps001 1 ShowMessage aaDonations02MSG ;See below (end) ElseIf ( Button == 1 ) Player.RemoveItem Caps001 5 ShowMessage aaDonations02MSG ;See below (end) ElseIf ( Button == 2 ) Player.RemoveItem Caps001 10 set KarmaPoints to 1 ShowMessage aaDonations02MSG ;See below (end) ElseIf ( Button == 3 ) Player.RemoveItem Caps001 25 set KarmaPoints to 2 ShowMessage aaDonations02MSG ;See below (end) ElseIf ( Button == 4 ) Player.RemoveItem Caps001 50 set KarmaPoints to 5 ShowMessage aaDonations02MSG ;See below (end) ElseIf ( Button == 5 ) set KarmaPoints to -10 Activate EndIf If (DoOnce == 0) && (KarmaPoints != 0) Player.RewardKarma KarmaPoints set DoOnce to 1 Endif Endif End ;aaDonations01MSG ;How much do you want to donate? ;1, 5, 10, 25, 50, Open the box and take the money!, None. ;aaDonations02MSG ;Your donation to the church is greatly received. The destitute of the wastes ;thank you. Edited May 21, 2013 by Belthan Link to comment Share on other sites More sharing options...
Recommended Posts