• Content count

  • Joined

  • Last visited

  1. Forgot to mension that with this solution you need to add "Delay: 1" in itemdb_conf to work.
  2. Thank you for your help. Actually I didn't understand what you mean with "add a variable on sd", but after hours of trouble I came to a solution that works: if( sd->inventory_data[n]->delay > 0 ) { ARR_FIND(0, MAX_ITEMDELAYS, i, sd->item_delay[i].nameid == nameid ); if( nameid == ITEMID_RED_POTION || nameid == ITEMID_YELLOW_POTION || nameid == ITEMID_WHITE_POTION ) { sd->item_delay[1].nameid = ITEMID_RED_POTION; sd->item_delay[2].nameid = ITEMID_YELLOW_POTION; sd->item_delay[3].nameid = ITEMID_WHITE_POTION; } if( i == MAX_ITEMDELAYS ) /* item not found. try first empty now */ ARR_FIND(0, MAX_ITEMDELAYS, i, !sd->item_delay[i].nameid ); if( i < MAX_ITEMDELAYS ) { if( sd->item_delay[i].nameid ) {// found if( DIFF_TICK(sd->item_delay[i].tick, tick) > 0 ) { int e_tick = (int)(DIFF_TICK(sd->item_delay[i].tick, tick)/1000); // clif->msgtable_num(sd, MSG_SECONDS_UNTIL_USE, e_tick + 1); // [%d] seconds left until you can use return 0; // Delay has not expired yet } } else {// not yet used item (all slots are initially empty) sd->item_delay[i].nameid = nameid; } if( sd->item_delay[1].nameid == ITEMID_RED_POTION || sd->item_delay[2].nameid == ITEMID_YELLOW_POTION || sd->item_delay[3].nameid == ITEMID_WHITE_POTION ){ sd->item_delay[1].tick = tick + 5000; sd->item_delay[2].tick = tick + 5000; sd->item_delay[3].tick = tick + 5000; goto limpartudo; } if (!(nameid == ITEMID_BOARDING_HALTER && pc_hasmount(sd))) { sd->item_delay[i].tick = tick + sd->inventory_data[n]->delay; } } else {// should not happen ShowError("pc_useitem: Exceeded item delay array capacity! (nameid=%d, char_id=%d)\n", nameid, sd->status.char_id); } //clean up used delays so we can give room for more limpartudo: for(i = 0; i < MAX_ITEMDELAYS; i++) { if( DIFF_TICK(sd->item_delay[i].tick, tick) <= 0 ) { sd->item_delay[i].tick = 0; sd->item_delay[i].nameid = 0; } } } I wonder if you could help me with a better solution, because my code is an outrage to the community. hahahahahah I thank you all for the good cooperation!
  3. Hi, i'm having difficulty with Items Delay. I wonder if you could help me on my post.

  4. Hi, i'm having difficulty with Items Delay. I wonder if you could help me on my post.

  5. Yes I was doing this, but if I put 5 seconds delay on each Potion, would be possible to alternate using Red then Orange then Yellow then White Potion. So the character would spam potions anyway. I was looking for something on pc.c file but I don't know much about the commands.
  6. I think it is almost impossible, because you would need a new custom item for each equipment. You can't recreate the item changing the equipment location using the same ID. Maybe I'm wrong, but I'm almost sure of it.
  7. This way will create a delay for all items, so I won't be able to use other items like Yggleaf etc. Nevertheless, I appreciate your comment.
  8. Hi, I was trying to create an item group delay. I tried editing itemdb.c and pc.c but didn't have any success. To be more specific, let me give you an example of what I want: If I consume a Red Potion, I'd like that the Orange, Yellow, White and the Red Potions get the same delay to use again (let's say 5 seconds). So it won't be possible to use any potion again if I consumed a Red, Orange, Yellow or White Potion in the last 5 seconds. I hope what I have requested is possible. In the meantime, thank you for your attention.