- Joined
- Oct 10, 2009
- Messages
- 1,426
Problem solved thanks to:
Bribe
Berb
Well, I am currently working on a spell for my map and in it, I am creating a dummy unit to cast an ability who's code is 'A000'
The problem is the unit WILL not cast it.
As you can see, I create it for Player 1, so I know he CAN cast it, he just won't do it on command.
I've checked all the rawcodes and I know they are correct.
I even tried getting him to cast it from a string command, to no avail.
Don't bug me on the coding. It's not close to being finished, and some locals I declare, I don't even use yet.
As for the wrapper functions, I have a friend who wants the spell when I'm done and he doesn't know JASS, so those are pretty much there so he can implement. I'm not done with those yet either, ofc.
If you have a recommendation for a function I should use or something that is actually helpful, then sure, go ahead and tell me and you'll get rep for helping out a JASS noob.
ANY help would be appreciated and rewarded.!
Please note*
I use the word WON'T for a reason...don't ask me if I got the RawCode wrong or if it cost mana. Don't ask me about things like that unless that is absolutely the only logical explanation.
Bribe
Berb
The problem is the unit WILL not cast it.
As you can see, I create it for Player 1, so I know he CAN cast it, he just won't do it on command.
I've checked all the rawcodes and I know they are correct.
I even tried getting him to cast it from a string command, to no avail.
Don't bug me on the coding. It's not close to being finished, and some locals I declare, I don't even use yet.
As for the wrapper functions, I have a friend who wants the spell when I'm done and he doesn't know JASS, so those are pretty much there so he can implement. I'm not done with those yet either, ofc.
If you have a recommendation for a function I should use or something that is actually helpful, then sure, go ahead and tell me and you'll get rep for helping out a JASS noob.
JASS:
loop
set LoopUnits = FirstOfGroup(targets)
exitwhen LoopUnits == null
set Dummy = CreateUnit(Player(0),RAWCODEDUMMY(),X,Y,0.00)
call UnitApplyTimedLife(Dummy,'BTLF',1)
call UnitAddAbility(Dummy,'A000')
call SetUnitAbilityLevel (Dummy, 'A000', GetUnitAbilityLevel(U, 'XYYY'))
call IssueTargetOrderById(U, 'A000' , LoopUnits)
call GroupRemoveUnit(targets,LoopUnits)
endloop
JASS:
constant function RAWCODEABILITY takes nothing returns integer
return 'XYYY'
endfunction
constant function RAWCODEDUMMY takes nothing returns integer
return 'h000'
endfunction
function Damage_Tree takes integer level returns integer
return level *200
endfunction
function Range_Tree takes integer level returns real
if level == 1 then
return 300.000
else
if level == 2 then
return 350.000
else
return 400.000
endif
endif
endfunction
function Targets_Tree takes unit target returns boolean
return (GetWidgetLife(target) > 0.405) and (IsUnitType(target, UNIT_TYPE_STRUCTURE) == false) and (IsUnit(target,GetTriggerUnit()) == false) and (IsUnitType(target,UNIT_TYPE_MAGIC_IMMUNE) == false)
endfunction
function Conditions_Tree takes nothing returns boolean
return GetSpellAbilityId() == RAWCODEABILITY()
endfunction
function Pick_Tree takes nothing returns boolean
return Targets_Tree(GetFilterUnit())
endfunction
function Trig_Tree_Attack_Actions takes nothing returns nothing
local unit U = GetTriggerUnit()
local real X = GetLocationX(GetSpellTargetLoc())
local real Y = GetLocationY(GetSpellTargetLoc())
local boolexpr b = Condition(function Pick_Tree)
local group targets = CreateGroup()
local group targets2 = CreateGroup()
local integer level = GetUnitAbilityLevel(U,RAWCODEABILITY())
local unit LoopUnits
local unit Dummy
call GroupEnumUnitsInRange(targets,X,Y,Range_Tree(level),b)
call GroupEnumUnitsInRange(targets2,X,Y,Range_Tree(level),b)
loop
set LoopUnits = FirstOfGroup(targets)
exitwhen LoopUnits == null
set Dummy = CreateUnit(Player(0),RAWCODEDUMMY(),X,Y,0.00)
call UnitApplyTimedLife(Dummy,'BTLF',1)
call UnitAddAbility(Dummy,'A000')
call SetUnitAbilityLevel (Dummy, 'A000', GetUnitAbilityLevel(U, 'XYYY'))
call IssueTargetOrderById(U, 'A000' , LoopUnits)
call GroupRemoveUnit(targets,LoopUnits)
endloop
endfunction
//===========================================================================
function InitTrig_Tree_Attack takes nothing returns nothing
local trigger T = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(T, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddAction(T, function Trig_Tree_Attack_Actions )
call TriggerAddCondition(T,Condition(function Conditions_Tree))
endfunction
ANY help would be appreciated and rewarded.!
Please note*
I use the word WON'T for a reason...don't ask me if I got the RawCode wrong or if it cost mana. Don't ask me about things like that unless that is absolutely the only logical explanation.
Last edited: