- Joined
- Jul 26, 2008
- Messages
- 1,009
I've been trying to get a unit to save into a global variable and am now stumped on why it won't do it. I've got a GUI version and a JASS version and neither work.
What I'm trying to do:
When a hero takes his current egg item to an incubator building with a skill in it, he can select that building's spell and use it on himself. It then detects if he's carrying a certain item, and turns it into a creature for him while deleting the item. The creature is then stored into a variable under the last created unit or in JASS form, unit U. The tamer is stored as the target unit of the incubate skill.
The Problem:
When I try to order the Creature around through the variable he's stored under, he does not respond. I can only assume that the beast is not being stored into the variable. Any help is appreciated.
Here it is the JASS version:
And here is the GUI:
Help is appreciated!
What I'm trying to do:
When a hero takes his current egg item to an incubator building with a skill in it, he can select that building's spell and use it on himself. It then detects if he's carrying a certain item, and turns it into a creature for him while deleting the item. The creature is then stored into a variable under the last created unit or in JASS form, unit U. The tamer is stored as the target unit of the incubate skill.
The Problem:
When I try to order the Creature around through the variable he's stored under, he does not respond. I can only assume that the beast is not being stored into the variable. Any help is appreciated.
Here it is the JASS version:
JASS:
function Trig_Incubate_Frog2_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'Incu' and UnitHasItemOfTypeBJ(GetSpellTargetUnit(), 'SpaE') then
return true
endif
return false
endfunction
function Trig_Incubate_Frog2_Actions takes nothing returns nothing
local unit u
call UnitRemoveItemSwapped( GetItemOfTypeFromUnitBJ(GetSpellTargetUnit(), 'SpaE'), GetSpellTargetUnit() )
call RemoveItem( GetLastRemovedItem() )
set u = CreateUnitAtLoc(GetOwningPlayer(GetSpellTargetUnit()), 'MurR', GetUnitLoc(GetTriggerUnit()), bj_UNIT_FACING )
set udg_CurrentBeast[GetConvertedPlayerId(GetOwningPlayer(GetSpellTargetUnit()))] = u
set udg_Tamer[GetConvertedPlayerId(GetOwningPlayer(GetSpellTargetUnit()))] = GetSpellTargetUnit()
call IssueTargetOrder( u, "move", GetSpellTargetUnit() )
set u = null
endfunction
//===========================================================================
function InitTrig_Incubate_Frog2 takes nothing returns nothing
set gg_trg_Incubate_Frog2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Incubate_Frog2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Incubate_Frog2, Condition( function Trig_Incubate_Frog2_Conditions ) )
call TriggerAddAction( gg_trg_Incubate_Frog2, function Trig_Incubate_Frog2_Actions )
endfunction
And here is the GUI:
-
Incubate Frog
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Incubate
-
((Target unit of ability being cast) has an item of type |cff6495edMurmur Frog |rSpawn) Equal to True
-
-
Actions
-
Hero - Drop (Item carried by (Target unit of ability being cast) of type |cff6495edMurmur Frog |rSpawn) from (Target unit of ability being cast)
-
Item - Remove (Last dropped item)
-
Unit - Create 1 Murmur Frog for (Owner of (Target unit of ability being cast)) at (Position of (Triggering unit)) facing Default building facing degrees
-
Set CurrentBeast[(Player number of (Owner of (Last created unit)))] = (Last created unit)
-
Set Tamer[(Player number of (Owner of (Target unit of ability being cast)))] = (Target unit of ability being cast)
-
Unit - Order (Last created unit) to Follow (Target unit of ability being cast)
-
-
Help is appreciated!
Attachments
Last edited: