Questions about heavily-scripted battles...

I plan to use troop scripting to make battles feel more like puzzles than straight up fights, but I have some questions about how I can best go about this...


1. I've been using Yanfly's action sequences to aid me in changing the appearance of enemies depending upon their state. For example, an enemy that is standing will not be vulnerable to certain attacks but will become vulnerable when knocked down. I've thus far been able to accomplish this effect by despawning the standing enemy, playing an animation on top of it, and then spawning in its fallen version on the same location, but I can't imagine there isn't a better way than this.


Is there a simpler way to change the appearance of an enemy when changing its state?


2. I'd like very much to be able to have on-use effects depending upon which target the player has chosen.


For example, if the player has decided to use a fireball spell on a fire spirit, I might want the character to shoot down the idea, triggering a dialogue that says, "Fire spells don't work on fire spirits..." and preventing the action from happening.


I found this in Yanfly's docs, but I have no idea which variable the "target" would be:


if $gameSwitches.value(1)


action effect


else if $gameSwitches.value(2)


action effect


action effect


else


action effect


action effect


action effect


end


Does anyone know what I might replace "$gameSwitches.value(1)" with in order to change the action based upon which enemy target is being selected? The exact variable I'm looking for has been hard to track down (I'm guessing it has something to do with the enemy index but still can't find it...).


3. Speaking of target variables, is there a replacement variable we can use in the skill section that will automatically insert the name of the target of the ability? For example, I'd like the battle log to print "Bob uses petrify on bat!". Is there something I can insert that will automatically be replaced with the name of the target? (I've tried "(target)", %t, etc. with no luck).


Thanks in advance to anyone who can help! //rmwforums.s3.amazonaws.com/emoticons/default_smile.gif
1. There is no easy way, but you should try Yanfly's SVAnimatedEnemies plugin. It allows you to substitute enemies with an animated sprites, and if I'm not mistaken, it should also give you the option to specify "Abnormal" and "Sleep" sprites to use for certain enemies. I'm not 100% sure, but you should look into that plugin.


2. In Yanfly's Action Sequences, the "target" and "user" variables are exactly that - "target" and "user". In other words, you can use them as is. For example, to check for the state of a target, use "target.isStateAffected(14)" and replace "14" with the ID of the state you want. To check whether the target is which type of enemy, try "target.enemyId() === 7" or whatever.


You do need to know Javascript and RMMV's program structure a little to find the functions/parameters you need to check for. If you want to check for something else, give a PM and I'll help you look for it. If you're interested in digging yourself, the fastest way is to take a simple plugin and try to understand it.


3. I don't think so, but if you're using Yanfly's Action Sequences plugin, you can try the following code:


eval: BattleManager._logWindow._lines.push( "something something " + target.name() );
eval: BattleManager._logWindow.refresh()


Put it within Target Action notetags, for example. It will print "something something Slime A" to log. If you want to take out "A", use "target.originalName()" instead.
1. There is no easy way, but you should try Yanfly's SVAnimatedEnemies plugin. It allows you to substitute enemies with an animated sprites, and if I'm not mistaken, it should also give you the option to specify "Abnormal" and "Sleep" sprites to use for certain enemies. I'm not 100% sure, but you should look into that plugin.


2. In Yanfly's Action Sequences, the "target" and "user" variables are exactly that - "target" and "user". In other words, you can use them as is. For example, to check for the state of a target, use "target.isStateAffected(14)" and replace "14" with the ID of the state you want. To check whether the target is which type of enemy, try "target.enemyId() === 7" or whatever.


You do need to know Javascript and RMMV's program structure a little to find the functions/parameters you need to check for. If you want to check for something else, give a PM and I'll help you look for it. If you're interested in digging yourself, the fastest way is to take a simple plugin and try to understand it.


3. I don't think so, but if you're using Yanfly's Action Sequences plugin, you can try the following code:



eval: BattleManager._logWindow._lines.push( "something something " + target.name() );
eval: BattleManager._logWindow.refresh()


Put it within Target Action notetags, for example. It will print "something something Slime A" to log. If you want to take out "A", use "target.originalName()" instead.



My...god... Thank you SO...MUCH!! I beat my head against #2 for most of Saturday with no luck. That works PERFECTLY!


As for javascript, yeah, I'm very much a beginner, but you basically summed up my strategy when it comes to learning any programming language: examine existing code, change variables, see what changed after running it. It's how I taught myself HTML and how to use CSS.


I'll probably take you up on your offer of which parameters to change. The type of battles that I'm aiming for hopefully shouldn't require TOO much in the way of fancy code, but there are a few other quirky mechanics I'll likely add here and there.


Again, thank you ever so much!
Also, is there a way to turn logging on in MV or is there a log file it's dumping to somewhere that I'm missing?


I'm guessing this would be a great deal easier if I could see what the program is trying to do prior to the error rather than just the error itself....
Also, is there a way to turn logging on in MV or is there a log file it's dumping to somewhere that I'm missing?


I'm guessing this would be a great deal easier if I could see what the program is trying to do prior to the error rather than just the error itself....



You mean the debug console? Try F8 when the game is running.

Original thread: https://forums.rpgmakerweb.com/threads/questions-about-heavily-scripted-battles.58105/