you can check the troop with
$game_troop.members.each do |enemy| id = enemy.enemy_idthere you can check the ID's and do your stuff.
I know about the id but what I am asking for is not the ID of the enemy but the number. Is it the first one on the rank? the second? the third? And so on.
oh... yeah, to get the 4th member of the troop you can simply do this
enemy = $game_troop.members[3]$game_troop.members[3] is the 4th enemy since it starts counting at 0 ...
I'm not sure what number you actually wanted, so I'd add some suggestions:
enemy.index
returns the enemies position in the troop, zero corresponds to the first position.
$game_troop.members.count { |member| member.id == 1 }
returns how many members in the troop have id 1 (including dead/hidden members).
If you want to exclude dead enemies from the count, use $game_troop.alive_members instead.
Ahhh that is very interesting. That is one way, hmmm. I have another question. Is there a possible way to use this as a check so whenever you select an enemy to attack, you can't select someone in the index of 4 and above?
You could, if you would modify the methods that handle the targetting. On my custom battle system I made the targetting system to be able to run RGSS3 lines to determine which battler can be targetted.
Do you just want to prevent the player to select that enemy in the action selection phase? Or do you want to prevent the enemy from getting hit by any attack?
In the first case, you can modify the Window_BattleEnemy class, which provides the enemy selection window:
The superclass Window_Selectable already provides a method to decide if an item shoud be selectable. You can overwrite it for this purpose:
class Window_BattleEnemy def current_item_enabled? not enemy.state?(18) # Example: Selected enemy can't be chosen when inflicted with state 18 endendDifferent battle systems may implement the target selection differently though.
Thanks Another Fen. Yes, I would want to prevent the actors from killing or hitting those enemies that are under the number (or index) of 4 and above. It means I can only target 1 - 3. If they die, then I can target anyone among them who changes their index as the other ones are killed. For example, I have:
Slime A (index 1)
Slime B (index 2)
Slime C (index 3)
Slime D (index 4)
In battle, I can't target Slime D (slime D can still attack me btw)... then suddenly, I killed Slime B. Therefore:
Slime A (index 1)
Slime C (index 2)
Slime D (index 3)
So I can strike all of them now here.
How do I achieve this?
Hmmm, thanks for the answers. So does that mean there should be a state 18 inflicted to them right at the start of battle?
@Another Fen
Yeap, the error message that showed was basically what was in the picture if I remember correctly!
Yeah, I'm with Dekita on that one. not might be more human-readable, but ! is more common - I had to stop and think about the not for a bit.
That IS a side view battle system. It doesn't have to be complicated like actors with different poses/behaviours, moving forward/backwards/to the enemies, throwing things. It can be just actor sprites on the battle field, either animating, or not.
Yes, still using not, and and or is a bit of a bad habit I think. I see less people using it either, especially since even the VXAce started using the symbols in its standard scriptset, so I have to somehow agree with Dekita/Shaz.
@Milena:
You can enable battler sprites for battlers by changing the definition of the use_sprite? method of Game_Actor. In addition, even if you don't plan to make your actors move across the screen, you'd still have to provide suitable methods for screen_x, screen_y, screen_z and battler_name. If you want to animate your battler characters instead of giving them a static image, you'd have to implement that as well (unlike map characters, battlers are not constantly updated by default and use a different sprite type).
@Jestereir:
Without the exact error message I can't tell for sure which script command caused the commotion of course, but chances are its because of a command from Galv's Character Effects. While I'm still not sure why the event was executed before switching to the map, you should be careful when using those commands while calling a menu screen from another event.
If it was the fault of the Character Effects script, you could fix that issue by modifying the script a bit:
Search for this line
SceneManager.scene.spriteset.refresh_effects
and add
if SceneManager.scene_is?(Scene_Map)
to the end of each occurrance (three of them already end with if refresh , you don't necessarily have to "fix" those here).
I am just curious, I implemented "Khas Awesome Lights" script and with this script I am able to make a player lantern (as mentioned in the script).
Now I wonder, can I make more than just one lantern... so my question is: is the command $game_map.lantern provided by RPG Maker or is it something Khas built in??
Khas added it, best to make a thread for it if you require further help 🙂
okay, I try it and open new thread. ^^
You don't need to open a new topic.
I can tell you that it is not possible to make more than 1 lantern effect.
Khas is working on a new script, maybe that will include that feature.