cata said:
i have to bump this because i was just about to ask the question about hero-specific items, but saw this thread before i did.
so that's my main question, but its a little different from the original poster. yeah, i want items only useable by specific heroes, but i also want it so that i can sell those items from shops, and if any other hero type tries to click on that item to buy it, they get the typical error/invalid sound.
so, i'm feeling confident enough with my use of the GUI trigger functions that if someone points me in the right direction i feel like i could do it. is it possible to detect what item is being sold? i can't find any trigger like that so far...
if i need to set up variables please let me know! i'm not so good with those yet. honestly, not too sure how to create them or how they are used. basically i want an item that just 1 hero can use and i want to specify that in the purchase tooltip, but i want to make sure he's the only one who can buy it too.
any help very very very much appreciated, thanks!
Yes, it is possible to detect what item is being sold, I don't KNOW the code for it, but I have been experimenting with a Unique Weapon System that checks every slot for the (type) of item that is picked up, and that is kind of like what you want, a trigger system that checks what hero is buying what item, and if that item is equal to a item that he is not allowed to have, then he will drop that item (or remove and set it up so he gets his money back). And so far, I would have to say, yes, Variables are probably needed. Variables could possibly shorten the whole trigger system, but also could allow it to work more accuratly. Or try without, not impossible, just gotta find the right triggers
. To start off, the event that is probably used :
Unit - A unit Acquires an item
but for later on use, you will have to tell the editor what unit it is in a variable for storage, and what item for storage, and later. It would actually be a Unique Weapon System. Play Undead Budgie's FFORPG, it has for example, Short Bows, only wieldable by certain chars/jobs, or if they have items, it sounds a lot like what you are looking for, if UndeadBudgie has enough time, he might help you by giving you some of the triggers. Good Luck with your Trigger System! I sure hope you do better then me, so far I've tried about 5 different trigger systems.....
Edit: Ok, well, I took some triggers out of ETS TE 2004 V1.09a for a "recipe" thing, it is the trigger of Recipe Lvl 1, DankStoner made this map btw, some may not like I "took out" a trigger, well not really, I simply opened it up in a readable form of JASS (hope you can read it!) and I can't edit it which is good, it helps teach people about triggers so long as they can read JASS. Here it is :
function Trig_Lvl_1_Recipes_Conditions takes nothing returns boolean
if ( not ( GetItemTypeId(GetSoldItem()) == 'I02Z' ) ) then
return false
endif
return true
endfunction
function Trig_Lvl_1_Recipes_Func002C takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetBuyingUnit(), 'I00K') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetBuyingUnit(), 'I00H') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetBuyingUnit(), 'I004') == true ) ) then
return false
endif
return true
endfunction
function Trig_Lvl_1_Recipes_Func003C takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetBuyingUnit(), 'I001') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetBuyingUnit(), 'I006') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetBuyingUnit(), 'I005') == true ) ) then
return false
endif
return true
endfunction
function Trig_Lvl_1_Recipes_Func004C takes nothing returns boolean
if ( not ( UnitHasItemOfTypeBJ(GetBuyingUnit(), 'I00S') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetBuyingUnit(), 'I00R') == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetBuyingUnit(), 'I00E') == true ) ) then
return false
endif
return true
endfunction
function Trig_Lvl_1_Recipes_Actions takes nothing returns nothing
if ( Trig_Lvl_1_Recipes_Func002C() ) then
call RemoveItem( GetItemOfTypeFromUnitBJ(GetBuyingUnit(), 'I00K') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetBuyingUnit(), 'I00H') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetBuyingUnit(), 'I004') )
call CreateItemLoc( 'I02I', GetUnitLoc(GetBuyingUnit()) )
call UnitAddItemSwapped( GetLastCreatedItem(), GetBuyingUnit() )
call AddSpecialEffectLocBJ( GetUnitLoc(GetBuyingUnit()), "Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl" )
call ConditionalTriggerExecute( gg_trg_DestroySFX )
else
endif
if ( Trig_Lvl_1_Recipes_Func003C() ) then
call RemoveItem( GetItemOfTypeFromUnitBJ(GetBuyingUnit(), 'I001') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetBuyingUnit(), 'I006') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetBuyingUnit(), 'I005') )
call CreateItemLoc( 'I02J', GetUnitLoc(GetBuyingUnit()) )
call UnitAddItemSwapped( GetLastCreatedItem(), GetBuyingUnit() )
call AddSpecialEffectLocBJ( GetUnitLoc(GetBuyingUnit()), "Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl" )
call ConditionalTriggerExecute( gg_trg_DestroySFX )
else
endif
if ( Trig_Lvl_1_Recipes_Func004C() ) then
call RemoveItem( GetItemOfTypeFromUnitBJ(GetBuyingUnit(), 'I00S') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetBuyingUnit(), 'I00R') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetBuyingUnit(), 'I00E') )
call CreateItemLoc( 'I02M', GetUnitLoc(GetBuyingUnit()) )
call UnitAddItemSwapped( GetLastCreatedItem(), GetBuyingUnit() )
call AddSpecialEffectLocBJ( GetUnitLoc(GetBuyingUnit()), "Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl" )
call ConditionalTriggerExecute( gg_trg_DestroySFX )
else
endif
endfunction
function InitTrig_Lvl_1_Recipes takes nothing returns nothing
set gg_trg_Lvl_1_Recipes = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lvl_1_Recipes, EVENT_PLAYER_UNIT_SELL_ITEM )
call TriggerAddCondition( gg_trg_Lvl_1_Recipes, Condition( function Trig_Lvl_1_Recipes_Conditions ) )
call TriggerAddAction( gg_trg_Lvl_1_Recipes, function Trig_Lvl_1_Recipes_Actions )
endfunction
And also, about the unique weapon system of UndeadBudgie's FFORPG, I do not want to put out a post of the whole system at all mainly because of the fact their are multiple triggers that are scattered, and I am unable to find all of them.