• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

need help creating a detonate spell

Level 3
Joined
Apr 29, 2024
Messages
30
I have a sphere/ball ability, and I want to add a detonate ability to it. So if you were to press on the sphere itself, it would have a detonate ability where I just press the hotkey that its assigned to. I attached a video below on what the ability looks like itself. I would appreciate any kind of help
 

Attachments

  • Warcraft III Reforged 2024.06.10 - 00.57.26.01.mp4
    40.5 MB
Level 45
Joined
Feb 27, 2007
Messages
5,578
I don't understand what the issue you are having is? Give it a thunderclap- or fan of knives-based ability to deal AoE damage, then kill the caster:
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • ((Ability being cast) equal to KABOOM OR MAYBE SOME OTHER ABILITY IT'S NOT CLEAR TO ME)
  • Actions
    • -------- Pick one of these --------
    • Unit - Kill (Triggering unit)
    • Unit - Explode (Triggering unit)
    • Unit - Add a 0.10 second generic expiration timer to (Triggering Unit) //this would be necessary if the explosion isn't giving you kill credit because the caster is dead or something dumb like that
 
Level 3
Joined
Apr 29, 2024
Messages
30
The map I work on is messed up in the world editor, so I converted the GUI trigger to custom text. So its written like this, and in the sphere unit itself I added the detonate ability A800, right next to the kaboom ability. But the new ability does not show at all ingame in the sphere unit. I dont know what the issue is

JASS:
function Trig_Destruction_Sphere_Manual_Detonate_Conditions takes nothing returns boolean
    if (not(GetSpellAbilityId()== 'A800')) then
        return false
    endif
    return true
endfunction

function Trig_Destruction_Sphere_Manual_Detonate_Actions takes nothing returns nothing
    call KillUnit(udg_destruction_sphere_unit)
endfunction

function InitTrig_Destruction_Sphere_Manual_Detonate takes nothing returns nothing
    set gg_trg_Destruction_Sphere_Manual_Detonate = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Destruction_Sphere_Manual_Detonate, EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddCondition(gg_trg_Destruction_Sphere_Manual_Detonate, Condition(function Trig_Destruction_Sphere_Manual_Detonate_Conditions))
    call TriggerAddAction(gg_trg_Destruction_Sphere_Manual_Detonate, function Trig_Destruction_Sphere_Manual_Detonate_Actions)
endfunction
 
Level 3
Joined
Apr 29, 2024
Messages
30
1718212762600.png


The Object editor does show it, but ingame dosent show up.
1718212830941.png

unless I have done it incorrect?
 
Level 3
Joined
Apr 29, 2024
Messages
30
udg_destruction_sphere_unit doesn't point to anything unless there are other triggers.
though that does not explain the ability showing up.

if the ability is not on the unit it's not relevant to that trigger it's object editor issue.
Regarding the udg_destruction_sphere_unit, after the sphere unit is created I store it in the udg_destruction_sphere_unit variable that I created
JASS:
function Trig_Destruction_Sphere_Actions takes nothing returns nothing
set udg_Caster[10]=GetTriggerUnit()
set udg_location07=GetUnitLoc(GetTriggerUnit())
set udg_location08=GetSpellTargetLoc()
set udg_location09=PolarProjectionBJ(udg_location07,150.00,AngleBetweenPoints(udg_location07,udg_location08))
set udg_group05=GetUnitsInRangeOfLocMatching(512.00,udg_location07,Condition(function Trig_Destruction_Sphere_Func004002003))
call ForGroupBJ(udg_group05,function Trig_Destruction_Sphere_Func005A)
call DestroyGroup(udg_group05)
call CreateNUnitsAtLoc(1,'h02R',GetTriggerPlayer(),udg_location09,bj_UNIT_FACING)
call SetUnitVertexColorBJ(bj_lastCreatedUnit,50.00,75.00,50.00,0)
set udg_destruction_sphere_unit = GetLastCreatedUnit()
call CreateNUnitsAtLoc(1,'h02T',GetTriggerPlayer(),udg_location09,AngleBetweenPoints(udg_location07,udg_location08))
call SetUnitScalePercent(bj_lastCreatedUnit,(400.00+(I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit()))*10.00)),(400.00+(I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit()))*10.00)),(400.00+(I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit()))*10.00)))
call SetUnitFlyHeight(bj_lastCreatedUnit,0.00,50.00)
call AddSpecialEffectTargetUnitBJ("chest",bj_lastCreatedUnit,"Abilities\\Weapons\\GreenDragonMissile\\GreenDragonMissile.mdl")
call TriggerExecute(udg_trigger621)
call AddSpecialEffectTargetUnitBJ("chest",bj_lastCreatedUnit,"Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl")
call TriggerExecute(udg_trigger621)
call AddSpecialEffectTargetUnitBJ("chest",bj_lastCreatedUnit,"Abilities\\Spells\\Undead\\DarkSummoning\\DarkSummonMissile.mdl")
call TriggerExecute(udg_trigger621)
call IssuePointOrderLoc(bj_lastCreatedUnit,"attack",udg_location08)
call SetUnitUserData(bj_lastCreatedUnit,GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit()))
call RemoveLocation(udg_location09)
call RemoveLocation(udg_location08)
call RemoveLocation(udg_location07)
call TriggerSleepAction(2.00)
call ForForce(bj_FORCE_ALL_PLAYERS,function Trig_Destruction_Sphere_Func024A)
endfunction
 
Level 3
Joined
Apr 29, 2024
Messages
30
okay, so I got the spell to show up now I just based the spell off of Divine Shield. But it does absolutely nothing at all. Have I stored the sphere in udg_destruction_sphere_unit incorrectly?
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Using channel was a fine choice (much better than divine shield, don’t do that in the future - fan of knives or Roar are also better non-targeted abilities with no downsides), you just needed to make it visible.

I don’t see anything weird with how you’re storing the sphere, but both triggers are not fully visible here. Can you show the full text of both please? My intuition is that you probably forgot to change the conditions to look for that new ability being cast.
 
Level 3
Joined
Apr 29, 2024
Messages
30
This is the full text of the unit, ability and the detonate ability


JASS:
function Trig_Destruction_Sphere_Conditions takes nothing returns boolean
return((GetSpellAbilityId()=='A016'))
endfunction

function Trig_Destruction_Sphere_Func004002003 takes nothing returns boolean
return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO))
endfunction

function Trig_Destruction_Sphere_Func005A takes nothing returns nothing
endfunction

function Trig_Destruction_Sphere_Func024A takes nothing returns nothing
call CameraClearNoiseForPlayer(GetEnumPlayer())
endfunction

function Trig_Destruction_Sphere_Actions takes nothing returns nothing
set udg_Caster[10]=GetTriggerUnit()
set udg_location07=GetUnitLoc(GetTriggerUnit())
set udg_location08=GetSpellTargetLoc()
set udg_location09=PolarProjectionBJ(udg_location07,150.00,AngleBetweenPoints(udg_location07,udg_location08))
set udg_group05=GetUnitsInRangeOfLocMatching(512.00,udg_location07,Condition(function Trig_Destruction_Sphere_Func004002003))
call ForGroupBJ(udg_group05,function Trig_Destruction_Sphere_Func005A)
call DestroyGroup(udg_group05)
call CreateNUnitsAtLoc(1,'h02R',GetTriggerPlayer(),udg_location09,bj_UNIT_FACING)
call SetUnitVertexColorBJ(bj_lastCreatedUnit,50.00,75.00,50.00,0)
set udg_destruction_sphere_unit = GetLastCreatedUnit()
call CreateNUnitsAtLoc(1,'h02T',GetTriggerPlayer(),udg_location09,AngleBetweenPoints(udg_location07,udg_location08))
call SetUnitScalePercent(bj_lastCreatedUnit,(400.00+(I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit()))*10.00)),(400.00+(I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit()))*10.00)),(400.00+(I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit()))*10.00)))
call SetUnitFlyHeight(bj_lastCreatedUnit,0.00,50.00)
call AddSpecialEffectTargetUnitBJ("chest",bj_lastCreatedUnit,"Abilities\\Weapons\\GreenDragonMissile\\GreenDragonMissile.mdl")
call TriggerExecute(udg_trigger621)
call AddSpecialEffectTargetUnitBJ("chest",bj_lastCreatedUnit,"Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl")
call TriggerExecute(udg_trigger621)
call AddSpecialEffectTargetUnitBJ("chest",bj_lastCreatedUnit,"Abilities\\Spells\\Undead\\DarkSummoning\\DarkSummonMissile.mdl")
call TriggerExecute(udg_trigger621)
call IssuePointOrderLoc(bj_lastCreatedUnit,"attack",udg_location08)
call SetUnitUserData(bj_lastCreatedUnit,GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit()))
call RemoveLocation(udg_location09)
call RemoveLocation(udg_location08)
call RemoveLocation(udg_location07)
call TriggerSleepAction(2.00)
call ForForce(bj_FORCE_ALL_PLAYERS,function Trig_Destruction_Sphere_Func024A)
endfunction

function Trig_Destruction_Sphere_Attack_Conditions takes nothing returns boolean
return((GetUnitTypeId(GetDyingUnit())=='h02T'))
endfunction

function Trig_Destruction_Sphere_Attack_Func002002003 takes nothing returns boolean
return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO))
endfunction

function Trig_Destruction_Sphere_Attack_Func003A takes nothing returns nothing
endfunction

function Trig_Destruction_Sphere_Attack_Func019002003 takes nothing returns boolean
return(IsPlayerAlly(GetOwningPlayer(GetFilterUnit()),GetOwningPlayer(GetTriggerUnit()))==false)
endfunction

function Trig_Destruction_Sphere_Attack_Func020A takes nothing returns nothing
call UnitDamageTargetBJ(udg_Caster[10],GetEnumUnit(),udg_real02,ATTACK_TYPE_MELEE,DAMAGE_TYPE_NORMAL)
endfunction

function Trig_Destruction_Sphere_Attack_Func022Func001C takes nothing returns boolean
return((IsDestructableAliveBJ(GetEnumDestructable())))
endfunction

function Trig_Destruction_Sphere_Attack_Func022A takes nothing returns nothing
if((IsDestructableAliveBJ(GetEnumDestructable())))then
call KillDestructable(GetEnumDestructable())
call TriggerExecute(udg_trigger623)
endif
endfunction

function Trig_Destruction_Sphere_Attack_Func026A takes nothing returns nothing
call CameraClearNoiseForPlayer(GetEnumPlayer())
endfunction

function Trig_Destruction_Sphere_Attack_Actions takes nothing returns nothing
set udg_location08=GetUnitLoc(GetTriggerUnit())
set udg_group05=GetUnitsInRangeOfLocMatching(512.00,udg_location08,Condition(function Trig_Destruction_Sphere_Attack_Func002002003))
call ForGroupBJ(udg_group05,function Trig_Destruction_Sphere_Attack_Func003A)
call DestroyGroup(udg_group05)
call SetTerrainTypeBJ(udg_location08,'Kdtr',-1,5,0)
call SetTerrainTypeBJ(udg_location08,'Jdtr',-1,4,0)
call CreateNUnitsAtLoc(1,'h02S',GetTriggerPlayer(),udg_location08,bj_UNIT_FACING)
call SetUnitScalePercent(bj_lastCreatedUnit,(350.00+(I2R(GetUnitUserData(GetTriggerUnit()))*10.00)),(350.00+(I2R(GetUnitUserData(GetTriggerUnit()))*10.00)),(350.00+(I2R(GetUnitUserData(GetTriggerUnit()))*10.00)))
call SetUnitVertexColorBJ(bj_lastCreatedUnit,50.00,100.00,50.00,0)
call CreateNUnitsAtLoc(1,'h017',GetTriggerPlayer(),udg_location08,bj_UNIT_FACING)
call SetUnitScalePercent(bj_lastCreatedUnit,(350.00+(I2R(GetUnitUserData(GetTriggerUnit()))*10.00)),(350.00+(I2R(GetUnitUserData(GetTriggerUnit()))*10.00)),(350.00+(I2R(GetUnitUserData(GetTriggerUnit()))*10.00)))
call SetUnitVertexColorBJ(bj_lastCreatedUnit,50.00,100.00,50.00,0)
call SetUnitTimeScalePercent(bj_lastCreatedUnit,15.00)
call KillUnit(bj_lastCreatedUnit)
set udg_real02=((I2R(GetHeroStatBJ(2,udg_unit67,false))*(I2R(GetUnitUserData(GetTriggerUnit()))*4.00))+100.00)
call CreateNUnitsAtLoc(1,'h028',GetTriggerPlayer(),udg_location08,bj_UNIT_FACING)
set udg_group05=GetUnitsInRangeOfLocMatching(512.00,udg_location08,Condition(function Trig_Destruction_Sphere_Attack_Func019002003))
call ForGroupBJ(udg_group05,function Trig_Destruction_Sphere_Attack_Func020A)
call DestroyGroup(udg_group05)
call EnumDestructablesInCircleBJ(512.00,udg_location08,function Trig_Destruction_Sphere_Attack_Func022A)
call RemoveLocation(udg_location08)
call TriggerSleepAction(2.00)
call ForForce(bj_FORCE_ALL_PLAYERS,function Trig_Destruction_Sphere_Attack_Func026A)
endfunction

function Trig_Destruction_Sphere_Manual_Detonate_Conditions takes nothing returns boolean
    if (not(GetSpellAbilityId()== 'A800')) then
        return false
    endif
    return true
endfunction

function Trig_Destruction_Sphere_Manual_Detonate_Actions takes nothing returns nothing
    call KillUnit(udg_destruction_sphere_unit)
endfunction

function InitTrig_Destruction_Sphere_Manual_Detonate takes nothing returns nothing
    set gg_trg_Destruction_Sphere_Manual_Detonate = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Destruction_Sphere_Manual_Detonate, EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddCondition(gg_trg_Destruction_Sphere_Manual_Detonate, Condition(function Trig_Destruction_Sphere_Manual_Detonate_Conditions))
    call TriggerAddAction(gg_trg_Destruction_Sphere_Manual_Detonate, function Trig_Destruction_Sphere_Manual_Detonate_Actions)
endfunction
 
Level 3
Joined
Apr 29, 2024
Messages
30
it works now, and everything was correct. Only problem when it didnt work was I had stored the unit in the wrong place lol, The sphere unit in world editor is called h02T, so I just had to store the sphere unit under it. Thanks for the help
 
Top