multiply drop quantity with variable in event

Hello. I'd like to know if I can multiply drop with a variable.


For the idea, I tried that


( Don't pay attention to "RPG::SE" It's just for me to find out if the script runing well in my conditions )


class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# * Create Array of Dropped Items
#--------------------------------------------------------------------------
def make_drop_items
dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items }
if $game_variables[10]==1
RPG::SE.new("Down3", 100, 150).play
r *= 2
else
if $game_variables[10]==2
RPG::SE.new("UP4", 100, 150).play
r *= 3
end
end
end
end


Well I hear the SE, but it crashes at "r*=x" and get a  ( No method) stuff.


EDIT : I dont need a complicated script, just need to controle quantity with a single variable for conditions in troops.


I got time to try more, and this looks to work:


class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# * Create Array of Dropped Items
#--------------------------------------------------------------------------
def make_drop_items
if $game_variables[10]==1
RPG::SE.new("Down3", 100, 150).play
dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items*2 }
else
if $game_variables[10]==2
RPG::SE.new("UP4", 100, 150).play
dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items*3 }
else
dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items }
end
end
end
end


But now, my left wish is to find out how to "exclude" a not desired multiplied item.


DEEPER explaination:


The commun drop item can be multiplied, but not the rare/bonus one.


So, I dont want to see drop like that, if the multiplied is 3:


- Tortule scale x3 (commun) ok


- Cactus needle x3 (commun) ok


- Dragon heart x3 (rare) not ok ! Must be x1


I tried this, but I don't know how to use condition with it ... cause it looks to be already a condition:


class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# * Create Array of Dropped Items
#--------------------------------------------------------------------------
def make_drop_items
if $game_variables[10]==1
dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items*2 }
[12].any? {|i| $game_temp.drops.include?($data_items)}
#Then I wish to remove 1 extra item[12]
RPG::SE.new("Down3", 100, 150).play
else
if $game_variables[10]==2
dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items*3 }
[12].any? {|i| $game_temp.drops.include?($data_items)}
#Then I wish to remove 2 extra item[12]
RPG::SE.new("UP4", 100, 150).play
else
dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items }
end
end
end
end


I also have NoMethodError with "Theolized - Yanfly Engine Ace - Dynamic Victory Aftermath (Addon)


http://theolized.blogspot.ch/2014/01/yea-dynamic-victory-aftermath-addon.html


Line 284


Thank you
Script releases is for finished scripts - and your topic foesn't sound like it is working already...


Depending on what exactly you want, this should probably moved to either "learning RGSS" or to "Scripts in Development" - please state where you want it moved
My bad ! You're right.


Can you TELEPOOOoooooooooooort me to: (RGSSx Script Support) pleeeeeease ?  😉


Thank you and Happy New Year Andar !
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/multiply-drop-quantity-with-variable-in-event.72928/