Need some help Implementing a Customer Fighting Mechanic
Im working on a fantasy tavern management game, where customers can go to your tavern, buy drinks, take a seat and drink on tables etc
Right now im stuck on a specific feature, Fighting...
Overall a Customer will try to fight if said customer cant find a seat , then the customer will approach a random customer and fight with him, All the customers on the table will start fighting the "Challenger" (Customer that couldnt find a seat and is now fighting a random customer that has taken a seat and is drinking at a table ) , Now i had no trouble implementing Customer VS Challenger fighting
My Issue is how could implement more than 2 customers fighting the same challenger? and vice versa, another Customer that has no seat will pick a random customer to fight, there is still a small chance that this other challenger could pick the same table where a fight is alredy going on, they can attack the same customer with no problem but how do i deal with picking a new target ON the same table after they killed one of the customers?
For the record, challengers keep fighting customers that have a seat on the table if there are still customers to fight, else they just roam arround
I have made about 4 rewrites of this feature so far and all of them end up in crashing or just not working.. i tried using a Sphere in each table that holds all the customers currently in the table but then damage dealing becomes a mess becouse both customers and Challengers need to loop trough all the pawns in the sphere, make sure the index is valid and what not. Hence why im here asking for a good way to implement this feature
TLDR, the flow of a fight is
->Random Customer has no seat and triggers a fight with a random customer that has a seat and is drinking on a table ->All customers on the table will start "fighting" / dealing damage to the challenger
->More than 1 challenger can be fighting a customer on the same table
->After a customer has been killed by the challenger, the challenger will pick a new customer on the same table, if it cant find any it will stop fighting
->Same goes for customers, if they kill a challenger they pick a new challenger if there are any on the table
I Have the overall logic layed down, im just stuck on the "Grab a challenger / customer on the same table after you kill the current one " part.
Here is my code so far (Just triggering the fight and damage dealing, no new target picking )
As usual any sort of help is always appreciated!
a TableManager contains a list of all tables, and each table contains a list of seats (character references).
instead of using a character reference as a parameter for your StartFightAgainst function, you should use a table reference.
any time you have a valid EnemyTable but you don't have a valid CurrentEnemy, you go through the EnemyTable's list of seats looking for an enemy. if none are valid, you pick a new random table from the list of tables.
answered Apr 20 '15 at 08:23 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here