Ending a battle after multiple specific enemies die

Verrillion

Villager
Member
Joined
Aug 1, 2016
Messages
21
Reaction score
1
First Language
English
Primarily Uses
So here is the situation: I am currently creating a game with a "large scale" military theme, and I am using the GTBS engine for the grid based battles. Although the problem I currently am faced with I THINK is done in the Troop management and I don't think should be directly involved with GTBS (but please tell me if I'm wrong).

What the problem looks like, is that There are a handful of enemy "armies" that you must defeat, and along with them are scattered camps and fortresses that are "buildings". What I want is that if there are 3 armies and 2 buildings, then the player will win after killing the 3 armies, and destroying the buildings are optional. Although the specific way I have it set up is that buildings are technically also units that just can't move and have only short ranged support abilities. Although battles won't end until every one is dead.

I tried several different ways of using conditions and switches to check for how many armies are still alive and to end when it notices that all of them are dead, but I just could not get this to work. I read up on some of the Forums and I've seen this topic a few times but I never found anything about setting this condition with multiple enemies.

I was led to believe I could do this just using conditions and switches with in the Troop Management or Common Events, but I do wonder if this is something that has to be handled in the GTBS script.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
at each turn end, check
Code:
SceneManager.scene.tactics_dead.select{|en| en.id == typeID}.size > number
where typeID is the enemy ID of your army, and number is the amount you need

although I'm pretty sure GTBS has a feature that lets you define which enemies to kill, as a victory condition.
and, I believe I've even set it up in my game as a test.... let me double check.
EDIT: it does.
check the Victory&Fail Condition section.
you might be able to adapt those functions to scan for specific IDs or amounts.
 

Verrillion

Villager
Member
Joined
Aug 1, 2016
Messages
21
Reaction score
1
First Language
English
Primarily Uses
wow, I can't believe I missed that. I've noticed that most of my posts seem to be having similar problems in missing these details.

Although it does arise a new question, So i'm going to try to use the Victory Conditions in GTBS because they seem infinitely easier, but when it comes to specifying the ID's, how exactly would I write it to include 2 different kind of units like 1 Infantry army and 1 archer army must be killed? and do I still need to specify what common event needs to be called?

and just to clarify I should be using "critical_enemy" condition correct?

I apologize if these are extremely beginner questions, I was currently working with some others on this project and our guy most informed about scripting totally bailed out so I'm trying to pick up the slack.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
if you go for the default script, I believe it validates once all conditions have been met
if not, you should check the functions themselves.
I just set it up to see if that feature was working, so I didn't do much testing, and I'm not familiar with the code.

for grabbing multiple IDs the traditional way:
Code:
ary = [[id1, n1], [id2, n2], [id3, n3], ... , [idX, nX]]
ary.all? {|nmyid, value|
 SceneManager.scene.tactics_dead.select{|en| en.id == nmyid}.size > value
}
I *think*.
again, flying blind here.
at most, it'll return false, but it shouldn't crash.
SceneManager.scene.tactics_dead definitely stores the fallen battlers, so, solving the problem is a matter of collecting and counting the dead.
 

Verrillion

Villager
Member
Joined
Aug 1, 2016
Messages
21
Reaction score
1
First Language
English
Primarily Uses
Thank you so much for the help. This is where I am at currently.

No matter how much I tried I just could not get "critical_enemy" to work, there is just something I don't seem to be understanding about its setup, although I did get condition "boss" to work and even work for multiple units just not different kind of units. As it stands I can put down like 3 infantry and I set them to be the "boss" but if I have 2 archers they are also exempt from the victory. It feels like I can make it work with the "boss" function if I can get it to identify 2 different kinds of "bosses" although I could also just use a proper example of what "critical_enemy" looks like, because I have a suspicion that its the key to what i'm looking for.

To elaborate on the "critical_enemy" problem

all GTBS victories have a kind of like formula, that looks something like: tbs_victory("boss", 39) or tbs_victory("reach", [17, 13])
and if any one knows how the formula for, tbs_victory("critical_enemy"~) is it would be greatly appreciated.

Although I must say thank you gstv87 for helping out it has gotten me a lot farther than I was, and will help me for later missions where I can use these exact conditions.

P.S. even if this wasn't exactly what I need I do appreciate any input because I'm looking to learn as much as I can for future projects and issues, and if any one has a good resource to point me towards for self learning that would also be wonderful.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
I think critical_enemy refers to major boss.
kill that one, everyone surrenders.

it should work the same as other conditions, because it's pointing to the same victory result add_vic_com
the difference being, with "boss" as opposed to "critical enemy" you get to fire a final sequence, and maybe keep fighting other enemies, and with "critical enemy" it just ends the fight.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,837
Latest member
Dabi
Top