Advertisement
Guest User

Untitled

a guest
Aug 19th, 2024
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. lhz_dun03,239,78,4 script Bio Entrance 651,{
  2. function F_Warp;
  3.  
  4. if (countitem(4359) > 0) goto case_1;
  5. end;
  6.  
  7. case_1:
  8. //F_Warp("<map>",<x>,<y>,<item 1 ID>,<item 1 amount>{,<item 2 ID>,<item 2 amount>{...}}
  9. F_Warp("lhz_dun04",244,61,4359,5,4357,5,4367,5,4365,5,4363,5,4361,5);
  10. end;
  11.  
  12. function F_Warp {
  13. .@map$ = getarg(0,"");
  14. .@x = getarg(1,0);
  15. .@y = getarg(2,0);
  16.  
  17. //This loop fills a array with all the needed items
  18. for(.@i = 3; .@i < getargcount(); .@i += 2) {
  19. .@items[.@i2] = getarg(.@i);
  20. .@amount[.@i2] = getarg(.@i + 1);
  21. .@i2++;
  22. }
  23.  
  24. //This loop checks for each item needed
  25. for (.@i = 0; .@i < getarraysize(.@items); .@i++) {
  26. if (countitem(.@items[.@i]) < .@amount[.@i]) {
  27. if (!.@header) {
  28. mes "I don't have enough items to use this warp. I still need:";
  29. .@header = true;
  30. }
  31. mes .@amount[.@i] + " " + mesitemlink(.@items[.@i]);
  32. .@missing = true;
  33. }
  34. }
  35. if (.@missing) return;
  36.  
  37. //This loop removes each item needed
  38. for (.@i = 0; .@i < getarraysize(.@items); .@i++)
  39. delitem .@items[.@i], .@amount[.@i];
  40.  
  41. warp .@map$, .@x, .@y;
  42. return;
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement