nickfitzgerald3

Villager
Member
Joined
May 5, 2014
Messages
24
Reaction score
3
First Language
english
Primarily Uses
So I know random enemy encounters is obviously an easy task, but in my case i have about 12 different enemies that I want to appear randomly in troops of 3 but I cant find any way other than putting each individual possible combination of enemies into troops, which is VERY time and data consuming is their ANY way to do this easier, maybe a script or something im not seeing, please help [IMG]http://www.rpgmakervxace.net/public/style_emoticons/default/smile.png[/IMG]
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
266
First Language
English
Primarily Uses
My gut tells me no, because of the way the troop graphic is made - and even if you could do that randomly, it would look horrible unless you set it up with specific parameters for each combination. Do you really need every possible combination of three enemies? As you say, thats 12x12x12 = 1,728 combinations, some of which will probably be over or under powered anyway.  I can't think of any game off hand that's gone that far in generating random encounters.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,740
First Language
English
Primarily Uses
RMMV
Actually, yes, you could do it via scripts, and it would be pretty easy (Mouser, just find the line that creates the enemy in the troop, and pass a random number in the appropriate range instead of the id specified in the troop setup - the position on the screen would be the same).


I can't give you the code as I don't have Ace in front of me.


Would you ALWAYS want it to choose randomly? Is it only in certain areas? Is there anything that would cause a particular enemy to be more likely (or less likely) to be chosen?
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
266
First Language
English
Primarily Uses
Actually, yes, you could do it via scripts, and it would be pretty easy (Mouser, just find the line that creates the enemy in the troop, and pass a random number in the appropriate range instead of the id specified in the troop setup - the position on the screen would be the same).

Good to know - although you'd still need the battlers to be pretty close to the same size and shape though or I would think the picture would start to look 'off'. Great for thinks like different element flans and stuff like that though.
 

nickfitzgerald3

Villager
Member
Joined
May 5, 2014
Messages
24
Reaction score
3
First Language
english
Primarily Uses
Actually, yes, you could do it via scripts, and it would be pretty easy (Mouser, just find the line that creates the enemy in the troop, and pass a random number in the appropriate range instead of the id specified in the troop setup - the position on the screen would be the same).

I can't give you the code as I don't have Ace in front of me.

Would you ALWAYS want it to choose randomly? Is it only in certain areas? Is there anything that would cause a particular enemy to be more likely (or less likely) to be chosen?
It would only be in certain areas, no rush on it just whenever you happen to be in front of ace I have other things in my game to work on for now :)
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,740
First Language
English
Primarily Uses
RMMV
Okay, the easiest way, I think, is just to set up a troop that will be your "random enemy" troop. Whenever that troop appears in battle processing, it will choose the enemies that make up the troop randomly from your specified list.

I'm going to give you a hard-coded solution. It is not the ideal way to go about it - in fact if I was doing this properly I would set it up so you could use note tags or something to say which battles should have random enemies. But that would take longer to do.

So, allocate a troop id to your "random enemies" group, and choose any 3 enemies and place them on the battle background just like you were making a regular troop. Let's assume, for this example, you're going to use the 008 slot. (In the script we'll just use 8 - leave off the leading zeros). And let's say the enemies you want included in this troop will be chosen from 1, 2, 4, 5, 8, 9, 10, 11, 15, 16, 23 and 24. If the enemy ids were all in a continuous sequence the script could be altered slightly, but I'm leaving gaps so you're not restricted to having to set them all up in a row.

In your Game_Troop script, find this method:

Code:
  def setup(troop_id)    clear    @troop_id = troop_id    @enemies = []    troop.members.each do |member|      next unless $data_enemies[member.enemy_id]      enemy = Game_Enemy.new(@enemies.size, member.enemy_id)      enemy.hide if member.hidden      enemy.screen_x = member.x      enemy.screen_y = member.y      @enemies.push(enemy)    end    init_screen_tone    make_unique_names  end
and insert a new line (change the troop id and change the enemy ids to suit your needs) right before the next unless $data_enemies[...] line:
Code:
  def setup(troop_id)    clear    @troop_id = troop_id    @enemies = []    troop.members.each do |member|      member.enemy_id = [1,2,4,5,8,9,10,11,15,16,23,24][rand(12)] if @troop_id == 8 # <<<<< insert this line      next unless $data_enemies[member.enemy_id]      enemy = Game_Enemy.new(@enemies.size, member.enemy_id)      enemy.hide if member.hidden      enemy.screen_x = member.x      enemy.screen_y = member.y      @enemies.push(enemy)    end    init_screen_tone    make_unique_names  end
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

Another thumb update. The nail is beginning to break away, along with the aforementioned hard and blackened dead skin. The final join has regained some of its flexibility, tho it's a bit stiff after being held still for so long. The very tip of my thumb has a strange dry and somewhat tingly feeling to it when I touch it to something, but at least it isn't numb. I am so ready for this to be over. :o
Can I get away with calling a "shortsword" a dagger and not a sword?
So here's the full cycles, I'm not so familiar with actually animating and giving motion so any observation on that matter would be really helpful! :kaoswt:
EfGHbLh.gif

Just now I realized I didn't scale it up so its smol...
I wanna make a YouTube video about reviewing a game, but I don't know what RPG Maker game I should play...

Forum statistics

Threads
118,705
Messages
1,118,058
Members
155,836
Latest member
kijkmk
Top