Jump to content

kyonides

Member
  • Content Count

    37
  • Joined

  • Last visited

  • Days Won

    1

kyonides last won the day on January 23

kyonides had the most liked content!

Community Reputation

3

About kyonides

  • Rank
    Advanced Member

Profile Information

  • Interests
    Scripting, Writing, Prophecies

RPG Maker Information

  • RM Skill -
    Coder

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. It took me a couple of hours to figure out what the RM devs had changed in the source code when developing MV's default plugins by defining functions with names that were never used in the RGSS based engines. Even so, that didn't prevent me from publishing KItemAlert MV! XD

  2. kyonides

    KItemAlert

    A New Port Has Arrived! Now MV can also enjoy the benefits of using the KItemAlert plugin!
  3. Busy reporting an insignificant Ruby "bug" that nobody would ever trigger if they do learn how to program in Ruby correctly...
    Yet, it's some real bug-like stuff, guys!

    1. Kayzee

      Kayzee

      what's the bug?

  4. kyonides

    Understanding RGSS

    The Other Bad Practices Found in RGSS Scripts We all should know by now how to declare an if or unless conditional statement. Happy with a sweat Yet, there are people out there that do weird stuff while doing so. In some cases the culprit was the RMXP's default code. For those guys that entered the scene after RMVX or RMVX Ace came out, I have no excuse. Confused if variable == true print "It's true!" end if variable == false print "It isn't true..." end This is one of the most extreme cases seen so far. For some reason, the guy checks the same variable twice, once for a truthy value and another for its opposite value. It is terrible! Angry Just like in many other languages, there are other ways to check the same value appropiately, without repeating oneself. if variable == true print "It's true!" elsif variable == false print "It isn't true..." end There we can see how to define a second condition using elsif instead. It certainly means "else if" there. If we were checking for totally different values, that solution would be fine. Even so, we are only checking what is its actual boolean value and under such circumstance, there is an easier way to deal with it. if variable == true print "It's true!" else print "It isn't true..." end Yes guys! That is all you needed to do from the very beginning! Laughing Shocked But wait! There is more you need to learn here about those statements! if is_variable print "It's true!" else print "It isn't true..." end Grinning It is quite interesting how the code still works, don't you think? Thinking But why does it work here? Who Knows? There is an easy explanation. In Ruby, unlike C or C++, all objects return a truthy value if they are not equal to nil of the NilClass or false for obvious reasons. In C it would be quite common to see something like the following code: if (result) { return "You were successful!"; } else { return "You failed!"; } The negative way to declare that kind of statement would be: if (!state) { return "LoadError: Failed to load script."; } A ! bang, yes, a ! bang there means negative value or opposite value or simply false. And guess what? That does exist in Ruby as well! if !is_done print "In the works!" else print "Done!" end Of course, newcomers might need to include the equality operator and the true value like this == true but in the professional world that is not used at all. The only reason why you would ever, if ever, use it would be to test if an object is equal to true or false or nil in a threefold check. And this is extremely uncommon, guys! Happy with a sweat Toggling Switches So how can we apply that knowledge to changing the boolean value of a Game Switch? Thinking Just use the following code: $game_switches[1] = !$game_switches[1] A Curious But Nonsensical Idea Some time ago somebody wrote me a message telling me how dangerous it would be to do the following while using modules and classes. module Some ONEISTHERE = "Someone is there!" class Thing include Some end end OK, I got to say that it is idiotic per se, still, this person wanted me to warn you about it. The reasoning behind it was that it would create a terrible loop that should be avoided at all costs. Interesting conclusion. Thinking [Mad Scientist Mode ON] Let us test this theory, guys! Nope, as we can see in the picture above, that is CERTAINLY NOT the case there! What has happened was that we simply created a "new link" to the Constants already declared in the module above. The only thing we have achieved was to come up with a redundant way to get to the same old Constant. XD It was totally unnecessary for sure. =_=¬° [Mad Scientist Mode OFF]
  5. KMessageTarget MV 2 Versions by Kyonides Arkanthes Introduction By default the Battle Log doesn't expect you to add a target's name to a skill action message. This plugin changes that to make sure you can certainly read who's the hero's current target. Simple Version //=========================================== // * KMessageTargetMV.js - Simple Version //=========================================== /*: * @plugindesc This plugin will let you add the enemy's name to a skill's * action message by using a tag or wildcard. * @author Kyonides Arkanthes * @help Date: 2023-01-30 * # * Free as in beer. * # * The regular expression or regex is %e by default. */ function KMessageTarget() { throw new Error('This is a static class'); } KMessageTarget.regex = /%e/i; Window_BattleLog.prototype.displaySkillTargets = function(subject, item, targets) { let target = 0; let msg = ""; for (var i = 0; i < targets.length; i++) { target = targets[i]; if (item.message1) { msg = subject.name() + item.message1.format(item.name); msg = msg.replace(KMessageTarget.regex, target.name()); this.push('addText', msg); } if (item.message2) { this.push('addText', item.message2.format(item.name)); } } } const KMessageTarget_win_btl_log_displayAction = Window_BattleLog.prototype.displayAction; Window_BattleLog.prototype.displayAction = function(subject, item, targets) { if (DataManager.isSkill(item)) { this.displaySkillTargets(subject, item, targets); } else { KMessageTarget_win_btl_log_displayAction.call(subject, item); } }; Window_BattleLog.prototype.startAction = function(subject, action, targets) { let item = action.item(); this.push('performActionStart', subject, action); this.push('waitForMovement'); this.push('performAction', subject, action); this.push('showAnimation', subject, targets.clone(), item.animationId); this.displayAction(subject, item, targets); }; Full Version //=========================================== // * KMessageTargetMV.js - Full Version //=========================================== /*: * @plugindesc This plugin will let you add the enemy's name to a skill's * action message by using a tag or wildcard. * @author Kyonides Arkanthes * @help Date: 2023-01-30 * # * Free as in beer. * # * * The regular expressions or regex are * %a for an Actor or Ally * %e for an Enemy * * Note Tag: _party item_ * It allows your hero uses an item on all of his or her allies while preventing * the Battle Log from repeating itself over and over again. * * You can customize the KMessageTarget.party_as_target string if necessary. */ function KMessageTarget() { throw new Error('This is a static class'); } KMessageTarget.item_list = [1, 6]; KMessageTarget.actor_regex = /%a/i; KMessageTarget.enemy_regex = /%e/i; KMessageTarget.no_target_item = / on %a/i; KMessageTarget.party_item = /_party item_/i; KMessageTarget.party_as_target = "the party"; Window_BattleLog.prototype.displaySkillTargets = function(s_name, item, targets) { let target = 0; let msg = ""; for (var i = 0; i < targets.length; i++) { target = targets[i]; if (item.message1) { msg = s_name + item.message1.format(item.name); msg = msg.replace(KMessageTarget.actor_regex, target.name()); msg = msg.replace(KMessageTarget.enemy_regex, target.name()); this.push('addText', msg); } if (item.message2) { this.push('addText', item.message2.format(item.name)); } } } Window_BattleLog.prototype.processNames = function(s_name, item, t_name) { let msg = TextManager.useItem.format(s_name, item.name); if (!KMessageTarget.item_list.includes(item.id)) { msg = msg.replace(KMessageTarget.no_target_item, ""); } msg = msg.replace(KMessageTarget.actor_regex, t_name); this.push('addText', msg); } Window_BattleLog.prototype.displayItemTargets = function(s_name, item, targets) { if ( KMessageTarget.party_item.exec(item.note) ) { this.processNames(s_name, item, KMessageTarget.party_as_target); return; } let target = 0; for (var i = 0; i < targets.length; i++) { target = targets[i]; this.processNames(s_name, item, target.name()); } } Window_BattleLog.prototype.displayAction = function(subject, item, targets) { let numMethods = this._methods.length; if (DataManager.isSkill(item)) { this.displaySkillTargets(subject.name(), item, targets); } else { this.displayItemTargets(subject.name(), item, targets); } if (this._methods.length === numMethods) { this.push('wait'); } }; Window_BattleLog.prototype.startAction = function(subject, action, targets) { let item = action.item(); this.push('performActionStart', subject, action); this.push('waitForMovement'); this.push('performAction', subject, action); this.push('showAnimation', subject, targets.clone(), item.animationId); this.displayAction(subject, item, targets); }; Side Note: There should be another regex that I could have used there, yet, I preferred to use a very specific one that people could quickly interpret as an enemy's name if they ever find it in the message box. We could say it's a very friendly reminder of what it actually stands for. Terms & Conditions Free as in beer. Include my nickname in your game credits. Read the instructions. Do not repost it.
  6. KTouchNewMapEvent XP + VX + ACE + MV by Kyonides Arkanthes Introduction Did you ever want that the engine would autorun events right after being touched by the player or another event? Especially once it finishes transferring the player to a new map... Now you can do that! Just copy and past the following snippet on your script editor! Download the Scripts! XP Version # * KTouchNewMapEvent XP # Scripter : Kyonides Arkanthes # 2022-09-29 # * Plug & Play Script * # # This scriptlet allows you to run an event after being transferred to another # map. It will run even if the trigger were the Player Touch or Event Touch one. # * Aliased Method: Game_Event#initialize class Game_Event alias :kyon_touch_new_map_event_init :initialize def initialize(map_id, event) kyon_touch_new_map_event_init(map_id, event) check_shared_location end def touch_trigger?() [1, 2].include?(@trigger) end def player_new_x?() $game_temp.player_new_x == @x end def player_new_y?() $game_temp.player_new_y == @y end def check_shared_location start if touch_trigger? and player_new_x? and player_new_y? end end VX Version # * KTouchNewMapEvent VX # Scripter : Kyonides Arkanthes # 2022-09-29 # * Plug & Play Script * # # This scriptlet allows you to run an event after being transferred to another # map. It will run even if the trigger were the Player Touch or Event Touch one. # * Aliased Method: Game_Event#initialize class Game_Player attr_reader :new_x, :new_y end class Game_Event alias :kyon_touch_new_map_event_init :initialize def initialize(map_id, event) kyon_touch_new_map_event_init(map_id, event) check_shared_location end def touch_trigger?() [1, 2].include?(@trigger) end def player_new_x?() $game_player.new_x == @x end def player_new_y?() $game_player.new_y == @y end def check_shared_location start if touch_trigger? and player_new_x? and player_new_y? end end VX ACE Version # * KTouchNewMapEvent ACE # Scripter : Kyonides Arkanthes # 2022-09-29 # * Plug & Play Script * # # This scriptlet allows you to run an event after being transferred to another # map. It will run even if the trigger were the Player Touch or Event Touch one. # * Aliased Method: Game_Event#setup_page class Game_Player attr_reader :new_x, :new_y end class Game_Event alias :kyon_touch_new_map_event_setup_page :setup_page def touch_trigger?() [1, 2].include?(@trigger) end def player_new_x?() $game_player.new_x == @x end def player_new_y?() $game_player.new_y == @y end def check_shared_location start if touch_trigger? and player_new_x? and player_new_y? end def setup_page(new_page) kyon_touch_new_map_event_setup_page(new_page) check_shared_location end end MV Version //================================== // * KTouchNewMapEventMV.js //================================== /*: * @plugindesc This plugin will be triggered if any given event's coordinates * match the player's and its trigger is either a Player or Event Touch. * @author Kyonides Arkanthes * @help Date: 2023-01-29 * */ const KTouchNewMap_event_setupPage = Game_Event.prototype.setupPage; Game_Player.prototype.newMapX = function() { return this._newX; } Game_Player.prototype.newMapY = function() { return this._newY; } Game_Event.prototype.setupPage = function() { KTouchNewMap_event_setupPage.call(this); this.checkEventTriggerNewMapTouch(); }; Game_Event.prototype.checkEventTriggerNewMapTouch = function() { if (this._trigger == 1 || this._trigger == 2) { if ($gamePlayer.newMapX() == this.x && $gamePlayer.newMapY() == this.y) { this.start(); } } }; Notes Honestly, there are other ways to trigger events without using scripts. Yet, you can still use my scriptlet to make it possible by setting its trigger as Player Touch or Event Touch. Terms & Conditions Free as in beer and as in speech. Please include my nickname in your game credits.
  7. KSkillNeedsState XP + VX + ACE by Kyonides Arkanthes Introduction Do you need to restrict the usage of a skill by forcing the hero to get a specific state first? Now you can do that! In XP's case Adjust the Constants you can see below as deemed necessary. module KSkillNeedsState SKILL_IDS = [57] STATE_ID = 17 end In VX & VX ACE The only thing you need to do is leaving a very specific note in the skill's note box. _need state ID_ Replace ID with a number. Download the Demos! XP Version # * KSkillNeedsState XP * # # Scripter : Kyonides Arkanthes # 2023-01-29 # * Free as in Beer * # # Adjust the values of the SKILL_ID and STATE_ID Constants at will. module KSkillNeedsState SKILL_IDS = [57] STATE_ID = 17 end class Game_Battler alias :kyon_gm_btlr_skill_can_use? :skill_can_use? def skill_need_state?(skill_id) KSkillNeedsState::SKILL_IDS.include?(skill_id) end def has_state_dependent_skill? state?(KSkillNeedsState::STATE_ID) end def skill_can_use?(skill_id) result = kyon_gm_btlr_skill_can_use?(skill_id) if result and skill_need_state?(skill_id) result = has_state_dependent_skill? end result end end VX Version # * KSkillNeedsState VX * # # Scripter : Kyonides Arkanthes # 2023-01-29 # * Free as in Beer * # # Leave this note _need state ID_ in the Skill's Note box. # There ID stands for any existing State ID. module KSkillNeedsState SKILL_REGEX = /_need state (\d+)_/i end class Game_Battler alias :kyon_gm_btlr_skill_can_use? :skill_can_use? def skill_need_state?(skill) return true if skill.note[KSkillNeedsState::SKILL_REGEX] == nil state?($1.to_i) end def skill_can_use?(skill) result = kyon_gm_btlr_skill_can_use?(skill) result = skill_need_state?(skill) if result result end end VX ACE Version # * KSkillNeedsState ACE * # # Scripter : Kyonides Arkanthes # 2023-01-29 # * Free as in Beer * # # Leave this note _need state ID_ in the Skill's Note box. # There ID stands for any existing State ID. module KSkillNeedsState SKILL_REGEX = /_need state (\d+)_/i end class Game_Battler alias :kyon_gm_btlr_skill_cond_met? :skill_conditions_met? def skill_need_state?(skill) return true if skill.note[KSkillNeedsState::SKILL_REGEX] == nil state?($1.to_i) end def skill_conditions_met?(skill) result = kyon_gm_btlr_skill_cond_met?(skill) result = skill_need_state?(skill) if result result end end Terms & Conditions Free as in beer. Include my nickname in your game credits.
  8. kyonides

    alternate battle drop treasure screen

    I don't pretend to give you hope on getting a direct answer, but I felt the need to ask you this: are you using a frontview or sideview battle system? Or some action BS? Every single one of them would require a different approach depending on the BS and their custom functions.
  9. kyonides

    Hello everyone.

    And from your experience, is Unity suited for RPG's? Or it'd be better to use it to develop other game genres?
  10. kyonides

    eventing Detect Distance Between Player and Object

    OK, here's another explanation on why he had to multiply by -1 while calculating the distance via event commands. It's because the engine developers didn't think it was necessary to add the absolute value concept in the Change Game Variable event command. The same calculation could have been done by adding distance_x.abs + distance_y.abs in Ruby and RGSS. Giving thumbs up to Vectra for coming up with this way to event it. So let's go back to 7th grade stuff here. |a - b| = |b - a| # Example 1 |5 - 2| = |3| = 3 # Example 2 |-2 - 5| = |-7| = 7 # Example 3 |3 -(-2)| = |3 + 2| = |5| = 5 In Ruby and RGSS it would be coded like this: dx = (x1 - x2).abs #=> Integer dy = (y1 - y2).abs #=> Integer d = (dx + dy).abs #=> Integer The pipes there are a symbol for the absolute value, which will end up being used as distance. In Ruby we use the abs method instead. Integer there is a placeholder for any positive number, in this case there are no decimals nor fractions involved. #=> is just a Rubyist's way to tell you what might be its return value from a human perspective without executing that part of the code. # marks the beginning of an inline comment. The equation tells us that no matter which one you subtract from the other value, the absolute value remains the same and will always be positive. So if you get as a result -7 or 7, the real distance will always be 7. You only use the negative value as a way to tell the player or game dev if the direction is negative. How does that translate to RGSS or even JS in the RM series? It's quite simple. -X means to the left hand side while -Y will always be to the upper border of the game window. If you just need either the distance on the X or Y axis, you gotta skip the third line of code then. Well, I'm leaving here some interesting read for geeks just in case they care about weird programming stuff.
  11. kyonides

    VX Ace F12 Fix: Not Fully Functional

    module SceneManager def self.run begin DataManager.init Audio.setup_midi if use_midi? and !@skip_midi @scene = first_scene_class.new @scene.main while @scene rescue RGSSReset @scene.terminate if @scene @skip_midi = true clear retry end end end That would be my modified version of Kayzee's code, but you could still alias SceneManager.run if you like but it's not really necessary in this case.
  12. kyonides

    Hello everyone.

    So tell us about your game projects or ideas. What's your favorite engine?
  13. kyonides

    Understanding RGSS

    The Lack of Interest into Fully Understanding a Programming Language Many but many scripters around even to this day tend to misuse a feature of Ruby just because they found something similar in the default scripts. This has been true ever since RMXP came out as the first engine with some scripting capabilities and still returns every so often in VX Ace. Defining a Class or Module As I told you before, there is a simple way to create a class. module MyModule end class MyClass include MyModule end And you can even include modules, not just one but many in a row! Just separate them by using commas. So what's wrong with it? Nothing. It has been correctly executed there. What I would like to criticize now is the lack of knowledge those scripters have shown over the years. It all begins with stuff like this. class MyCommandWindow < Window_Selectable end Here many people fall in a trap that won't normally cause any issues except when they do it once again! Yes, they repeat the same declaration over and over again every single time they define what we call the Parent Class or Super Class. What it means is that MyCommandWindow is the Child Class of Window_Selectable, making it a window with menu features preincluded by default, even if they had been created in Window_Selectable only. And guess what? Window_Selectable class is a Child Class of Window_Base and the latter is the Child Class of Window! As you can see the list can go way beyond your imagination, really it does. But why do they keep repeating the same mistake over and over again? That's because they lack some insight of Ruby inner workings like the C side of Ruby code. Yeah, Ruby is run on C functions. Every single Ruby Object is a special C struct. The way I'll explain this issue is the following: declaring the class or module serves 2 main purposes. Define the class or module and its parent class or module (as in a module nested inside another module). Do this once if they do have a parent class. Reopen the class or module. That's it! Ruby isn't like Java. The latter made it overly complicated to extend certain basic features like printing stuff on a shell or console. Ruby just has OPEN CLASSES! That's a nice feature that lets us add as much stuff as deemed necessary and alias (keep a reference to a preexisting method) a given method at will. Downside: It might allow many people to rely on monkeypatching default classes as a way not to create child classes or delegate them to custom classes. In CRuby you would use a function called rb_define_class("MyClass", rb_cObject) instead. Modules don't need a second parameter: rb_define_module("MyModule"). Internally it's used to determine if a class exists. Otherwise, it'll look for functions like rb_obj_alloc and stuff like rb_class_new and even an initializer., which can be your very own custom function or call your Ruby initialize method. A Ruby side initialize definition will certainly overwrite a C side one. So whenever you repeat the whole statement, you keep telling the Ruby system that it should now check the parent class once again! Why on earth!? It kept it in memory and won't forget it as long as the program is running. Thus, it makes no sense to insist on declaring that there. And what comes next is especially directed at newcomers and slightly experienced scripters: stop doing it or you might end up making a mistake like declaring the wrong parent class! This issue is similar to another one that keeps showing up in newcomers' codes, the excess of checks by calling too many if or unless or case statements to get to a single point where they simply need to change a variable's value, especially common whenever they need to toggle switches. But this topic might be something that should be handled in a separate post...
  14. As a matter of fact I asked them to be kicked. Not joining that discord channel as a full member ever again. it's not worth my time. There was a recent case on RMW that made me wonder if the forumers there are really worried about some real troll or they were just uncomfortable to see that some unknown user was trying to make him or her slightly known there. They don't even mention that guy by nickname at all. It sounds like they could kick that forumer out of "valid concerns" on the forum's so called friendly environment. Yeah, probably the scripters and coders still available on the official forums are still there because of some $pecific motivation or because they're noob enough as to think that there's room for them there. It's not a toxic environment but I can't say it's really welcoming for it isn't. Being ignored seems to be the norm for not few of the forumers. And don't forget you've been banned on RMW not once but probably a couple of times already. Just get over it and behave like normal people do. People that don't wanna pick fights over non sensical stuff like you have been doing for quite some time. Why should you care about other people's mindset? What if they make an attempt to look foolish or smart or mysterious or anything else? It's up to them, it's not your life. Let them be.
  15. kyonides

    VX Ace F12 Fix: Not Fully Functional

    Well, Ron, it's hiddenchest indeed. All of the internal variables and constants prove it. I didn't notice the typo, but it's easy to fix it. They said somewhere else that mkxp-z was supposed to handle many but not all of the Win32API calls. I'm surprised to hear it doesn't. The only real advantage that mkxp-z seems to have is the scaling factor. Yet, that would only help if you plan to release pokemon like kind of games that use resources that are simply too small for XP or VX Ace. The only non pokemonic example I know about would be Drekirokr, a fellow countryman's pet project.
×
Top ArrowTop Arrow Highlighted