Posts: 4,606
Threads: 543
Joined: Dec 2009
Well, I took a break of developing my KGuardian script and begun coding my new KCheckEventByCoords script. It will spare you the need for looping through all map events by searching that specific event by its coordinates.
After a while I updated it so that topic now includes a second version that allows RMXP game devs to assign a different trigger key for specific map events. The good thing about it is that it does NOT replace your old friend the OK button trigger functionality. Map events that are supposed to be triggered by pressing OK button will still work as normal without making any effort or any changes. Actually it does take advantage of my original idea.
Edit:
I updated the scripts once again to add a script call and fix some minor bugs.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Posts: 4,606
Threads: 543
Joined: Dec 2009
I finished porting my KItemRefill script to VX, so there is one version for XP and another one for VX. I don't know if I'll port it to VX Ace some day. I also updated my script KElemRES XP, it reached version 0.8.16 and 0.8.17 when Melana showed up because she was quite interested in implementing it on her own game project. Later on I posted a more complete version (0.9.0) of my script that already includes a menu so game dev's and players can convert resistance gems to any other resistance gems.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Posts: 400
Threads: 13
Joined: Mar 2010
For the past while I've been struggling with the weirdest bug that emerged while making my "pure RGSS enemy AI" thingy.
If an enemy is in a confused/berserk state and the skill they use (normally only Attack) costs MP they don't have, even after they just paid the cost, the action is negated. Since it gets negated, there is no active skill (even though they already "passed go"), no targets, and the following error occurs:
Scene_Battle, line 584, NoMethodError
undefined method 'make_targets' for nil:NilClass
The line in question:
targets = @subject.current_action.make_targets.compact
This error happens because... somehow... the current_action has been erased the moment before it was used.
It took me a lot of messing around to be able to recreate this bug in a fresh project - it wasn't to do with my custom AI or anything, it was... to do with my "tiredness" script? It adds/removes a Tired state for "critical" MP. Like, literally all it is is this:
PHP Code: <?php
class Game_BattlerBase
alias :tayruu_tiredness_gamebattlerbase_refresh :refresh
def refresh
tayruu_tiredness_gamebattlerbase_refresh
mp_rate <= 0.25 ? add_state(2) : remove_state(2)
end
end
I have no idea as of yet why this code would do this? It's also possible refresh isn't the best place for this code (even though this is where the dead state is refreshed too).
EDIT: ...
PHP Code: <?php
class Game_Battler < Game_BattlerBase
def add_new_state(state_id)
die if state_id == death_state_id
@states.push(state_id)
on_restrict if restriction > 0
sort_states
refresh
end
def on_restrict
clear_actions
states.each do |state|
remove_state(state.id) if state.remove_by_restriction
end
end
Okay, when the tiredness state is added, the game ends up passing through add_state, add_new_state, on_restrict, and then clear_actions. While "tired" is unrestricted, because the enemy has another restrictive state (confusion qualifies), it then clears the action. It does this at the moment of paying MP, but before the action itself, thus the crashing bug.
... so the answer to that is to probably move the add/removal to tiredness to somewhere like end-of-turn instead of refresh. Maybe?
Posts: 400
Threads: 13
Joined: Mar 2010
I have been toying with my game's enemy AI. Yes, that's obvious from the above, but now it's done on one level. I can add tags to skills that will tell an enemy only to use them on targets with X state, without X state, or immune to X element. (I intend to add more, perhaps, like only healing allies at a certain hp_rate?) The script tells the enemy whether to try to use it, and then restricts its specific targets only to those that are relevant.
It's cleaner than my original method that used two different AI scripts and both skill and enemy notebox stuff. Now it's one script and only skill notebox stuff. The script feels rather short too... makes me wonder if there's some fatal oversight. @ -@
The next level for this script is the ability for AI to be based on straight ruby/RGSS. I've got this to work but, as I've said in the shoutbox, I currently have the script stored as an external .rb file for the sake of convenience. (I mean I guess it could be stored with the rest of the scripts in the Script Editor...) I was hoping to save it to an rvdata2 file, but as I'm dealing with code itself over more sensible objects (i.e. strings) I'm not sure it's simple.
However since I can now have enemies use (support) skills a bit more smartly, I can probably deal with RM's basic AI roulette for now... I really need to not obsess over code like this or I'll never progress with the rest of the game...
Posts: 449
Threads: 18
Joined: Sep 2015
Enemy AI is a special thing, if you ask me.
Most of the times there is no need for a real AI in bossfights because bosses usually have a static behaviour which can be analyzed by the player to be successful in the end. The boss compensates it with powerful attacks and a large amount of HP.
But when it comes to equal groups of enemies whith the same possibilities as the players group It can be really nice to have an AI. So the fight is more challenging.
I played around with enemy AI in the past and created an enemy group with exactly the same setup of party members and skills as my group. They also had the same stats as my heroes.
Without any AI it was really easy to beat them, so I started to play around with the usual battle conditions, since I'm not good enough to write a script in ruby for something like that.
Afters some hours of testing and improving it was a challenging battle. They were able to deal focus damage, cure states like poison, silence, paralyze etc., healing party members with low HP, resurrect their party members when they were dead and also execute some simple combos like that: the fastest member of the group resurrect his dead friend, then the second heals him up and the third one casted a shield spell on him to protect him from further damage.
Of course it was not perfect and sometimes they did some really dumb things because the priorities are really difficult to handle. But I was satisfied with it so far.
That battle had something like 30 pages in the end.^^
Posts: 400
Threads: 13
Joined: Mar 2010
Dealing with priorities is partly why I created a script to decide skills based on scripting alone. I mean, on top of combination conditions.
The enemy I've been testing with this system has an AI like this for example:
Code: if your turn is equal to troop size and you have full HP
berserk yourself
if you're not berserk
use Devile (cures basic ailments)
if (mp is low and rand(3) is 1) or mp is *really low*
rest
use attack
if you *are* berserk
if flag is off
use special A
turn on flag
if flag is on
use special B
turn off flag
if all else fails, return nil
No that's not my original code, I just wrote it as more human-readable to explain it. :B After each use skill line is a "return if item" line, this checks if the skill can be used and if there are targets. (If not these have already been cleared.) Since the alternative is to skip "return", the script continues to the next line/skill.
This lets me say basically "if x, use this skill, if not, try this skill, if not..." instead of the more ambiguous "Ratings" the editor gives me.
Giving an enemy its own allies (or even several turns) allows you more leeway with regards to AI/strategy. Bosses are often only on their own, so they can be a bit dumb brute force. This enemy for example will cure ailments, and thanks to my previous mentioned code it will only make sure to do this if anyone actually needs curing.
Posts: 4,606
Threads: 543
Joined: Dec 2009
I think Taylor once said here or on the chatbox that the RPG Maker (VX Ace perhaps?) didn't include custom rb files in encrypted package for distribution but my KyoJournal XP script would say otherwise if we were talking about RMXP específically. It has been reading info I saved in 7 binay rb files while not using RGSS1 but Ruby 2.2.x instead. I wonder if something changed drastically between RMXP and RMVX Ace.
Oh they were located in Data directory. If RMXP finds any rb file in the same location as Game.exe it doesn't include it nor compress it.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Posts: 11,229
Threads: 648
Joined: May 2009
Well, that sucks for Ace users if that's the case.
I mean, custom data files (like .rxdata) that are recorded in the same manner as the default ones can be included your game's encrypted/compressed package as long as they are in the Game's data folder for XP and VX. I worked to get my old Grouping and Details system to have encrypted data as the old OLD details.txt never encrypted.
This is much the same way as creating a new 'Cache' for a new graphics folder (like Graphics\Faceset, Graphics\Hud). Now if we could only do it for audio (like make a VoiceOver folder :P ), we'd be set.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
Above are clickable links
Posts: 400
Threads: 13
Joined: Mar 2010
When I made a compressed file my glossary ran fine - so the Glossary.rvdata2 was compressed.
Are you saying that your RMXP project compressed the .rb files fine when they were in the Data folder, but not in the root? That's weird. When I compress my VXAce project, it basically includes everything - and compresses Data/Graphics. What this does is it ends up including the (temporary) .rb files, a credits.txt, and the save files since I store them under System with a different naming scheme.
I think what I'm getting is that either VXAce will not encrypt anything in the Data folder that isn't a data file... or it does, but the script I use to load external scripts cannot load the .rb file from inside an encrypted package.
I just did a few encrypting tests and I found that renaming the .rb file to an rvdata2 file worked. ... and then so did the .rb file un-renamed.
... maybe there never was a problem. Maybe I messed up in my own code somewhere. > .>;;
Posts: 4,606
Threads: 543
Joined: Dec 2009
I was trying to implement the openness feature in RMXP the Ruby way, no dll included, and for a short period of time I thought I was close to achieve my goal until I met my scripting nemesis, the stupid y-coordinate distortion caused by a change in initial height in vertical alignment or an x-coordinate distortion in initial width in horizontal alignment. So far I haven't found the factor that determines how small or big this axis distortion will be. I just know it gets higher the higher the original x or y position value is.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
|