Script Call Support Boards

@Roninator2 Thank you!!!!!
You have dug me out of a big hole, and I am very grateful.
Hello,
I'm trying to add/remove skills dynamically from enemies for use in battle (if it can only be done before a battle, that would still be sufficient). Yes, I know I could use the native conditions such as status effects, but that won't help in this case, and I know it's possible to change the names of enemies etc. So yeh, how would I go about this with a scriptcall?
status effects, but that won't help in this case,
I'm curious to know why?
There's no easy way to remove a skill, but it can be blocked.
Hellu, would someone know what would be a script call to check (return) the ID of what was the type of the last skill used?
I'm aware is something related to "stype", but I'm not sure how to write the call exactly.
And also to know if ANYONE casted it, allies or enemies.

Would be something like:

return true if current.battler_last.skill.(stype) = 6

or something similar to that?
a script call to check (return) the ID of what was the type of the last skill used?
I don't believe you can use a script call check as something like that doesn't exist AFAIK.
You can try using a little script to place the id into a variable.
Ruby:
module R2_Last_Skill_Check
  Variable = 7
end

class Scene_Skill < Scene_ItemBase
  alias r2_on_item_var_ok on_item_ok
  def on_item_ok
    $game_variables[R2_Last_Skill_Check::Variable] = item.id
    r2_on_item_var_ok
  end
end

class Scene_Battle < Scene_Base
  alias r2_on_skill_var_ok  on_skill_ok
  def on_skill_ok
    $game_variables[R2_Last_Skill_Check::Variable] = @skill_window.item.id
    r2_on_skill_var_ok
  end
end
I don't believe you can use a script call check as something like that doesn't exist AFAIK.
You can try using a little script to place the id into a variable.
Ruby:
module R2_Last_Skill_Check
  Variable = 7
end

class Scene_Skill < Scene_ItemBase
  alias r2_on_item_var_ok on_item_ok
  def on_item_ok
    $game_variables[R2_Last_Skill_Check::Variable] = item.id
    r2_on_item_var_ok
  end
end

class Scene_Battle < Scene_Base
  alias r2_on_skill_var_ok  on_skill_ok
  def on_skill_ok
    $game_variables[R2_Last_Skill_Check::Variable] = @skill_window.item.id
    r2_on_skill_var_ok
  end
end
Thanks! But I'm not entirely sure if this would work (or at least, how should I use it to implement it).
Basically, what I want to achiev with yanfly lunatic state is a state that check everytime an action is made (with the "while effect"), if that action is an skill with the skill type (id) that actor will gain let's say 500 HP.
Would this script have some way to check for that? The While effect would call every time any action is made, even if it's an enemy or an ally. But I need to tell the effect itself to do it only when the skill is that type.

I suppose something like:

Code:
If $game_troop.members.last_action = $game_variables[7]
FORMULA
end
???
But I don't think this script call would check if the value I'm giving is for the Skill type but the skill id?
Maybe there's an easier way to achiev what I want and I'm trying the hard way?
with yanfly lunatic state
That makes it much more complicated.
I also realized that the code I gave would save the skill id the last time a skill was selected, not the skill of a particular actor.

What your asking is complicated since you need to check the skill type/id of every action?
Looking at the code I see
Ruby:
  def execute_action
    scene_battle_execute_action_lsta
    @subject.run_lunatic_states(:while)
  end
which goes to
Ruby:
  def run_lunatic_states(type)
    for state in states; lunatic_state_effect(type, state, self); end
  end
so self should be the actor using the skill. But it doesn't allow for passing on the skill data.
But maybe you can pull in action data
Testing would have to be done. I may get to it but I'm generally busy these days.
Game_Actions has an item method which could be checked for the item and if it is a skill then get the type. This (from what I understand) is accessible through Game_Battler.actions
This (from what I understand) is accessible through Game_Battler.actions
Yeah, I was checking the game_battler.action a lot to see if something related to the type of skill could be called to check. But as I'm not too skilled with coding I might be missing something.

I may get to it but I'm generally busy these days.

My brother in christ, you already did a lot for me! Don't lose your time with this and get some rest while you can. I might find some solution myself. Thanks for your predisposition so far!

EDIT:

OMG I found it thanks to this post!
Seems like the call method is "current_action.item.stype_id"

EDIT 2:

Okay, it does seem to be the script call somehow, but I still hadn't figured how to make it to check when any actor/enemy is the one casting. It only does it when I (the owner of the state) is taking an action. But at least I know I now can check out the id of a skill type.
Hello. Any idea why those script calls arent working?


So i have this flute minigame. When the player starts to play the flute, i need the current bgm to stop playing, but after the player finishes playing the flute, i want the bgm to play again. I dont care if the music restarts or plays from where it stopped, i just need this fade out/fade in music effect.

I saw the "save BGM" and "replay BGM" in the event options but for some odd reason it justs doesnt work. It just doesnt save or replay anything.

Then i searched the forums and came across scirpt calls that 'save' and 'replay' the music.

$game_system.save_bgm
$game_system.replay_bgm

I tried using them, but it didnt work too.

The track is an .OGG file. Im not sure if that influences into something. Also, i use the script calls on a common event.
First of all, it'd have helped a lot if you had told us from the very beginning that you're using VX Ace.

