This seems really straightforward, but something isn't working and its driving me crazy. Take a look at the script below. This is a (simplified) version of a script in my game.
Essentially, there is a 1/5 chance that the PC finds the "vibro" item. Then there is a 1/5 chance that the PC finds the "adrenal" item instead.
If either item is found, the "rewardnum" becomes 100 or 101. Then a text box should display. However, the script is not working. No matter how many times I run it, the PC never finds the item.
plotscript, chest1, begin
###Declare variable###
variable (rewardnum)
variable (specialnum)
###chest to find items###
if (check tag (tag:vibro) == off) then (
specialnum := random (1,5)
if (specialnum == 1) then (rewardnum := 100)
) if (check tag (tag:adrenal) == off) then (
specialnum := random (1,5)
if (specialnum == 1) then (rewardnum := 101)
)
###items find###
) if (rewardnum == 100) then (
show text box (850)
get item (item:vibro, 1)
set default weapon (0,item:vibro)
) else if (rewardnum == 101) then (
show text box (1000)
set default weapon (0,item:adrenal)
force equip (0,slot:head,item:adrenal)
get item (item:adrenal, 1)
)
end
###items find###
) if (rewardnum == 100) then (
code][/quote]
I think the problem is right there. That ) is extra, and might be ending the whole script before it gets to the rest of the stuff.
EDIT: Tried to compile it that way and it wouldn't compile... could it be that the ForceEquip is throwing you? The item appearing in the hero's equipment rather than on the inventory screen? Other than that, I'm totally lost.
Last edited by Gizmog on Sat Nov 21, 2015 3:28 am, edited 1 time in total.
I made this way too confusing for you guys. I tried to edit out the parts of the script that had nothing to do what I was trying to explain. The actual script about 100 lines long.
However, in doing so, I edited out the part where the error actually was. I found the bug while I was trying to figure out a response to you. So, inadvertently, you helped me after all.