Mcfarlin Posted February 4, 2016 Share Posted February 4, 2016 (edited) Mod Name: Gang Strongholds Progress:99% Completed (Testing Now, will post tomorrow in free mods section) Mod Developers/TradeMark: MCCodes Mod Status: FREE; Availability: MCCodes Version 2.0.5b Licence/terms off use: General public licence (GPL) About the mod and how it works: Gang Leaders will be able to buy a stronghold for a gang. Strongholds will cost XXX crystals to buy and come with a base stat bonus for all members. (5% STG, AGI ect.) Gang leaders can buy upgrades for the strongholds. Each upgrade will add another 5% to the selected stat bonus for all gang members. (while attacking) Bonuses will be capped at 25%. Screen Shots: http://postimg.org/image/z7ub3cxrd/ http://s16.postimg.org/r4ewlzdat/pic2.png http://postimg.org/image/55pbexokt/ <--- stats here are without bonus applied. http://s24.postimg.org/pgpei1q05/pic4.png <--- stats in this image are with bonus applied. Edited February 5, 2016 by Mcfarlin Quote Link to comment Share on other sites More sharing options...
Coly010 Posted February 4, 2016 Share Posted February 4, 2016 5% of what? The stat's current value or the value it is when the leader buys the upgrade? Also, if it starts at 5%, when the leader buys an upgrade, are you going to add a 10% bonus to the user's current stats (which already have a 5% bonus, causing it to be slightly over 10% bonus) or will you remove the old 5% bonus and add the new 10%. Which throws up another point, how you gonna know what is the old 5% of the player's stats? I've done something like this before so I know how I did it and the approach I took. I'd just like to see if you have everything thought out for it. And don't worry, please don't feel like I'm on your case all the time. If you can think like this when it comes to creating mods and other scripts, you'll be a good programmer. Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted February 4, 2016 Author Share Posted February 4, 2016 (edited) 5% of what? The stat's current value or the value it is when the leader buys the upgrade? Also, if it starts at 5%, when the leader buys an upgrade, are you going to add a 10% bonus to the user's current stats (which already have a 5% bonus, causing it to be slightly over 10% bonus) or will you remove the old 5% bonus and add the new 10%. Which throws up another point, how you gonna know what is the old 5% of the player's stats? I've done something like this before so I know how I did it and the approach I took. I'd just like to see if you have everything thought out for it. And don't worry, please don't feel like I'm on your case all the time. If you can think like this when it comes to creating mods and other scripts, you'll be a good programmer. I do not get discouraged by feedback so please keep it coming. okay as to your question though. say i have 100 in all stats. STR 100 AGI 100 GRD 100 Then my gang leader buys a stronghold for the gang. this one he got comes with a 5% bonus to Agility. This in turn makes my agility AGI 105 As the gang leader buys upgrades for the stronghold the bonus goes up according. maxing out at 25% on each. so the max i could get from this would be. STR 125 AGI 125 GRD 125 and no if you already have a 5% bonus you will not get 10% on top of that when your gang leader buys an upgrade to the stronghold. If your sharing i am interested in how you have done your version of this. Most importantly how you tied it into userstats. <-- This being the hardest part of it all IMO. Edited February 4, 2016 by Mcfarlin Quote Link to comment Share on other sites More sharing options...
Coly010 Posted February 5, 2016 Share Posted February 5, 2016 Well my solution was pretty simple really: Add an int(11) column to your gangs table called gang_bonus, or if you want to stick to the naming convention for that table, gangBONUS. at the bottom of your globals.php file if ($ir['gang']) { // player is in a gang. Now retrieve the bonus if any $sql = "SELECT gang_bonus FROM gangs WHERE gangID=".$ir['gang']; $bonus = $db->fetch_single($sql); $ir['strength'] = $ir['strength'] + ($ir['strength'] / 100) * $bonus; // etc... I have a quicker way using another SQL statement to pull the user stats and using a foreach with key and value variables but I thought this was the best to explain it. } Therefore it adds the bonus right at the beginning, so it still takes place and is in effect but you don't need to modify the user stats table Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted February 5, 2016 Author Share Posted February 5, 2016 (edited) I will PM you how i have done it in the screen shots above. I have this all running on a test server now, and all working 98% all i am missing now is tying the attacked players gang bonus into the attack. Hope to have this done and fully tested so i can post asap for all to have if they would like it. Turned out to be a lot more in depth than i had thought it was going to be to make it to this point i must say. I was never modifying the userstats table, not a smart play i think to play around with that table with active users. Edited February 5, 2016 by Mcfarlin Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted February 5, 2016 Author Share Posted February 5, 2016 Okay all done and tested. I have it working fully with one tiny thing missing from the original posting. I have not given the bonus to the defender in the attack. Only the attacker will get the bonus from the gangs stronghold in a fight. I want this to cause more fights, gang wars ect. . . Think of it this way, if you have 25% bonus and i have 25% bonus, what then is the point of the bonus in the first place? I feel this way it will matter more and be something players will want to have for the gang they are a part of. Heck might even get you a few more donations to get the crystals needed to buy the upgrades as well. I will test more and post tomorrow in the free mod section. Quote Link to comment Share on other sites More sharing options...
Coly010 Posted February 6, 2016 Share Posted February 6, 2016 Okay all done and tested. I have it working fully with one tiny thing missing from the original posting. I have not given the bonus to the defender in the attack. Only the attacker will get the bonus from the gangs stronghold in a fight. I want this to cause more fights, gang wars ect. . . Think of it this way, if you have 25% bonus and i have 25% bonus, what then is the point of the bonus in the first place? I feel this way it will matter more and be something players will want to have for the gang they are a part of. Heck might even get you a few more donations to get the crystals needed to buy the upgrades as well. I will test more and post tomorrow in the free mod section. The point being that they still earned the 25% bonus. as its a percentage, the two player's aren't gaining the same absolute value. for example. I have 200 defence and 25% bonus. Therefore i gain 50 bonus defence making me have 250. you have 100 defence and 25% bonus. You gain 25 bonus, giving you 125. See what I mean? If you don't give both players the ability of having their bonuses in the fight then I would be fighting you with 250 defence because of my bonus, yet you would only have 100, which is a lot more unfair. Quote Link to comment Share on other sites More sharing options...
Mcfarlin Posted February 6, 2016 Author Share Posted February 6, 2016 I will post it as is, if anyone would like to add the bonus to the defending player please feel free. I like it as is and will use it like it is set up in the post. Others may not want it this way, feel free to post your edits to the mod for others. Thx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.