Jump to content
kal

Ruby/RGSS3 questions that don't deserve their own thread

Recommended Posts

OK... so, I have a skill that deals damage to all enemies. That part works fine for obvious reasons. I also want this same skill to then execute some healing on all living party members. Creating a common event within the skill to execute the healing skill afterwards is causing the enemies to actually be healed, rather than damaged! LOL.

 

Is there any possible way to use custom damage formula to execute this healing after the damage is dealt? I have tried using $game_party.battle_members[0].hp += 80, for example, and so on for the other battle members, but it actually doesn't count it as "executing damage" so no actual healing pops up, but it DOES restore the HP. The bad part? The skill returns damage of 0 on the enemies, for whatever reason. My guess is that the damage of the first skill is not being processed, because of being somehow overwritten by the skill caused by the common event. There must be a way around this, though.

Share this post


Link to post
Share on other sites

That would work for a flat HP heal, but when it's based on a damage formula (like mine), that won't fly. :(

 

Perhaps there's just a snippet I could add that ensures abilities with common events process the ability first, and the common event afterwards?

Share this post


Link to post
Share on other sites

@WCouillard

Ok, so i think i kinda got it how you wanted it, but i did it in RPGmaker MV, but i think i know what you need to change for it to work in VX/ace:
You need two skills, one variable, and one common event. 

The first skill is the multi damage skill like this: 

(open spoiler to see image)

Spoiler

image.thumb.png.1c454f5234e534a23acd723723b2f62e.png

 

 

The important part is in the formula: since i use MV, it looks like this: $gameVariables.setValue(1,a.actorId()); a.agi

Here the $gameVariables.setValue(1,a.actorId()); is a piece of code to set variable 1 to the value of the actor ID, and the a.agi is the actual formula for damage calculation, which can be whatever.

If you want to use this in VX/ace you have to change:  $gameVariables.setValue(1,a.actorId()); into: $game_variables[1] = a.id; and still add the formula after like this:

$game_variables[1] = a.id; a.agi

In the effect you add the common event you want to use to call the healing of the party. Remember to set the scope to all enemies.

 

for the next part, we make the mass healing spell:

(open spoiler to see image)

Spoiler

image.thumb.png.9386f9370c05221f78123173ec6ca033.png

 

Here there are no special stuff, just make the scope all allies, and make sure the formula is whatever you want it to be, i use the same for healing and damage.

Keep in mind that this is where i might differ from your vision, as this will not heal the exact damage done, but rather heal using the same formula used for the damage(unless you want it different)

 

The last part of this skill(s) is the common event:

(open spoiler for image)

 

Spoiler

image.thumb.png.d44b12952e4af3e702bef4f28245694c.png

 

Here i have one conditional branch for each actor you have in your database (disregard the first one that is 0, that was just a test), i have 4 actors: harold, Therese, Marsha and Lucius, you might have more or less.

For each branch, check the number of the variable you chose in the first skill, and just match it with the actor using the force action-> use skill.

 

This is done so that the healing spell is used by the same character that used the damage spell, so that the numbers are calculated using the correct stats.

 

This was written pretty fast, so if there is something you dont understand let me know :) Also if i completely missed the mark i'm up for trying different methods.

 

 

Edited by lazyV

Share this post


Link to post
Share on other sites

Doesn't look like it. There are no properties to change anything about the shadow. You could probobly cheat and make a fake shadow by drawing the text twice at slightly different locations if you needed to though.

 

Note: The shadow effect is actually fairly subtle and you might actually want to change the outline instead.

Edited by Kayzee

Share this post


Link to post
Share on other sites

Hello!
Question: Is there any way to check if a ruby method is running? Something akin to, "method.is_running?"

 

I have a script that affects event # 1's move route, but event # 1's move route is being controlled by a separate event, event # 2. Because of this, the script doesn't take priority and event #1 will only carry out event #2's commands. This doesn't happen if event #1 is controlling its own move route, but for reasons I can't do that.

So I want to check if the script is running so I can disable event #2.

Edited by Zen Blood
clarify

Share this post


Link to post
Share on other sites

Uhhh... It doesn't really work like that. Scripts and events don't really run in the background. Events use fibers, but that's more a way to 'pause' some code and 'unpause' it later. I think you can create threads but... threads are stupidly complicated and not really too useful for VX Ace so just forget I said anything about them. Really.

 

You could make the script set a variable somewhere to tell event #2 it ran this frame, and reset the variable on frames it doesn't run. Though if the script runs every frame that would be pretty pointless.

Share this post


Link to post
Share on other sites

Thank you, @Kayzee, not only for explaining that to me but for your speedy response too!

 

I did end up finding a work around by temporarily deactivating the event page the script is called in and reactivating it after event #2 started executing its commands. Since it was activated last, it now it takes priority! :)

Share this post


Link to post
Share on other sites

I'm using Yanfly's battle system for VX Ace, and to me the damage number fly by too quickly. Does anyone know how I'd be able to extend the duration that they're displayed? I've looked it over and can't find where the duration of the damage numbers are defined. Any ideas?

 

Here's his battle engine script:

https://raw.githubusercontent.com/Archeia/YEARepo/master/Ace_Battle_Engine.rb

Share this post


Link to post
Share on other sites

@dailyminerals
I think it is the following:

 

Spoiler


    POPUP_SETTINGS ={
      :fade       => 12,          # Fade rate for each popup.
      :full       => 60,          # Frames before a popup fades.
    }

 

 

Look for these in the script. I am not sure exactly how :fade effects it, but I think it has some involvement. FTR, 60 frames is one second at 60 FPS, the average that VX Ace games are made to run at. Change :full to 120 or 150 for two or two and a half seconds respectively.

Edited by PhoenixSoul

Share this post


Link to post
Share on other sites

So I added this to game_interpreter so I can more easily check inventory:

class Game_Interpreter
  def hasitem?(id, *args)
    return $game_party.has_item?($data_items[id], false)
  end
end # Game_Interpreter

But it's not exactly useful yet, because I need to be able to check for multiple items, ie: hasitem?(12,53,77,42). How do I get the method to take several arguments like this, without them ALL having to be in the inventory?

 

EDIT: It could be useful to keep the functionality this currently has, where all items must be present to return TRUE, but what I was going for was creating a condition to see if the player had at least one of the items in the list.

Edited by AeghtyAteKees

Share this post


Link to post
Share on other sites
7 minutes ago, PhoenixSoul said:

$data_armors and $data_weapons are separate from $data_items as I recall.

This is true, though the last argument in $game_party.has_item?, which in my snippet is FALSE, states whether or not to include equipment in this check. ^_^

Share this post


Link to post
Share on other sites

Hmmm...

 

$game_party.has_item?($data_items[1]||[2]||[3]||[4],false)

Not sure if above is the actual script call being used, but using || between each ID might be the answer...?

Edited by PhoenixSoul
12AM SYNDROME Wankery

Share this post


Link to post
Share on other sites

Uh, you can't use || that way. If you wanted to check multiple things you would need to do the full check, not just the id. Like this:

$game_party.has_item?($data_items[1]) || $game_party.has_item?($data_items[2]) || $game_party.has_item?($data_items[3]) || $game_party.has_item?($data_items[4])

 

Which would be a pain, and you don't know how many things to check in this case anyway.

 

Anyway, off the top of my head, here is how I would do it:

class Game_Interpreter
  def hasitem?(*args)
    return args.any? {|id| $game_party.has_item?($data_items[id], false)}
  end
end # Game_Interpreter

Methods like .any? are very useful because you can give them a block of code to check each member of an array with! This is called a Closure, and while they can get sort of hard to explain, this is a pretty simple one. The block of code is passed one argument which we "bind' to a variable by surrounding the name we want to use with | |. For .any? it steps though each member of an array passing that member to a block, then if the result is true it returns true, if not it checks the next member of the array and if it runs out of members it returns false.

 

TL;DR: Code you can pass code to is neat!

Edited by Kayzee

Share this post


Link to post
Share on other sites

Well, sorta... you could call it like hasitem?(*(20..30)) to 'splat' the range in as arguments (this is just like how *args 'splats' the arguments to an array), but I think it's more flexible to use this:

 

class Game_Interpreter
  def hasitem?(*args)
    a = []
    args.each do |arg|
      if arg.is_a?(Enumerable)
        a |= arg.to_a
      else
        a.push(arg)
      end
    end
    return a.any? {|id| $game_party.has_item?($data_items[id], false)}
  end
end # Game_Interpreter

 

It's more complex , but it lets you use hasitem?(1..6, 8, 20..30) or whatever. There might be an easier way to do this, not sure.

Edited by Kayzee

Share this post


Link to post
Share on other sites
11 hours ago, AeghtyAteKees said:

ALSO. :D

 

Is it as simple as replacing "return a.any?" with "return a.all?" to make it require all IDs being called?

 

(Nothing's ever simple, is it?)

 

Unbelievably enough, it actually is that simple!

 

You can also use "return a.none?" to make it require that you not have any of the item IDs and "return a.one?" to make it require that you have exactly one and only one of the item ids, but I don't think they are as useful as any? and all? really. Also if you use "return a.select" instead of giving you a true or false answer for if you have the ids, it will give you an array of the ids that match what you have which can be handy in some situations.

 

1 hour ago, Chucksaint said:

Hi there again, I'm using Napoleons Minimap (https://forums.rpgmakerweb.com/index.php?threads/napoleons-minimap.13801/) 
I would like to know if I can make a Mask to make the map circular in scroll mode instead of rectangular , if so how can I ? 
Thank you :)

 

 

Unfortunately, there is really no easy way to make masks in VX Ace. I managed to make some mask-like effects using subtractive and addictive blending, but it pretty much only works in some situations.

Edited by Kayzee

Share this post


Link to post
Share on other sites
20 minutes ago, Kayzee said:

Unfortunately, there is really no easy way to make masks in VX Ace. I managed to make some mask-like effects using subtractive and addictive blending, but it pretty much only works in some situations.

Hi there, thank you for your response..I don't know if I am making sense. 

D: so is it impossible to make this:

Spoiler

Untitled-1f.thumb.png.33e87e5f6a0dfd76846cd120498e2050.png

into this? 

Quote

Untitled-12f.thumb.png.e9a4dd90176b4be2c1163e5bd537c01d.png

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   1 member

×