Jump to content

Item Event Mapflag


Anubis-K

Recommended Posts


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  60
  • Reputation:   21
  • Joined:  01/15/13
  • Last Seen:  

Hello,
 
I) Abstract:
This mapflag allows you to use certain items just in a map with a certain mapflag, and just that mapflag (almost).
 
II) Use: 
Adad the mapflag customevent to your map with a certain flag:

map<tab>mapflag<tab>customevent<tab>[integer=1,2,3,4,5,6...63]
 
Example: 
morocc mapflag customevent 1
 
Add a flag to your item in item_event.txt

499,1 // Just can be used in mapflag customevent with argument 1

Defined with bitmasking, more than one flag can be used for a item: 7 = 4+2+1

Item 499 just can be used in morroc.
 
III) Discussion:
To me, it is easier to say where I can use an item than to say where I can not use it. (I hope it is for every one like that)
 
Results:
you can decide where the items can be used with that mapflag, and database. So it is easy to block them in other maps.
 
IV) Outlook:
 
1) Transparent list: Just one item (or set) allowed. Take a look to Cydh mapflag to not equip items at all: noequip. I did the same mapflag time ago for my server and I combined it with the one I share here to get a full filter. 
 
Mining?

if(map.flag.noequip && map.flag.customevent && !item.flag.event&1)
     Fail!!
If you are in a map with equip restricted, and you have a custom event and the items do not have the flag 1 in item_event.txt, it will not be equipped. Just those items can be used on that map and no one other.
Ex: just 499 can be used there and no other item.
 
2) Whitelist: if you add a filter in the other way around you can make a full white list:
 

if(map.flag.customevent && !item.flag.event&(youtflaghere))
           Fail
On that event just the items with the flag: "youtflaghere" can be used.
 
V) Conclusion:
To set what items can be used on a map (whitelist) is easier than to say what can not be used (blacklist): 30 items v/s 3k. Better, isn't?
 
Note: This is meant to allow the item just under a certain flag, therefore:
1) There is no way to bypass it. You can do your own filter: group, or something and add the code. Feel free.
2) Does not Mather what: out of the mapflag the item can not be equipped. read number 3)
 
3) You can modify it to be used in simultaneously with "itemdb_isNoEquip(item, sd->bl.m)", to allow to use the items without get the bonus and bla bla, but goes against the idea of using it just under a well defined flag. So I did not do it like that. Because can not be equipped others checks are not required and when you left the map gets also unequipped.
 
Tip:--> (itemdb_isNoEquip(item, sd->bl.m) || itemdb_isevent) simultaneusly
 
 
Acknowledgements:
Thanks and apologies  to Cydh for the discussion and some tips for the final version and  my apologies too for the late posting in the source release.
 
 
Additional material and story of the mod:
 
From time to time in the forum of rAthena and eAthena, I have seen people searching for a mapflag or, in general, a method to allow a certain item (or a group of them) just in a certain map. Other problem is to define a white list for a map: the black list must be given, so if you forgot an item: bug! players could do party!
 
I did need something like that for my own server time ago a and I did the following:
 
1) Generate a mapflag with a certain name, "mymapflag".
2) give a flag in item_noequip that escapes from the "normal" noequip usage: 4096.
 
Use it as following:
(Not code, do not use like this)
 
When checking to equip something or use an item:
if (!map.flag.mymapflag && item.flag.noequip&4096)//(number that It is not used in a zone or whatever
FAIL!! can not equip!
 
 
Few days ago I was thinking about the normal way the users owners do the process:
 
1) Define a big (huge, titanically) list in the item no equip with a certain flag. I also used this way.
2) and define a zone where that flag can not be used.
3) Party machen!
 
 
I think this is a very bad and annoying method. So I decided to do something different:
 
1) I define a new database called: item_event.txt
2) Give a certain flag to the item: 1,2,4,8,16,32,...
3) I create a mapflag customevent that can receive a integer as a value: 
 
If the mapflag and the item flag do not match, the item cannot be equipped.
 
Note:
Please report any bug.And I hope I have not created bugs.
 
Edit: v1.0
Edit 2: I forgot the file twice...
 
 
Regards
Edited by Anubis-K
Link to comment
Share on other sites

  • 2 months later...

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

Is this only works with usable items? not equips?

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