Click here to Skip to main content
15,068,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a set of guns in my database Gun_1, Gun_2, Gun_3, Gun_4, Gun5, Gun_6, Gun_7 & I also have a followers table in my database of Fol_1, Fol_2, Fol_3, Fol_4, Fol_5

I'm trying to set up an attack script where it goes thru finds the highest gun owned, & then compares it to the number of followers you have if you don't have enough guns for followers.

I want to be able to add the guns they do have to their strongest followers IE Fol_5 and then 4 if there are enough guns for fol 5 and some of 4, but during the attack, all followers that don't have guns are lost immediately no damage done.

This also has to compare for the attacker & defender. gun damages are as followers 15, 30, 45, 60, 75, 90, 105 follower health is as follows 25, 50, 75, 100, 125.

Basically, once the attack goes I want it to compare guns to followers give the appropriate followers available guns then compare attackers' strength to defenders defense if strength if 15% higher than defense the attacker's followers get to attack first.

Then the script will use gun damage vs follower health to determine what followers are lost during the attack.

If anyone can help me out in figuring out how to go about this I'd greatly appreciate it I been stuck on this for days. I have not written any code because I just cannot figure out how to go about all this.

What I have tried:

I have only been thinking about trying to get started on this I need a push in the right direction. I fear I'm going to need to use Loops & they are not easy for me to grasp.
Posted
Updated 21-Jul-20 22:14pm

1 solution

Yes, you need loops, conditional tests, classes, objects etc. But this is the Quick Answers forum, there is not the space or time to teach you all those subjects. Get hold of a book, or try the PHP Tutorial[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900