newttster Posted November 3, 2011 Share Posted November 3, 2011 I've been trying to figure this out for some time now and I'm still stumped on how to do it. For arguements sake ... we'll use an energy item. I have it set up on my staff_items that items can be level specific, which works great if you want the item to be specific to one level. What I can't figure out is how to get any item that can be used by all levels but with different percentages without having to add huge amounts of code to the itemuse file. For example ... an energy item used by a level 1 would give 100% energy whereas if the same item was used by a level 100 it would only give 1%. There has to be an easier way of doing this than adding millions (exaggeration) of lines of code. Any ideas? Quote Link to comment Share on other sites More sharing options...
Dominion Posted November 3, 2011 Share Posted November 3, 2011 Use a query to add energy = max_energy (check the names, but both are in the users table) to whoever uses the item. Not many lines needed. Quote Link to comment Share on other sites More sharing options...
newttster Posted November 3, 2011 Author Share Posted November 3, 2011 Well that completely lost me. How would you specify the levels and percentages that way as well as the specific item id? Quote Link to comment Share on other sites More sharing options...
Dominion Posted November 3, 2011 Share Posted November 3, 2011 Well that completely lost me. How would you specify the levels and percentages that way as well as the specific item id? With an if(), but actually you can ignore me. Why? Well in staff_items.php you have a drop down menu that says "pecent , and value" next to the amount? Just set it to 100%? Quote Link to comment Share on other sites More sharing options...
newttster Posted November 3, 2011 Author Share Posted November 3, 2011 I realize that I can do it in the staff_items menu but that would set it too 100% for all levels, does it not? Quote Link to comment Share on other sites More sharing options...
Dominion Posted November 3, 2011 Share Posted November 3, 2011 (edited) I realize that I can do it in the staff_items menu but that would set it too 100% for all levels, does it not? Sorry, must have read it wrong. Set it as an amount increase rather then a percent? Depending how your level:energy ratio works I suppose you could just use a math equation inside itemuse.php and play until you're happy with it. Edited November 3, 2011 by Dominion Quote Link to comment Share on other sites More sharing options...
newttster Posted November 3, 2011 Author Share Posted November 3, 2011 Same idea ... sets it to the same increase for all levels. I'm thinking what I might have to do is define a variable for the increase then do that if statement, as you suggested. $increase=(100/$ir['level']); If itmid =x then energy=energy + increase. But I'm still going to end up with a lot of code in the itemuse file ... depending on the number of items that I want to apply this too. I was just hoping that there might be a simpler way of doing this. Quote Link to comment Share on other sites More sharing options...
Nickson Posted November 3, 2011 Share Posted November 3, 2011 Well how about this, I don't know if this is what you are looking for but it popped into my head: add a database field of the type boolean to the items table, let's say we call it "inverse". When creating an item in your staff panel you could tick it. If it isn't ticked, it will be like the items are being used now. If it is ticked, you can use something else.. if( $inverse ) { // do action when the item should work inverse - high gain for low level - low gain for high level $increase=(100/$ir['level']); } else { // do action when the item should be the same for all } via this method, it shouldn't ask much extra code in your files, nor a huge change to the current items use.. Quote Link to comment Share on other sites More sharing options...
newttster Posted November 4, 2011 Author Share Posted November 4, 2011 *facepalms* Thanks for that, Random. Well .. it's back to the drawing board then for me. It's one of those things that is going to drive me nuts until I figure out how to do it right. Thanks everyone for your input so far. 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.