RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
How to display battle enemy name/numbers?

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 82
We learn by living...
p $game_troop

so I put this into my common event triggered by a skill, to check the data on the enemies to see if I could figure out what their enemy target number (in battle, not in the database) was, but i couldn't figure it out. i mean their hit points, name, which troop # they were, and so on all displayed, but I couldn't tell what differentiated zombie 1 from zombie 2.

Any ideas?

I'm trying to set up some custom skills that can target different enemies in battle and display the name of the enemy you are targeting in a loop, so if you had three enemies on the screen, two zombies and a lich, it would basically say something like
"zombie"
"zombie"
"lich"

zombie --> zombie --> lich

and then loop back to zombie.

If I could get it to display something like

'zombie[1]'
'zombie[2]'
'lich'

That would be even better, but I'm not picky.


*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Code: [Select]
$game_troop.enemies[Enemy_ID].name

Of course, you can then set that as a variable and call it at will. For example, if I was battling a troop with a Ghost and a Sahagin, $game_troop.enemies[1].name would return Ghost.

You could also modify the .name part to other things, such as .base_atk.
« Last Edit: June 06, 2010, 04:46:05 AM by cozziekuns »

***
Rep:
Level 82
We learn by living...
Code: [Select]
$game_troop.enemies[Enemy_ID].name

Of course, you can then set that as a variable and call it at will. For example, if I was battling a troop with a Ghost and a Sahagin, $game_troop.enemies[1].name would return Ghost.

You could also modify the .name part to other things, such as .base_atk.

your version looks better than what I've come up with, but I'm wondering,
Is this different from game_troop.member_index?

***
Rep:
Level 82
We learn by living...
I just realized 0 = 1 in the program, so displaying different mobs 1-3 would be

p $game_troop.enemies[0].name
p $game_troop.enemies[1].name
p $game_troop.enemies[2].name

Now if I only could remember how to stick those data bits into a variable.

***
Rep:
Level 82
We learn by living...
I just realized 0 = 1 in the program, so displaying different mobs 1-3 would be

p $game_troop.enemies[0].name
p $game_troop.enemies[1].name
p $game_troop.enemies[2].name

Now if I only could remember how to stick those data bits into a variable.

well, using ccoa's \v[variable #] thingymabob I came up with this.


Code: [Select]
$game_variables[404] = $game_troop.enemies[0].name
Text: the target is \v[404]

and it works great in battle ^^

***
Rep:
Level 82
We learn by living...
I found out if you query the name of something that doesn't exist, the game crashes. Is there a way to check the number of monsters loaded so the loop doesn't exceed that value?

It sounds like I need a for-loop.


I tried something like this:
Code: [Select]
$game_troop.enemies[3].name.blank?
$game_variables[405] =
$game_variables[406]
else
$game_variables[405] =
$game_troop.enemies[3].name

end

but it wasn't as functional as

Code: [Select]
if $game_troop.enemies[2].name != ""
$game_variables[405] =
$game_troop.enemies[2].name
end

which also doesn't work for enemies[3], and crashes just the same, but at least it sort of works. The basic problem is called

Code: [Select]
'undefined method 'name'

I'm not certain  but I length monsters are loaded through an array similar to push/pop, and if I can check the game_troop.length or something similar to tell me the array length, I might be able to restrict how many monsters I can target.
« Last Edit: June 06, 2010, 10:28:04 PM by shintashi »

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Yeah, something like:

Conditonal Branch: (Script): $game_troop.enemies[0] != nil
 $game_variables[1] = $game_troop.enemies[0].name
Branch End
Conditonal Branch: (Script): $game_troop.enemies[1] != nil
 $game_variables[2] = $game_troop.enemies[1].name
Branch End

And just repeat until you get to the max number of enemies (10 or so).

Oh yeah, there's probably a better method if I recall correctly, but this should work all the same.
« Last Edit: June 06, 2010, 10:42:33 PM by cozziekuns »

***
Rep:
Level 82
We learn by living...
Yeah, something like:

Conditonal Branch: (Script): $game_troop.enemies[0] != nil
 $game_variables[1] = $game_troop.enemies[0].name
Branch End
Conditonal Branch: (Script): $game_troop.enemies[1] != nil
 $game_variables[2] = $game_troop.enemies[1].name
Branch End

And just repeat until you get to the max number of enemies (10 or so).

Oh yeah, there's probably a better method if I recall correctly, but this should work all the same.

yeah, like that, but sort of different. This is what I got,

Spoiler for sequential:



haven't tested it yet, but I need to be "choosing" rather than "sorting" and right now i'm trying to figure out how to get choices to exist in a common event that isn't set to parallel or autorun. Do you know how to use label/jump to label? Because they seem like they could give me a temporary loop without having to create multiple event pages for sorting.

edit: tested what's above: strange effect, when you kill a monster on the end, like monster number 3, the game doesn't remove them from the list, so when you cast the spell after they are dead, it still detects them, even though they aren't on the screen. This is an even better reason to have select-ability.
« Last Edit: June 06, 2010, 10:52:44 PM by shintashi »

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Code: [Select]
Conditonal Branch: (Script): $game_troop.enemies[0] != nil
 $game_variables[1] = $game_troop.enemies[0].name
Branch End
Conditonal Branch: (Script): $game_troop.enemies[1] != nil
 $game_variables[2] = $game_troop.enemies[1].name
Branch End

You could just use this -.-, dunno why it's not working for you. But whatever, labels are labels. Jump to label means your jumping to that position.

So, something simple like:

Label: A
Text: Variable + 1
Control Variable: [0001: Label Variable] += 1
Conditional Branch: Variable [0001: Label Variable] == 3
Text: Variable equals five
else
Jump to Label: A
end

Which would repeat until the variable 1 equaled three.

***
Rep:
Level 82
We learn by living...
thanks much on the labels. Your version of the conditional !=nil is better in retrospect. I'll be programming more on this stuff after my final tonight.