Ehhh please, could someone help me with this thing? n_n
Ruby/RGSSx questions that don't deserve their own thread
RGSSx Script SupportPlease start a NEW thread. You are asking for help making three different scripts compatible. That is NOT a question that doesn't deserve its own thread. When you start your new thread (in RGSSx Script Support), include links to the scripts so people don't have to go searching for them. And allow people more than 5 hours to respond before you bump your question. Our forum rules can be accessed from the lower right corner of every page.
In a script, how I do check the current actor? As in the actor currently selected and can do actions (attack, use skills, etc).
BattleManager.actor
Works perfectly, thank you! 🙂
how do I check the weapon type of the equipped weapon (if it is an axe, a sword, a spear...)?
@Waterguy $data_weapons[x].wtype_id == y
thank you
Hey Guys,
i tried to draw the the character graphic in the menu using this snippet
if $game_variables[4] = 1 character_name = "$GiantRat_Pose" character_index = 2 end draw_character(character_name, character_index, 100, 100) def draw_character(character_name, character_index, x, y) return unless character_name bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign && sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) contents.blt(x - cw / 2, y - ch, bitmap, src_rect) endbut the character sprite is not show in the menu. They is no failure or something, game is working well
i tried to change the x y and z value but nothing happend.
Maybe someone of you know were is my failure.
Thanks
i tried to draw the the character graphic in the menu using this snippet
if $game_variables[4] = 1 character_name = "$GiantRat_Pose" character_index = 2 end draw_character(character_name, character_index, 100, 100) def draw_character(character_name, character_index, x, y) return unless character_name bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign && sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) contents.blt(x - cw / 2, y - ch, bitmap, src_rect) endbut the character sprite is not show in the menu. They is no failure or something, game is working well
i tried to change the x y and z value but nothing happend.
Maybe someone of you know were is my failure.
Thanks
@Duban65 you didn't specify in which class you've put those methods in. Is it Window_MenuStatus?
Are you sure it doesn't give you any errors? If I put if $game_variables[x] outside of a method, the game just crashes... Also, it should be if $game_variables[4] == 1, with two = thinghies.
Are you sure it doesn't give you any errors? If I put if $game_variables[x] outside of a method, the game just crashes... Also, it should be if $game_variables[4] == 1, with two = thinghies.
= means "assign this value to this variable"
== means "does this variable have this value in it"
Still, I don't think that would cause this issue - it simply means that condition would always be true and that sprite would always be used.
You're also not using character_index in the same way as the default scripts. I see what you're trying to do, but it's too early in the morning for me to go through the logic of your src_rect calculation to see if there's an error there.
You could put in some p commands to print stuff to the console, then play with the console turned on. That should help you determine where the code is doing something that deviates from what you THINK it is doing.
== means "does this variable have this value in it"
Still, I don't think that would cause this issue - it simply means that condition would always be true and that sprite would always be used.
You're also not using character_index in the same way as the default scripts. I see what you're trying to do, but it's too early in the morning for me to go through the logic of your src_rect calculation to see if there's an error there.
You could put in some p commands to print stuff to the console, then play with the console turned on. That should help you determine where the code is doing something that deviates from what you THINK it is doing.
You can try using different x and y values, if you're using a window and it's out of bounds for the dimensions of the window it won't show up.
True - if that's the case, you should be able to change 100, 100 to 0, 0 and be able to see the lower right quarter of the image. That would tell you that the problem is the x and y values you're passing in.
Or just pass in 0 and 0 and not adjust them by cw/2 and ch when you draw.
Or just pass in 0 and 0 and not adjust them by cw/2 and ch when you draw.
A quick question about the damage formula box.
I'm calling a custom script from the damage formula box and i want to pass the notes on the skill used to that formula.
Do I use "MyDmgFormula(a, b, self.note)" or do I have to use a different syntax?
I'm calling a custom script from the damage formula box and i want to pass the notes on the skill used to that formula.
Do I use "MyDmgFormula(a, b, self.note)" or do I have to use a different syntax?
I think that, if you set the parameters right, this should work.
remember that you have to do an RPG::BaseeItem or RPG::UsableItem method to be able to call this note.
remember that you have to do an RPG::BaseeItem or RPG::UsableItem method to be able to call this note.
Could you elaborate on that?
I have tried various different combinations of writing note, RPG::BaseItem::note etc.
most just result in "no damage"
using @note gives damage, but the game seems to ignore the notes.
more info:
edit: fixed a mistake
I have tried various different combinations of writing note, RPG::BaseItem::note etc.
most just result in "no damage"
using @note gives damage, but the game seems to ignore the notes.
more info:
in skill damage formula:
MyDmgFormula(a, b, @note)
in skill notes:
<mult 5>
in script:
class Game_Battler < Game_BattlerBase
def MyDmgFormula(a, b, notes = '')
mult = 1.0
if notes =~ /<mult (.*)>/i
mult = $1.to_i
end
return 10 * mult
end
MyDmgFormula(a, b, @note)
in skill notes:
<mult 5>
in script:
class Game_Battler < Game_BattlerBase
def MyDmgFormula(a, b, notes = '')
mult = 1.0
if notes =~ /<mult (.*)>/i
mult = $1.to_i
end
return 10 * mult
end
pretty sure it is self.note that you need instead of @note. also your notes variable is equal to " instead of ""
ignore my previous post, I had learned to read notes from reading Yanfly scripts, but I read one from Mr.Trivel that is pretty close to yours.
ignore my previous post, I had learned to read notes from reading Yanfly scripts, but I read one from Mr.Trivel that is pretty close to yours.
Ok, I've solved the issue
Even though the code string is part of BaseItem through inheritance, the place where the code is actually executed probably isn't.
I guess that's why @note and self.note didn't work.
What did work was to pass the skill ID and load the notes from that skill in the script itself.:
Thanks for taking the time to help
Even though the code string is part of BaseItem through inheritance, the place where the code is actually executed probably isn't.
I guess that's why @note and self.note didn't work.
What did work was to pass the skill ID and load the notes from that skill in the script itself.:
class Game_Battler < Game_BattlerBase
def MyDmgFormula(a, b, SkillID = 0)
if SkillID != 0
notes = $data_skills[skillID].note
mult = 1.0
if notes =~ /<mult (.*)>/i
mult = $1.to_i
end
return 10 * mult
end
def MyDmgFormula(a, b, SkillID = 0)
if SkillID != 0
notes = $data_skills[skillID].note
mult = 1.0
if notes =~ /<mult (.*)>/i
mult = $1.to_i
end
return 10 * mult
end
Sry my fault.
The class is Window_Base and put the x and y value to 0 doesnot have any affect.
Changed the if $game_variables[4] = 1 to if $game_variables[4] == 1 and no
error acurred.
The class is Window_Base and put the x and y value to 0 doesnot have any affect.
Changed the if $game_variables[4] = 1 to if $game_variables[4] == 1 and no
error acurred.
Edit:
@Duban65 - I feel that your question warrants its own thread, so yea...
Anyway...
If I alias a method in a 'child class' where the method is only defined in the 'parent class', would this have any negative consequences ?
Would I be better to simply call 'super' rather than call the aliased method?
Actually... Now that I think about it, having an extra aliased method floating around cant be a good thing... I will just stick with super on this occasion.
While I am asking though, are there any other 'more deadly' negative impacts of aliasing a method as previously described?
@Duban65 - I feel that your question warrants its own thread, so yea...
Anyway...
If I alias a method in a 'child class' where the method is only defined in the 'parent class', would this have any negative consequences ?
Would I be better to simply call 'super' rather than call the aliased method?
Actually... Now that I think about it, having an extra aliased method floating around cant be a good thing... I will just stick with super on this occasion.
While I am asking though, are there any other 'more deadly' negative impacts of aliasing a method as previously described?
Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/