Simple Ability Help

zepho

New Member
Reaction score
0
I just want to learn a basic triggered spell (JASS). My base ability is blink, and what I want is that when my unit casts this spell, enemy units within 275 range of the target point will miss on their attacks by 50% (based on Curse ability). I want to know how this will be coded. First, create a dummy at target location, second pick units matching X conditions, and last add ability to dummy and firing the dummy ability to all picked units. Can someone please help me ? I am just new to JASS but I want to learn it somehow..
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Triggers are not always JASS. You could do this easily enough in GUI.

A simpler way would be to base the ability off of Silence, changing the fields to cause a 50% miss instead of muting spells. Detect when the ability is cast and move the unit to the targeted position. Done.
 

zepho

New Member
Reaction score
0
I know how to do this ability in GUI, but what I want is to make it MUI (multi unit instanceable) and also learn basic spell making in JASS so I could remove leaks.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
1). You don't need to know JASS to remove leaks. Custom Scripts will do just fine.
2). Using GUI doesn't mean that it can't be MUI.

All I needed was a Silence-based spell that caused 50% miss chance and this trigger:
Trigger:
  • Smoke Bomb
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Smoke Bomb
    • Actions
      • Set TempPoint = (Target point of ability being cast)
      • Custom script: call SetUnitX ( GetTriggerUnit(), GetLocationX(udg_TempPoint) )
      • Custom script: call SetUnitY ( GetTriggerUnit(), GetLocationY(udg_TempPoint) )
      • Custom script: call RemoveLocation (udg_TempPoint)

  • Leaks have been cleared by the RemoveLocation function.
  • Hundreds of units can cast this spell at the same time, and it will work the same way for all of them.
If you're that desperate, learn about functions first. Implement them into your GUI codes. From there you should be able to grasp the rest of JASS syntax easily enough.
 

zepho

New Member
Reaction score
0
I finished making the ability though, thanks a lot for your advices..

here's the code I made:
JASS:
function Trig_Flash_Warp_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A01H'
endfunction

function Trig_Flash_Warp_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local group g = CreateGroup()
    local location temp_loc = GetSpellTargetLoc()
    local unit temp
    local unit dummy
    call GroupEnumUnitsInRangeOfLoc(g, temp_loc, 275.0, null)
    loop
        set temp = FirstOfGroup(g)
        exitwhen temp==null
        if not IsUnitType(temp,UNIT_TYPE_STRUCTURE) and IsUnitEnemy(temp, GetOwningPlayer(caster)) and IsUnitAliveBJ(temp) then 
        set dummy = CreateUnitAtLoc(GetOwningPlayer(caster),'u000',temp_loc,0.0)
        call UnitApplyTimedLife(dummy,'u000',1.0)
        call UnitAddAbility(dummy,'A01G')
        call SetUnitAbilityLevel(dummy,'A01G',1)
        call IssueTargetOrder(dummy,"curse",temp)      
        endif
        call GroupRemoveUnit(g,temp)
    endloop
    set caster=null
    set g=null
    set temp_loc=null
    set temp=null
    set dummy=null
endfunction
    
function InitTrig_Flash_Warp takes nothing returns nothing
    local trigger gg_trg_FlashWarp = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_FlashWarp, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_FlashWarp, Condition( function Trig_Flash_Warp_Conditions ) )
    call TriggerAddAction( gg_trg_FlashWarp, function Trig_Flash_Warp_Actions )
    set gg_trg_FlashWarp = null
endfunction


edit : replaced red lines
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
You have red lines in your trigger, meaning you're calling on unnecessary functions. Replace them with their contents instead, which you can find by clicking on the red functions.
 

BloodySkullz

Active Member
Reaction score
10
You can replace the InitFunc with:

JASS:
function InitTrig_Flash_Warp takes nothing returns nothing
    local trigger gg_trg_FlashWarp = CreateTrigger(  )
    local integer i=0
    loop
        exitwhen i==bj_MAX_PLAYER_SLOTS
        call TriggerRegisterPlayerUnitEvent(gg_trg_FlashWarp,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
        set i=i+1
    endloop
    call TriggerAddCondition( gg_trg_FlashWarp, Condition( function Trig_Flash_Warp_Conditions ) )
    call TriggerAddAction( gg_trg_FlashWarp, function Trig_Flash_Warp_Actions )
    set gg_trg_FlashWarp = null
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top