Drop item loop idea
#1

Hi I did a drop system that works perfectly... I want that when you reach the maximum number of drop, if it is still-dropped another item the older one disappears. A sort of infinite loop. Can you give me some idea how to make this? Or you can give me a link FilterScript that does this, so reading the code, I understand how to do it.
Reply
#2

You can create an array sort of like this

PHP Code:
#define MAX_DROPS 100
new drops[MAX_DROPS
Then when you drop something, set change the drop value. And then loop thorough all of them. Then MAX_DROPS has reached, Then basically delete the first drop and put your drop in the first one.
Reply
#3

I have thought about this, only that others must climb. Then the second drop becomes the third, the third drop becomes the fourth, etc ..
Reply
#4

Why is there a drop limit, though?
Reply
#5

Because I don't want 500000 drop on my server. Too lag...
Reply
#6

Edit: Nevermind, I thought it was going to be for per player. But it's global.

What you can do is add a count, when it reaches the last ID, put all the items one index down and at the last index add the new item.
Reply
#7

That's fully programming logic, you need to visualize in your mind how your algorithm needs to behave, so you can just code your system based on it. You need to loop, use the logic to detect which item you want to replace. I don't know if it will help you but I made an advanced drop system for my old gamemode, which is released for free on my github account, you can just check it here (drop rate system) and here the main inventory file, there are also other archives, but it's a bit complex to understand, that's not exactly what you're searching for but it can help you in any way.
Reply
#8

for(new i = E_MAX_DROPS; i > 0; i--) {
E_DROPPED_ITEM[i+1] = E_DROPPED_ITEM[i];
}

E_DROPPED_ITEM[0] = droppeditem;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)