Creating an item that can be used only in Battlegrounds

-  script  bg_noequip  -1,{OnPCLoadMapEvent:   if(getmapflag(strcharinfo(3),mf_battleground) {    if(isequipped(2220) unequip 2220;  // Hat    if(isequipped(2222) unequip 2222;  // Turban  }  end;  }

Give this a try; just make sure your battlegrounds maps have the loadevent mapflag set.

 
For usable items you can use a map zone restriction: just disable it on the "All" zone and enable it on the Battleground zone.

For items used by skills, that's a bit more complicated and maybe you need a source mod.

Why you don't check out this source mod? May be useful for what you want: http://herc.ws/board/topic/425-bg-consume-mapflag-battlegrounds-items-that-can-only-be-used-in-bg/
Is there a way not to edit src files? cause its hard to update hercules when there's modification
default_sad.png


 
For usable items you can use a map zone restriction: just disable it on the "All" zone and enable it on the Battleground zone.

For items used by skills, that's a bit more complicated and maybe you need a source mod.

Why you don't check out this source mod? May be useful for what you want: http://herc.ws/board/topic/425-bg-consume-mapflag-battlegrounds-items-that-can-only-be-used-in-bg/
Is there a way not to edit src files? cause its hard to update hercules when there's modification
default_sad.png
Have you tried these?

You can try this.

getmapflag("<map name>",mf_battleground)

-  script  bg_noequip  -1,{OnPCLoadMapEvent:   if(getmapflag(strcharinfo(3),mf_battleground) {    if(isequipped(2220) unequip 2220;  // Hat    if(isequipped(2222) unequip 2222;  // Turban  }  end;  }

Give this a try; just make sure your battlegrounds maps have the loadevent mapflag set.
 
I believe I misunderstood the request. Here's a revised script and response:

-  script  bg_equip  -1,{OnPCLoadMapEvent:   if(!getmapflag(strcharinfo(3),mf_battleground) {    if(isequipped(2220) unequip 2220;  // Hat    if(isequipped(2222) unequip 2222;  // Turban  }  end;  }

Just replace the item IDs with your own and add new lines accordingly. This script reads as:

When a player loads a map:

If they're not on a Battlegrounds map,

unequip their Hat if they're wearing one;

unequip their Turban if they're wearing one;

It's usage would be in a situation where you would want Hats and Turbans to be exclusively used in Battlegrounds. You could add additional prevention by adding a condition to the item's OnEquip script in item_db2.txt

2222,Turban,Turban,5,4500,,300,,3,,0,0xFFFFFFFE,7,2,256,,0,1,7,{},{ if(!getmapflag(strcharinfo(3),mf_battleground) unequip 2222; message strcharinfo(0), "This item can only be worn in Battlegrounds."; },{}

This script reads: If you're not on a Battlegrounds map, unequip this Turban when it's equipped and display an error message.

if(!getmapflag(strcharinfo(3),mf_battleground) unequip 2222; message strcharinfo(0), "This item can only be worn in Battlegrounds.";


If these limitations are for custom equipment, just use your custom item IDs. If you just want to make a custom potion or consumable of some sort, add a condition to the main script:

501,Red_Potion,Red Potion,0,50,,70,,,,,0xFFFFFFFF,7,2,,,,,,{ if(!getmapflag(strcharinfo(3),mf_battleground) { getitem 501; message strcharinfo(0), "This item can only be used in Battlegrounds."; } else itemheal rand(45,65),0; },{},{}

This script reads: If you're not on a Battlegrounds map, get a new potion (to replace the one you just used) and display an error message; otherwise, heal.

Code:
if(!getmapflag(strcharinfo(3),mf_battleground) { getitem 501; message strcharinfo(0), "This item can only be used in Battlegrounds."; } else  itemheal rand(45,65),0;
 
Last edited by a moderator:
Goto map_zone_db.conf

In zone with name: "All"

Put the id you want to disable

example Red_Potion or itemd id: 501

disabled_items: {  Red_Potion: true }
And then...

To enable the Red_Potion on Battlegounds Map..

scroll down and go to zone with name: "Battlegrounds"

Add Red_Potion and set to false if you want to disable

like this:

disabled_items: {
Assumptio_5_Scroll: true
Pty_Assumptio_Scroll: true
Red_Potion: false
}
default_smile.png



 
Last edited by a moderator:
Back
Top