| 10-30-2008, 07:36 PM | #1 |
Sup everyone, hoping this thread is in the right section. I have a strange and quite serious bug in my map. I'm not sure if its a triggering problem but its the only thing i can think of. I'm using an item combination idea similar to dota's. Except that mine functions without a shop and without a recipe. How it works is that the hero collects the ingredients, lets name them i1 and i2 for simplicity's sake. Then while they're in the inventory he clicks on one of them and it combines the items. Each item has the same ability that fires off the trigger. Eg. Unit begins the effect of an ability. Ability being cast is equal to brew. If unit has i1 and i2 then remove i1 and i2 and add item potion. I can't post the actual trigger because i'm not on my pc. But i've tried plenty of different triggers such as unit uses item, unit starts casting ability etc. The problem comes in when the unit uses the item. It immediately removes the triggering hero from the game. If it helps, when the unit picks up any one of the items it adds another random ability from the game to the hero. I've checked my coding and can't find a glitch. If anyone can help that'd be awesome. |
| 10-30-2008, 09:31 PM | #2 |
It would be nice to see your script, but I made one for myself anyways. OK, so there's a problem with my script, it won't place the item into the unit's inventory. I didn't explore why it didn't because I don't think that's the part you need. So here's what I got: JASS:function Message takes string s returns nothing call DisplayTextToPlayer(Player(0), 0, 0, s) endfunction function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A000' //Change the spell ID endfunction function Trig_Untitled_Trigger_001_Func001C takes nothing returns boolean return IsItemOwned(GetItemOfTypeFromUnitBJ(GetSpellAbilityUnit(), 'I000')) return IsItemOwned(GetItemOfTypeFromUnitBJ(GetSpellAbilityUnit(), 'I001')) return true endfunction function AddItem takes integer itemId, unit u returns item //I think my problem is here local item i set i = CreateItem(itemId, GetUnitX(u), GetUnitY(u)) call UnitAddItem(u, i) return i endfunction function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing if ( Trig_Untitled_Trigger_001_Func001C() ) then call Message("Brewed!") call RemoveItem( GetItemOfTypeFromUnitBJ(GetSpellAbilityUnit(), 'I000') ) call RemoveItem( GetItemOfTypeFromUnitBJ(GetSpellAbilityUnit(), 'I001') ) call AddItem( 'mcri', GetSpellAbilityUnit() ) else call Message("Must have both items!") endif endfunction //=========================================================================== function InitTrig_Untitled_Trigger_001 takes nothing returns nothing set gg_trg_Untitled_Trigger_001 = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) ) call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions ) endfunction OK so I'm still VERY new to JASS, but you get the idea, no heroes disappearing, no random abilities. Let me know if you'd want me to post the map. Hope that helps a little! |
| 10-30-2008, 10:30 PM | #3 |
Thanks dude, i'm new to jass myself. If you could post the map that would be awesome. +rep |
| 10-30-2008, 11:20 PM | #4 |
