I need help with two spells. Both preferably in Jass, and MUI
First of all, is a blaze spell. Cliche, I know.
Currently I have this set up:
-I have a unit that is locust, has a model of fire, and is flying with no shadow, It has immolation. It is currently "n004"
-The spell creates these fires whenever the character walks. It is passive. They last for 3/4/5 seconds (Expiration timers of course).
-My Current, Horribly flawed Script (as I knew when I made it):
This, I'd knew would cause problems, But I can't think of a better way.
Second question:
I'm creating a spell that is a combination Mana Shield and Thorns Aura. I need a script that will keep a dummy at the casters location (the dummy should have thorns.), and will kill the dummy when the buff is gone. For simplicities sake, lets call the unit Thorns Aura "A00D", the Mana Shield buff "B006", and the Dummy "N000". The Shield should seem to burn the unit.
- From another direction, I can see editing a previous script that created an Area of attack Critical strike. It detects when the caster is attacked, If he has the buff, and then deals damage from there. That would probably be a better route.
Ok, Heres my script for this one, hoping it will work.
Nope, not working. How do I change that...
First of all, is a blaze spell. Cliche, I know.
Currently I have this set up:
-I have a unit that is locust, has a model of fire, and is flying with no shadow, It has immolation. It is currently "n004"
-The spell creates these fires whenever the character walks. It is passive. They last for 3/4/5 seconds (Expiration timers of course).
-My Current, Horribly flawed Script (as I knew when I made it):
JASS:
function Trig_Blaze_Conditions2 takes nothing returns boolean
if ( ( GetIssuedOrderIdBJ() == String2OrderIdBJ("smart") ) ) then
return true
endif
if ( ( GetIssuedOrderIdBJ() == String2OrderIdBJ("patrol") ) ) then
return true
endif
if ( ( GetIssuedOrderIdBJ() == String2OrderIdBJ("move") ) ) then
return true
endif
return false
endfunction
function Trig_Blaze_Conditions takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A00C', GetTriggerUnit()) > 0 ) ) then
return false
endif
if ( not Trig_Blaze_Conditions2() ) then
return false
endif
return true
endfunction
function Trig_Blaze_Actions takes nothing returns nothing
local location o
local location p
local location r
local real ox
local real oy
local real rx
local real ry
local unit u
set u = GetOrderedUnit()
set o = GetOrderPointLoc()
set r = GetUnitLoc(u)
set rx = GetUnitX(u)
set ry = GetUnitY(u)
set ox = GetOrderPointX()
set oy = GetOrderPointY()
loop
exitwhen GetBooleanAnd(ox==rx,oy==ry)
set p = r
set r = GetUnitLoc(u)
set rx = GetUnitX(u)
set ry = GetUnitY(u)
call CreateNUnitsAtLocFacingLocBJ( 1, 'n004', GetOwningPlayer(u), p, p)
call UnitApplyTimedLifeBJ( ( 2.00 + I2R(GetUnitAbilityLevelSwapped('A00C', u)) ), 'BTLF', GetLastCreatedUnit() )
call TriggerSleepAction(0.05)
endloop
set u = null
set p = null
set o = null
set r = null
endfunction
//===========================================================================
function InitTrig_Blaze takes nothing returns nothing
set gg_trg_Blaze = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Blaze, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddCondition( gg_trg_Blaze, Condition( function Trig_Blaze_Conditions ) )
call TriggerAddAction( gg_trg_Blaze, function Trig_Blaze_Actions )
endfunction
Second question:
I'm creating a spell that is a combination Mana Shield and Thorns Aura. I need a script that will keep a dummy at the casters location (the dummy should have thorns.), and will kill the dummy when the buff is gone. For simplicities sake, lets call the unit Thorns Aura "A00D", the Mana Shield buff "B006", and the Dummy "N000". The Shield should seem to burn the unit.
- From another direction, I can see editing a previous script that created an Area of attack Critical strike. It detects when the caster is attacked, If he has the buff, and then deals damage from there. That would probably be a better route.
Ok, Heres my script for this one, hoping it will work.
JASS:
//=================================
//Burning Shield
//by Gralamin
//
//To implement, Copy the script
//into a converted trigger
//named FireShield
//
//Requires the HandleVars
//Be sure to set the options below
//
//Give credit if you use this spell
//==================================
//=======================
// --- Spell options ---
//=======================
constant function FS_AbilityRC takes nothing returns integer
return 'A00D' //The ability's raw code.
endfunction
constant function FS_DamageMultiplier takes integer level returns real
return 0.1 + level * 0.1 //Return 20%/30%/40% damage
endfunction
constant function FS_Effect takes nothing returns string
//Effect on target. no effect is ""
return "Abilities\\Spells\\Other\\ImmolationRed\\ImmolationRedTarget.mdl"
endfunction
//=======================
// --- The Spell ---
//=======================
function Trig_FireShield_Damage_Conditions takes nothing returns boolean
return GetEventDamageSource() == GetHandleUnit(GetTriggeringTrigger(), "Attacker")
endfunction
function Trig_FireShield_Damage_Actions takes nothing returns nothing
local trigger tr = GetTriggeringTrigger()
local unit u = GetTriggerUnit()
local unit a = GetEventDamageSource()
local real dmg = GetEventDamage()*FS_DamageMultiplier(GetUnitAbilityLevel(a,FS_AbilityRC()))
local real dist = 100.00 // "Melee Distance". Adds in the don't get to close effect.
call TriggerRemoveCondition(tr,GetHandleTriggerCondition(tr,"Condition"))
call TriggerRemoveAction(tr,GetHandleTriggerAction(tr,"Action"))
call FlushHandleLocals(tr)
call DestroyTrigger(tr)
call SetHandleHandle(a, "DamageTrig", null)
if IsUnitInRange(u, a, dist)==true then
call UnitDamageTarget(u, a, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, null)
endif
if FS_Effect() != "" then
call DestroyEffect(AddSpecialEffectTarget(FS_Effect(),u,"chest"))
endif
set tr = null
set u = null
set a = null
endfunction
function Trig_FireShield_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(), FS_AbilityRC()) > 0 and not IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) and GetHandleTrigger(GetAttacker(), "DamageTrig") == null and UnitHasBuffBJ(GetTriggerUnit(), 'B007') == true
endfunction
function Trig_FireShield_Actions takes nothing returns nothing
local unit a = GetAttacker()
local unit u = GetTriggerUnit()
local trigger t
local boolexpr be
set t = CreateTrigger()
call SetHandleHandle(a, "DamageTrig", t)
call SetHandleHandle(t, "Attacker", a)
call TriggerRegisterUnitEvent(t, u, EVENT_UNIT_DAMAGED)
set be = Condition(function Trig_FireShield_Damage_Conditions)
call SetHandleHandle(t,"Condition", TriggerAddCondition(t, be))
call DestroyBoolExpr(be)
set be = null
call SetHandleHandle(t,"Action", TriggerAddAction(t, function Trig_FireShield_Damage_Actions))
call TriggerSleepAction(1.5)
call FlushHandleLocals(t)
call DestroyTrigger(t)
call SetHandleHandle(a, "DamageTrig", null)
set t = null
set a = null
set u = null
endfunction
//===========================================================================
function InitTrig_FireShield takes nothing returns nothing
set gg_trg_FireShield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_FireShield, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_FireShield, Condition( function Trig_FireShield_Conditions ) )
call TriggerAddAction( gg_trg_FireShield, function Trig_FireShield_Actions )
endfunction
Nope, not working. How do I change that...
Last edited: