Jump to content
MakeWebGames

Stumped


newttster

Recommended Posts

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?

Link to comment
Share on other sites

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%?

Link to comment
Share on other sites

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 by Dominion
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...