| 02-13-2007, 12:06 PM | #1 |
Trying to basically make a, non channeling starfall which you can run and chase heroes/units down with. I originally tried, having an invisible dummy unit casting the starfall and setting its X/Y in intervals at the Caster's, but it starfall got randomly interrupted. So Now a completely coded version, except nothing happens Ive double checked all the raw codes and order strings. JASS:
//####################################################################################\\
// Spell Name: Starfall \\
// Spell Auth: Fulla \\
//####################################################################################\\
//################################################################\\
// \\
// Configuration Section \\
// \\
//################################################################\\
constant function Starfall_AbilId takes nothing returns integer
return 'A0A7' // Main ability id (Immolation)
endfunction
constant function Starfall_BuffId takes nothing returns integer
return 'B00L' // Main buff id in the immolation (Starfall)
endfunction
constant function Starfall_Area takes integer lvl returns real
if (lvl != 5) then
return (lvl * 100) + 300
endif
return 900. // Area effect of the Starfall
endfunction
constant function Starfall_Damage takes integer lvl returns real
if (lvl != 5) then
return (lvl * 20) + 20
endif
return 140. // Area effect of the Starfall
endfunction
constant function Starfall_Effect takes nothing returns string
return "Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl" // The starfall art effect on the Caster
endfunction
constant function Starfall_Target takes nothing returns string
return "Abilities\\Spells\\NightElf\\Starfall\\StarfallTarget.mdl" // The starfall art effect on the Target
endfunction
//################################################################\\
// \\
// Spell Section \\
// \\
//################################################################\\
function Trig_Starfall_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Starfall_AbilId()
endfunction
function Filter_Starfall takes nothing returns boolean
return (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0.) and (IsUnitEnemy(GetFilterUnit(), udg_tempplayer)) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) == false) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false)
endfunction
function Starfall takes nothing returns nothing
local timer t = GetExpiredTimer()
local string s = GetAttachmentTable(t)
local unit c = GetTableUnit(s, "C")
local integer lvl = GetUnitAbilityLevel(c, Starfall_AbilId())
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local boolexpr b = Filter(function Filter_Starfall)
local unit d
local group g = CreateGroup()
set udg_tempplayer = GetOwningPlayer(c)
call GroupEnumUnitsInRange(g, x, y, Starfall_Area(lvl), b)
loop
set d = FirstOfGroup(g)
exitwhen d == null
call BJDebugMsg("Works")
call DestroyEffect(AddSpecialEffectTarget(Starfall_Target(), d, "origin"))
call UnitDamageTarget(c , d, Starfall_Damage(lvl), false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call GroupRemoveUnit(g, d)
endloop
call DestroyGroup(g)
call DestroyBoolExpr(b)
set g = null
set b = null
if UnitHasBuffBJ(c, Starfall_BuffId()) == false then
set c = null
call ClearTimer(t)
else
set c = null
endif
endfunction
function Trig_Starfall_Actions takes nothing returns nothing
local timer t = CreateTimer()
local string s = GetAttachmentTable(t)
local unit c = GetTriggerUnit()
call SetTableObject(s, "C", c)
call TimerStart(t, 1.00, true, function Starfall)
set c = null
endfunction
//===========================================================================
function InitTrig_Starfall takes nothing returns nothing
set gg_trg_Starfall = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Starfall, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Starfall, Condition(function Trig_Starfall_Conditions))
call TriggerAddAction(gg_trg_Starfall, function Trig_Starfall_Actions)
endfunction
|
| 02-13-2007, 12:10 PM | #2 |
If you used SetUnitPosition to move the dummy then it would break it. But using SetUnitX and SetUnitY is the fix since those natives do not stop casting. |
| 02-13-2007, 12:11 PM | #3 |
Yup I tried that, ppl recommened same thing, but it kept getting interupted by other means (unknown). |
| 02-13-2007, 02:46 PM | #4 |
If you made the dummy unit so that you could see it, maybe you would see what happens to it and why it stops. If not, could you try making a new unit everytime the hero moves out of the 1st dummy unit's range (though that probably is a bad way to do it)? |
| 02-13-2007, 03:04 PM | #5 |
Yup I tried that as well :p The channeling just seems to stop randomly. So Ive been trying this method. Ok, it works so far, but it seems units arent being picked in the group? JASS:
//####################################################################################\\
// Spell Name: Starfall \\
// Spell Auth: Fulla \\
//####################################################################################\\
//################################################################\\
// \\
// Configuration Section \\
// \\
//################################################################\\
constant function Starfall_AbilId takes nothing returns integer
return 'A0A7' // Main ability id (Immolation)
endfunction
constant function Starfall_BuffId takes nothing returns integer
return 'B00L' // Main ability id (Immolation)
endfunction
constant function Starfall_Area takes integer lvl returns real
if (lvl != 5) then
return (lvl * 100) + 300
endif
return 900. // Area effect of the Starfall
endfunction
constant function Starfall_Damage takes integer lvl returns real
if (lvl != 5) then
return (lvl * 20) + 20
endif
return 140. // Area effect of the Starfall
endfunction
constant function Starfall_Target takes nothing returns string
return "Abilities\\Spells\\NightElf\\Starfall\\StarfallTarget.mdl" // The starfall art effect on the Target
endfunction
//################################################################\\
// \\
// Spell Section \\
// \\
//################################################################\\
function Trig_Starfall_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Starfall_AbilId()
endfunction
function Filter_Starfall takes nothing returns boolean
return (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0.) and (IsUnitEnemy(GetFilterUnit(), udg_tempplayer)) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) == false) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false)
endfunction
function Starfall takes nothing returns nothing
local timer t = GetExpiredTimer()
local string s = GetAttachmentTable(t)
local unit c = GetTableUnit(s, "C")
local integer lvl = GetUnitAbilityLevel(c, Starfall_AbilId())
local real x = GetUnitX(c)
local real y = GetUnitY(c)
local boolexpr b = Filter(function Filter_Starfall)
local unit d
local group g = CreateGroup()
set udg_tempplayer = GetOwningPlayer(c)
call BJDebugMsg("Success")
call GroupEnumUnitsInRange(g, x, y, Starfall_Area(lvl), b)
loop
set d = FirstOfGroup(g)
exitwhen d == null
call BJDebugMsg("Works")
call DestroyEffect(AddSpecialEffectTarget(Starfall_Target(), d, "origin"))
call UnitDamageTarget(c , d, Starfall_Damage(lvl), false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
call GroupRemoveUnit(g, d)
endloop
//call DestroyGroup(g)
//call DestroyBoolExpr(b)
//set g = null
//set b = null
//if UnitHasBuffBJ(c, Starfall_BuffId()) == false then
//set c = null
//call ClearTimer(t)
//endif
endfunction
function Trig_Starfall_Actions takes nothing returns nothing
local timer t = CreateTimer()
local string s = GetAttachmentTable(t)
local unit c = GetTriggerUnit()
call BJDebugMsg("Done")
call SetTableObject(s, "C", c)
call TimerStart(t, 1.00, true, function Starfall)
endfunction
//===========================================================================
function InitTrig_Starfall takes nothing returns nothing
set gg_trg_Starfall = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Starfall, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Starfall, Condition(function Trig_Starfall_Conditions))
call TriggerAddAction(gg_trg_Starfall, function Trig_Starfall_Actions)
endfunction
call BJDebugMsg("Works") Im not seeing this on the screen |
| 02-13-2007, 03:22 PM | #6 |
It is still odd that the spell was randomly stopped. Per se SetUnitX/Y and even Aloced units still trigger region events. The only thing I can think about right now is that this unit was moving into some region and making an event with issue order fire. |
| 02-13-2007, 03:34 PM | #7 |
Heres the code for the 'move dummy unit in intervals' version JASS:
//####################################################################################\\
// Spell Name: Starfall \\
// Spell Auth: Fulla \\
//####################################################################################\\
//################################################################\\
// \\
// Configuration Section \\
// \\
//################################################################\\
constant function Starfall_AbilId takes nothing returns integer
return 'A0A7' // Main ability id (Immolation)
endfunction
constant function Starfall_BuffId takes nothing returns integer
return 'B00L' // Main ability id (Immolation)
endfunction
constant function Starfall_Dummy_AbilId takes nothing returns integer
return 'A0BJ' // Dummy ability id (Starfall)
endfunction
constant function Starfall_OrderId takes nothing returns integer
return 852177 // Order id of main ability (Immolation)
endfunction
constant function Starfall_Dummy_OrderId takes nothing returns integer
return 852183 // Order id of dummy ability (Starfall)
endfunction
//################################################################\\
// \\
// Spell Section \\
// \\
//################################################################\\
function Trig_Starfall_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Starfall_AbilId()
endfunction
function Starfall takes nothing returns nothing
local timer t = GetExpiredTimer()
local string s = GetAttachmentTable(t)
local unit c = GetTableUnit(s, "C")
local unit d = GetTableUnit(s, "D")
local integer lvl = GetUnitAbilityLevel(c, Starfall_AbilId())
local real x = GetUnitX(c)
local real y = GetUnitY(c)
call SetUnitX(d, x)
call SetUnitY(d, y)
if UnitHasBuffBJ(c, Starfall_BuffId()) == false then
call RemoveUnit(d)
set c = null
set d = null
call ClearTimer(t)
else
set c = null
set d = null
endif
endfunction
function Trig_Starfall_Actions takes nothing returns nothing
local timer t = CreateTimer()
local string s = GetAttachmentTable(t)
local unit c = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(c, Starfall_AbilId())
local unit d = CreateUnit(GetOwningPlayer(c), DummyID(), GetUnitX(c), GetUnitY(c), 0.)
call UnitAddAbility(d, Starfall_Dummy_AbilId())
call SetUnitAbilityLevel(c, Starfall_Dummy_AbilId(), lvl)
call IssueImmediateOrderById(d, Starfall_Dummy_OrderId())
call SetTableObject(s, "C", c)
call SetTableObject(s, "D", d)
call TimerStart(t, 0.10, true, function Starfall)
set c = null
endfunction
//===========================================================================
function InitTrig_Starfall2 takes nothing returns nothing
set gg_trg_Starfall2 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Starfall2, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Starfall2, Condition(function Trig_Starfall_Conditions))
call TriggerAddAction(gg_trg_Starfall2, function Trig_Starfall_Actions)
endfunction
Works fine if I stand still, but when I start moving it stops. I tested with a dummyunit and a sorc. With the sorc I could continue to keep clicking starfall on her to get it going, perhaps that may work, if I continuelly order the dummy unit to starfall. |
| 02-13-2007, 04:06 PM | #8 |
As Vex said, check if you have any events that fire when a unit is moved, enters a region or comes in range, and maybe orders them or tells them to stop or anything that could stop starfall. |
| 02-13-2007, 04:55 PM | #9 |
Apparently, while moving the starfall caster to a new location using the SetUnitX/Y natives doesn't stop the channeling effect, it doesn't move starfall's effect location either. In fact the default moon effect as featured in potm's starfall stays in her original place, when the hero is actually in a different place. To sum up, moving the caster without firing a new starfall appears to be impossible. |
| 02-13-2007, 05:05 PM | #10 |
Aha yea that explains a few things :D |
| 02-17-2007, 12:51 AM | #11 |
So you have to make a new unit every time you move to a new location as I said? |
| 02-17-2007, 12:57 AM | #12 |
Now masda70 has solved that problem, you have 2 possible decisions to make. 1) - Recreate your own walking starfall ability, that fires stars randomly when you activate it for a amount of time. 2) - Make a instant (no backswing or anythin) cast starfall thats lasts for 1 second, and you create a new unit every second or 2 or something and cast it instantly. |
