I am making an ABS first off. The battles take place on the actual map, not in a zoomed screen. I wanted to add status effects (States) to my weapons. After many attempts, I realized you cannot equip a weapon and it automatically inflict you outside of a battle. Even still, within a battle the affliction only works on enemies, not on a character.
I wrote a script (Probably the crappiest script anyone has ever seen) to fix my issue. It is as follows...
$game_party.actors[0].remove_state(30)
$game_party.actors[0].remove_state(31)
$game_party.actors[0].remove_state(32)
$game_party.actors[0].remove_state(33)
# Below is for Spear
if $game_party.actors[0].weapon_id == 1
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 2
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 3
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 4
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 5
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 6
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 7
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 8
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 9
$game_party.actors[0].add_state(30)
end
# Below is for knife
if $game_party.actors[0].weapon_id == 11
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 12
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 13
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 14
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 15
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 16
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 17
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 18
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 19
$game_party.actors[0].add_state(31)
end
# Below is for club
if $game_party.actors[0].weapon_id == 21
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 22
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 23
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 24
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 25
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 26
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 27
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 28
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 29
$game_party.actors[0].add_state(32)
end
# Below is for Creator
if $game_party.actors[0].weapon_id == 31
$game_party.actors[0].add_state(33)
end
A quick explanation... There are 3 weapon types. Spears, Knives and Clubs. There are nine of each type (Meaning 9 spears, 9 knives and 9 clubs). The one at the very end of the code called "Creator" is just something extra I threw in for testing purposes.
I tagged this code into Scene_Equip here...
# If C button was pressed
if Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Get currently selected data on the item window
item = @item_window.item
# Change equipment
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
----------> HERE!!!!!!!!!!!!!! <----------
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Remake right window and item window contents
@right_window.refresh
@item_window.refresh
return
end
end
end
The final product is as follows...
# If C button was pressed
if Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Get currently selected data on the item window
item = @item_window.item
# Change equipment
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
$game_party.actors[0].remove_state(30)
$game_party.actors[0].remove_state(31)
$game_party.actors[0].remove_state(32)
$game_party.actors[0].remove_state(33)
# Below is for Spear
if $game_party.actors[0].weapon_id == 1
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 2
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 3
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 4
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 5
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 6
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 7
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 8
$game_party.actors[0].add_state(30)
end
if $game_party.actors[0].weapon_id == 9
$game_party.actors[0].add_state(30)
end
# Below is for knife
if $game_party.actors[0].weapon_id == 11
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 12
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 13
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 14
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 15
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 16
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 17
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 18
$game_party.actors[0].add_state(31)
end
if $game_party.actors[0].weapon_id == 19
$game_party.actors[0].add_state(31)
end
# Below is for club
if $game_party.actors[0].weapon_id == 21
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 22
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 23
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 24
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 25
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 26
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 27
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 28
$game_party.actors[0].add_state(32)
end
if $game_party.actors[0].weapon_id == 29
$game_party.actors[0].add_state(32)
end
# Below is for Creator
if $game_party.actors[0].weapon_id == 31
$game_party.actors[0].add_state(33)
end
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Remake right window and item window contents
@right_window.refresh
@item_window.refresh
return
end
end
end
When I enter my game now, I can equip any weapon and become afflicted with whatever I want. I control what the status effect does from a common event.
My problem is that I originally wanted this script in its own window above MAIN, so that it can be called upon from Scene_Equip instead of a huge amount of crappy code tagged in there lol. I have no clue how to go about that as I am a complete newb to scripting. Making even what I have was a miracle enough. If anyone can write it better that would be much appreciated and perhaps find a way for me to call upon it from within Scene_Equip so that it can run from its own script page.
Side note : There is only one character in the game. So I never needed to add multiple character IDs. That is why it only applies to if $game_party.actors[0]
Thanks for looking into my newb script troubles.