-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Rock Smash Gives Items
This code give you items when you rock smash a breakable rock.
This code is based on resetes12's Modern Emerald, source.
Full credit goes to them.
You can have as many or as few items as you want, just add or remove lines from after the random line, and depending how "rewarding" or "cruel" you want to be, change the random number to low or high.
An example for the six evolution stones below would be:
6 -> every rock smash would give an item
30 -> 1 in 5 chance
60 -> 1 in 10 chance
120 -> 1 in 20 chance
600 -> 1 in 100 chance
replace all of section EventScript_EndSmash (at line 98) with
// 1 in 5 chance of receiving an item
random 30
call_if_eq VAR_RESULT, 1, EventScript_RockSmashItem1
call_if_eq VAR_RESULT, 2, EventScript_RockSmashItem2
call_if_eq VAR_RESULT, 3, EventScript_RockSmashItem3
call_if_eq VAR_RESULT, 4, EventScript_RockSmashItem4
call_if_eq VAR_RESULT, 5, EventScript_RockSmashItem5
call_if_eq VAR_RESULT, 6, EventScript_RockSmashItem6
releaseall
end
EventScript_RockSmashItem1::
giveitem ITEM_SUN_STONE
return
EventScript_RockSmashItem2::
giveitem ITEM_MOON_STONE
return
EventScript_RockSmashItem3::
giveitem ITEM_FIRE_STONE
return
EventScript_RockSmashItem4::
giveitem ITEM_THUNDER_STONE
return
EventScript_RockSmashItem5::
giveitem ITEM_WATER_STONE
return
EventScript_RockSmashItem6::
giveitem ITEM_LEAF_STONE
return
you could also stack the random's to have different items at different odds
example:
random 50
call_if_eq VAR_RESULT, 1, EventScript_RockSmashItem1
call_if_eq VAR_RESULT, 2, EventScript_RockSmashItem2
random 30
call_if_eq VAR_RESULT, 3, EventScript_RockSmashItem3
call_if_eq VAR_RESULT, 4, EventScript_RockSmashItem4
call_if_eq VAR_RESULT, 5, EventScript_RockSmashItem5
call_if_eq VAR_RESULT, 6, EventScript_RockSmashItem6
this would give a 1 in 50 chance to get a Sun Stone or a Moon Stone, then a 1 in 30 chance to get the other stones.
You could adapt this code to give items (eg berries) when Trees are cut down by changing the above code and adding to
EventScript_CutTreeDowninstead.