How can I Show the name of the actors weapon and shield?cuz i want it so when i go to block it shows block with (insert shield here) and when i go to weapon it shows attack with (insert weapon here).
self.battler.armor1_id
self.battler.weapon_id
I think that should work.
sry i forgot to put this.i mean in battle how can i show it?And does it go in scene_battle1?
Scene_Battle1 Line 26
Change to:s1 = "#{$data_system.words.attack} with #{$data_weapons[self.battler.weapon_id].name}"
Gimme a sec...I need to figure out how to get the weapon name into a global variable... (it's probably something easy that I'm missing.
The command window must be dependant on the battler, so this window has to be refreshed every time it's called.
In
Scene_Battle 3 you can find the method
phase3_setup_command_window with :
@actor_command_window.active = true
@actor_command_window.visible = true
The command window becomes visible thanks to those lines, so it has to be refreshed in this method.
Just add before the 2 lines :
@actor_command_window.refresh_weapon_and_shield(@active_battler)
Now you have to create the new method
refresh_weapon_and_shield in the class
Window_Command. The method must just alter the first and third commands, dependant on the battler, then call a refresh.
So you must add in
Window_Command :
def refresh_weapon_and_shield(battler)
@commands[0] = "Attack with " + $data_weapons[battler.weapon_id].name
@commands[2] = "Block with " + $data_armors[battler.armor1_id].name
refresh
end
And if the text is too long for the window's width, you can modify this width in
Scene_Battle 1 ; in
main you can find :
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
Just replace 160 by a bigger value.
Ok, Trying now.
EDIT: i got confused after i got to the Window_Command part :(.Where in window command?
EDIT(again :haha:): I fooled around with the script edit and it WORKS!!!You have full credit for helpin with this!!!
Almost forgot :welcome: :clap:!
That is a new method : just add the block before the final "end".
Wow...Another error :P.When i attack with basil(im using a new project to test)The game Crashes!!!
EDIT:That happens when i have no shield on :(.I removed the shield part and if u have no weapon on anyways then it crashes again.Is there a way so when you unequip a weapon,you really equip some weapon called"Fists"or something.
What is the error message ?
What is the corresponding line in the code ?
Window_Command line 51: NoMethodError occured
undefined method `name' for nil:NilClass
There is an easy solution : replace the method
refresh_weapon_and_shield by :
def refresh_weapon_and_shield(battler)
if battler.weapon_id == 0
@commands[0] = "Attack with fists"
else
@commands[0] = "Attack with " + $data_weapons[battler.weapon_id].name
end
if battler.armor1_id == 0
@commands[2] = "Block with fists"
else
@commands[2] = "Block with " + $data_armors[battler.armor1_id].name
end
refresh
end
Another Error :O.o:.It happens at the new line u add to Scene_Battle3 (Line 78).
What is the error message and your scenario ?
The Error happens when i have no weapon or shield :P.R u even checking if this works urself???
That's kinda weird because these two branches assure that there is no error:
if battler.weapon_id == 0
if battler.armor1_id == 0
Can you post that line and the code section around it?
Heres the code i have
def refresh_weapon_and_shield(battler)
if battler.weapon_id == 0
@commands[0] = "Attack with fists"
else
@commands[0] = "Attack with " + $data_weapons[battler.weapon_id].name
end
if battler.armor1_id == 0
@commands[2] = "Block with fists"
else
@commands[2] = "Block with " + $data_armors[battler.armor1_id].name
end
refresh
end
I put it at the end of window command like i was told :)
QuoteR u even checking if this works urself???
That's weird...
In a new project, I just added :
@actor_command_window.refresh_weapon_and_shield(@active_battler)
in
Scene_Battle 3and
Quotedef refresh_weapon_and_shield(battler)
if battler.weapon_id == 0
@commands[0] = "Attack with fists"
else
@commands[0] = "Attack with " + $data_weapons[battler.weapon_id].name
end
if battler.armor1_id == 0
@commands[2] = "Block with fists"
else
@commands[2] = "Block with " + $data_armors[battler.armor1_id].name
end
refresh
end
in
Window_Commandand it worked...
QuoteIt happens at the new line u add to Scene_Battle3 (Line 78).
What's the message in the pop-up when the error occurs ?
Hmm...I tried it again and it worked :O.o:.How come it never worked last time :???:
EDIT: I Tried it with my RTAB thats in my game im makin.
ERROR:
Script 'Window_Command' line 51: NoMethodError occured.
undefined method `weapon_id' for nil:NilClass
So your active battler is
nil...
To avoid the error, you can add immediately after
def refresh_weapon_and_shield(battler) :
But in that case (no battler found) the window won't be refreshed.
Can you post your RTAB ?
RTAB modifies many of the battle scripts by using an argument called battler which is used instead of @active_battler for the battle process (similar to your method). Specifically during action selection it's @active_actor instead. This piece of code is probably the troublemaker:
@actor_command_window.refresh_weapon_and_shield(@active_battler)
I hope this information helps. :)
I put both of your lines in and it WORKS :twitch: :clap: :clap: :dance: :dance: :dj: