• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Need help with spell

Status
Not open for further replies.
Level 7
Joined
Oct 10, 2009
Messages
111
This is what I want :

One spell that damage single target and then damage random units (random number of them and random units) around that target (random AOE too) with random damage (betwen 100-600 for example) and slow those units.
I created this but it works only with one unit and that unit ain't slowed ...
And yes, I need, if possible, GUI way to make it.

+rep who helps :)
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

Longer time ago that I create something in GUI but maybe you can use
something like that:

  • YourSpell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • -------- I think you do single damage with the spell not with the trigger --------
      • Set TempLoc = (Position of (Target unit of ability being cast))
      • Set TempInt[0] = (Random integer number between 1 and 5)
      • Set TempInt[1] = (Random integer number between 100 and 500)
      • Set TempInt[2] = (Random integer number between 100 and 160)
      • Set TempGroup = (Random TempInt[0] units from (Units within (Real(TempInt[1])) of TempLoc))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (Real(TempInt[2])) damage of attack type Spells and damage type Normal
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_TempLoc)
TempInt[0] = Number of targets that are picked
TempInt[1] = The AOE Range
TempInt[2] = Damage

Peace and Greetings
Dr. Boom
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

This doesn't work? Hmm wondering why it doesn't but how about that?

JASS:
function GroupFilter takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) == true
endfunction

function GroupAction takes nothing returns nothing
    local real a = GetRandomReal(100.00,160.00)
    
    call UnitDamageTarget(GetTriggerUnit(),GetEnumUnit(),a,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endfunction

function SpellActions takes nothing returns nothing
    local real x = GetUnitX(GetSpellTargetUnit())
    local real y = GetUnitY(GetSpellTargetUnit())
    local integer i = GetRandomInt(1,5)
    local real a = GetRandomReal(200.00,600.00)
    local group g = CreateGroup()
    
    if GetSpellAbilityId() == 'A001' then
        call GroupEnumUnitsInRangeCounted(g,x,y,a,Filter(function GroupFilter),i)
        call ForGroup(g,function GroupAction)
    endif
    
    call DestroyGroup(g)
endfunction

function InitTrig_YourSpell takes nothing returns nothing
    local integer a = 0
    
    set gg_trg_YourSpell = CreateTrigger()
    loop
        exitwhen a == bj_MAX_PLAYER_SLOTS
        call TriggerRegisterPlayerUnitEvent(gg_trg_YourSpell,Player(a),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
        set a = a + 1
    endloop
    call TriggerAddAction(gg_trg_YourSpell,function SpellActions)
endfunction

If this doesn't work you do something wrong because I tested it and haven't any problems
Name of the trigger was YourSpell. If you have another name for the trigger, you have to change any YourSpell inside the tirgger to the name you have for the trigger

Peace and Greetings
Dr. Boom
 
Moin moin =)

This doesn't work? Hmm wondering why it doesn't but how about that?

JASS:
function GroupFilter takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) == true
endfunction

function GroupAction takes nothing returns nothing
    local real a = GetRandomReal(100.00,160.00)
    
    call UnitDamageTarget(GetTriggerUnit(),GetEnumUnit(),a,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endfunction

function SpellActions takes nothing returns nothing
    local real x = GetUnitX(GetSpellTargetUnit())
    local real y = GetUnitY(GetSpellTargetUnit())
    local integer i = GetRandomInt(1,5)
    local real a = GetRandomReal(200.00,600.00)
    local group g = CreateGroup()
    
    if GetSpellAbilityId() == 'A001' then
        call GroupEnumUnitsInRangeCounted(g,x,y,a,Filter(function GroupFilter),i)
        call ForGroup(g,function GroupAction)
    endif
    
    call DestroyGroup(g)
endfunction

function InitTrig_YourSpell takes nothing returns nothing
    local integer a = 0
    
    set gg_trg_YourSpell = CreateTrigger()
    loop
        exitwhen a == bj_MAX_PLAYER_SLOTS
        call TriggerRegisterPlayerUnitEvent(gg_trg_YourSpell,Player(a),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
        set a = a + 1
    endloop
    call TriggerAddAction(gg_trg_YourSpell,function SpellActions)
endfunction

If this doesn't work you do something wrong because I tested it and haven't any problems
Name of the trigger was YourSpell. If you have another name for the trigger, you have to change any YourSpell inside the tirgger to the name you have for the trigger

Peace and Greetings
Dr. Boom

JASS:
GetOwningPlayer(GetTriggerUnit()))

This will return null. You need globals to store the Triggering unit. If you don't want to use vJass, then you will need a loop.
JASS:
loop
    exitwhen u == null
    set u = FirstOfGroup (g)
    if IsUnitEnemy (u, GetOwningPlayer(GetTriggerUnit())) then
        call KillUnit (u)
    endif
    call GroupRemoveUnit (g, u)
endloop

This is an example. This way, you won't need a new function, but you will implement it within the main actions.
 
Level 9
Joined
Jun 25, 2009
Messages
427
This is what I want :

One spell that damage single target and then damage random units (random number of them and random units) around that target (random AOE too) with random damage (betwen 100-600 for example) and slow those units.
I created this but it works only with one unit and that unit ain't slowed ...
And yes, I need, if possible, GUI way to make it.

+rep who helps :)

Hi, i made the spell for you :) IF any changes are required please tell me.

Deals random damage to the guy, slows him, then picks in random area a group and then random people in the random group and then deals random damage (again random) to them and then slows them.

I Called the spell: Spell of Randomness

Tiche3
 

Attachments

  • Map to help Hivers By Tiche3.w3x
    56.1 KB · Views: 49
Status
Not open for further replies.
Top