[RMXP]Blizzard's Multi-Drop - conditional drop [solved]

Started by DreamCatcher, August 08, 2012, 03:34:05 pm

Previous topic - Next topic

DreamCatcher

August 08, 2012, 03:34:05 pm Last Edit: August 12, 2012, 03:33:56 am by DreamCatcher
Hi folks.
Besides some other unrelated scripts, i use Blizz' Tons of Addons with Multi-Drop.
I want to fill my game with some typical sidequest รก la "go there, slay them and find it".
What I know would like to have is the following:
Monster 21 drops item 1 with a probability of 5%. (To make it easier, i stay with 1 item)
After obtaining item 1 once, it shouldn't be dropped again.
A parallel event will set a variable to 3, when the item is found (meaning, that the quest is completed).
I already thought about defining a variable (e.g. questx) depending on the game_variable and thus just to change the item ID
=> After obtaining the quest-item another item can be dropped instead of it
e.g.
if $game_variables[0107] == 2 (whereby 2 means that the quest is active)
questx = 1
else
questx = 2
end
when 21 then return [[1,questx,5]]
(since if and when are not combinable in one argument - at least this is my impression as a rookie)

What i get is this: no implicit conversion from nil to integer
i tried stuff like
when 21 then return [[1,questx.to_i,5]]
but then it is ignoring the whole drop completely (of course i test it with a prob. of 100%)

Of course, there would be other ways to compass this for example by counting the number of killed mobs and adding the item to the inventory after battle if the number of killed mobs is equal to a random number.
However, that would mean another parallel processing event and some in-fight events and i suggest that there is a much more elegant solution to it.
I hope, one of you can help me with it!

Edit: Now figured out a way how it works:
For each conditional drop, i don't have to define the when only but the case
=>
case id
when ID then return [[TYPE,ITEM-ID,PROB]]      (This would be the normal drop-list for all mobs except from those with conditional drops)
end
if $game_variables[xxxx] == x
case id
when ID then return [[TYPE,ITEM-ID,PROB]]
end
else
case id
when ID then return [[TYPE,ITEM-ID,PROB]]
end
end