From the default script:

Ruby:
class Game_System
  # Many lines of code here
  def save_bgm
    @saved_bgm = RPG::BGM.last
  end
  #--------------------------------------------------------------------------
  # * Resume BGM
  #--------------------------------------------------------------------------
  def replay_bgm
    @saved_bgm.replay if @saved_bgm
  end

So in theory, those script calls should have worked unless there were no BGM playing at the moment you called the first one.
Hello!

I'm looking for a script call that I can use within a Conditional Branch. Through using the Call Common Event event command, I'd like to identify the current map's tileset ID from the database. The logic would look something like this:
If the current map's tileset ID is [], then...
e.g. if you're on the World Map (Tileset ID is 001:Field), this item may be used...
If you are in a town (Tileset ID is 002:Exterior), this item may not be used...


Here's what I currently have. This was not successful with my current Conditional Branch (worked regardless of the current map's tileset ID).
Spoiler: Common Event
Screenshot 2024-02-21 115053.png
I would appreciate any insight on my errors, as well. I'm relatively naive about how script classes, methods, etc. are called upon. LOL.

Thank you!
Here's a quick solution!

Ruby:
# * Tileset ID Checker XP & ACE * #
#   Scripter : Kyonides Arkanthes
#   2024-02-21

# * Script Call * #
# $game_map.tileset?(TilesetID)

class Game_Map
  def tileset?(t_id)
    @map.tileset_id == t_id
  end
end

And yes, it will work on both XP & VX ACE! 😀
Hello!

I'm looking for a script call that I can use within a Conditional Branch. Through using the Call Common Event event command, I'd like to identify the current map's tileset ID from the database. The logic would look something like this:

e.g. if you're on the World Map (Tileset ID is 001:Field), this item may be used...
If you are in a town (Tileset ID is 002:Exterior), this item may not be used...


Here's what I currently have. This was not successful with my current Conditional Branch (worked regardless of the current map's tileset ID).
Spoiler: Common Event
I would appreciate any insight on my errors, as well. I'm relatively naive about how script classes, methods, etc. are called upon. LOL.

Thank you!

Wouldn't just map ID work? I do this by assigning the map ID to a variable and then using that variable in conditional branches (I guess there's a script call for that too, but this works fine for me). Does it need to be tileset in your case? Do you change tilesets on your world map?
Here's a quick solution!

Ruby:
# * Tileset ID Checker XP & ACE * #
#   Scripter : Kyonides Arkanthes
#   2024-02-21

# * Script Call * #
# $game_map.tileset?(TilesetID)

class Game_Map
  def tileset?(t_id)
    @map.tileset_id == t_id
  end
end

And yes, it will work on both XP & VX ACE! 😀

Oh wow! Couldn't have asked for a more eloquent solution: just creating and assigning a variable juuuust out of reach from what VX Ace comes out of the box! Thank you, Kyonides! I think this is a good lesson to learn about establishing variables.

Wouldn't just map ID work? I do this by assigning the map ID to a variable and then using that variable in conditional branches (I guess there's a script call for that too, but this works fine for me). Does it need to be tileset in your case? Do you change tilesets on your world map?
It would, yes! Utilizing the Map ID was a system I actually tested out initially.

However, I found that it was too clunky and not effective for me. Map ID lacked the dynamic nature Tileset ID of when a map was added, whereas using just Ace's default Field, Exterior, Interior, and Dungeon tilesets between maps stayed congruent across individual maps and their purpose.
Is it possible to change multiple selfswitches at once?
Eg. $game_self_switches[[@map_id, @event_id, 'A'+'B'+'C']] = false
Or better yet, a way to set all to false?

Edit: Found a workaround via 2 control variables and a Common Event
$game_self_switches[[$game_variables[1], $game_variables[2], 'A']] = false
$game_self_switches[[$game_variables[1], $game_variables[2], 'B']] = false
etc.
Well, there are wrappers that allow you to do it without depending on game variables to do that for you. You'd need a single script call with a single line of call. I crafted one of them.
Not sure what wrappers are. Is what you're suggesting require the Script Editor or done solely via Script Event Command?
Well, you know that a wrap can be a burrito or an envelope or anything that complete covers anything else, right? Here a wrapper method would be a method explicitly created to reduce the amount of lines needed to perform a task. Yes, via script call after having pasted a new script into a new script section in the script editor. That method includes stuff like those repetitive calls to $game_self_switches.
Hello! For some reason, the following script command:

$game_actors[id].change_equip_by_id(slot, equip) if $game_actors[id]

Won't seem to work for me. The item doesn't get equipped, and it seems like it ALSO gets removed from the inventory. It's kind of weird... furthermore, would anyone know how to possibly use a variable in place of a specified actor ID? I have a really complex equip system which is why I'm using a script call instead of the built-in Change Equipment. I want to change the Shield slot of an actor with the actor having it changed being determined by a variable. Basically a script call where if Variable 70 is at 1, it changes Actor 1's Shield Slot, or if Variable 70 is at 2, it changes Actor 2's.
For some reason, the following script command...Won't seem to work for me.
Being discussed in this thread.

Original thread: https://forums.rpgmakerweb.com/threads/script-call-support-boards.25767/