[Spell Request] JASS

zoidbergZA

New Member
Reaction score
0
hi guys, i've got a spell made in GUI that is a channeling ability but that isn't MUI. i have just started to try and learn JASS but i still find it very difficult. If anybody can make this ability MUI i would really appreciate it.

The spell is channeling, it boosts the life of the target by 5% of the caster's max HP per second. 4 levels increases the duration per level. i used the "channel" ability as a base and dummy units to get the desired channel effect.

Trigger:
  • turn on
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Boost Life
    • Actions
      • Unit - Create 1 channel dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
      • Set ability_boost_life1[1] = (Last created unit)
      • Unit - Create 1 channel dummy for Player 8 (Pink) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
      • Set ability_boost_life1[2] = (Last created unit)
      • Set ability_boost_life1[3] = (Casting unit)
      • Set ability_boost_life1[4] = (Target unit of ability being cast)
      • Unit - Add channel effect to ability_boost_life1[1]
      • Unit - Order ability_boost_life1[1] to Human Blood Mage - Siphon Mana ability_boost_life1[2]
      • Special Effect - Create a special effect attached to the overhead of ability_boost_life1[4] using Abilities\Spells\Other\Drain\DrainCaster.mdl
      • Set ability_boost_life2 = (Last created special effect)
      • Trigger - Turn on timed actions <gen>
      • Trigger - Turn on turn off <gen>


Trigger:
  • timed actions
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit - Move ability_boost_life1[2] instantly to (Position of ability_boost_life1[4])
      • Unit - Set life of ability_boost_life1[4] to ((Life of ability_boost_life1[4]) + ((Max life of ability_boost_life1[3]) / 200.00))


Trigger:
  • turn off
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • ((Ability being cast) Equal to channel effect ) or ((Ability being cast) Equal to Boost Life )
    • Actions
      • Trigger - Turn off timed actions <gen>
      • Unit - Remove ability_boost_life1[1] from the game
      • Unit - Remove ability_boost_life1[2] from the game
      • Unit - Order ability_boost_life1[3] to Stop
      • Special Effect - Destroy ability_boost_life2
 

Exide

I am amazingly focused right now!
Reaction score
448
I don't have WE or JassCraft with me, so I can't help you. But I can tell you that it's easier to help you if you convert your triggers to custom text first. (Even though GUI -> JASS = Horrible.) :p
 

zoidbergZA

New Member
Reaction score
0
JASS:
function Trig_turn_on_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A003' ) ) then
        return false
    endif
    return true
endfunction

function Trig_turn_on_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'h00D', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetSpellAbilityUnit()), bj_UNIT_FACING )
    set udg_ability_boost_life1[1] = GetLastCreatedUnit()
    call CreateNUnitsAtLoc( 1, 'h00D', Player(7), GetUnitLoc(GetSpellTargetUnit()), bj_UNIT_FACING )
    set udg_ability_boost_life1[2] = GetLastCreatedUnit()
    set udg_ability_boost_life1[3] = GetSpellAbilityUnit()
    set udg_ability_boost_life1[4] = GetSpellTargetUnit()
    call UnitAddAbilityBJ( 'A004', udg_ability_boost_life1[1] )
    call IssueTargetOrderBJ( udg_ability_boost_life1[1], "drain", udg_ability_boost_life1[2] )
    call AddSpecialEffectTargetUnitBJ( "overhead", udg_ability_boost_life1[4], "Abilities\\Spells\\Other\\Drain\\DrainCaster.mdl" )
    set udg_ability_boost_life2 = GetLastCreatedEffectBJ()
    call EnableTrigger( gg_trg_timed_actions )
    call EnableTrigger( gg_trg_turn_off )
endfunction

//===========================================================================
function InitTrig_turn_on takes nothing returns nothing
    set gg_trg_turn_on = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_turn_on, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( gg_trg_turn_on, Condition( function Trig_turn_on_Conditions ) )
    call TriggerAddAction( gg_trg_turn_on, function Trig_turn_on_Actions )
endfunction


JASS:
function Trig_timed_actions_Actions takes nothing returns nothing
    call SetUnitPositionLoc( udg_ability_boost_life1[2], GetUnitLoc(udg_ability_boost_life1[4]) )
    call SetUnitLifeBJ( udg_ability_boost_life1[4], ( GetUnitStateSwap(UNIT_STATE_LIFE, udg_ability_boost_life1[4]) + ( GetUnitStateSwap(UNIT_STATE_MAX_LIFE, udg_ability_boost_life1[3]) / 200.00 ) ) )
endfunction

//===========================================================================
function InitTrig_timed_actions takes nothing returns nothing
    set gg_trg_timed_actions = CreateTrigger(  )
    call DisableTrigger( gg_trg_timed_actions )
    call TriggerRegisterTimerEventPeriodic( gg_trg_timed_actions, 0.10 )
    call TriggerAddAction( gg_trg_timed_actions, function Trig_timed_actions_Actions )
endfunction


JASS:
function Trig_turn_off_Func006001 takes nothing returns boolean
    return ( GetSpellAbilityId() == 'A004' )
endfunction

function Trig_turn_off_Func006002 takes nothing returns boolean
    return ( GetSpellAbilityId() == 'A003' )
endfunction

function Trig_turn_off_Conditions takes nothing returns boolean
    if ( not GetBooleanOr( Trig_turn_off_Func006001(), Trig_turn_off_Func006002() ) ) then
        return false
    endif
    return true
endfunction

function Trig_turn_off_Actions takes nothing returns nothing
    call DisableTrigger( gg_trg_timed_actions )
    call RemoveUnit( udg_ability_boost_life1[1] )
    call RemoveUnit( udg_ability_boost_life1[2] )
    call IssueImmediateOrderBJ( udg_ability_boost_life1[3], "stop" )
    call DestroyEffectBJ( udg_ability_boost_life2 )
endfunction

//===========================================================================
function InitTrig_turn_off takes nothing returns nothing
    set gg_trg_turn_off = CreateTrigger(  )
    call DisableTrigger( gg_trg_turn_off )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_turn_off, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
    call TriggerAddCondition( gg_trg_turn_off, Condition( function Trig_turn_off_Conditions ) )
    call TriggerAddAction( gg_trg_turn_off, function Trig_turn_off_Actions )
endfunction
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
I almost -repped you for that, zoidbergZA.

Why? zoidbergZA is the original poster, Exide asked him to do that...

Exide said:
I don't have WE or JassCraft with me, so I can't help you. But I can tell you that it's easier to help you if you convert your triggers to custom text first. (Even though GUI -> JASS = Horrible.):p
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
>>zoidbergZA
Does him know Jass? That code is just generated by GUI world editor. Never mind, I made a MUI version.

JASS:
// MUI by kingking.
// Needs ABC

scope BoostLife initializer Init

globals
    private constant integer abil_id = 'A000'
    private constant integer ChannelDummyId = 'u000'
    private constant string sfx = "Abilities\\Spells\\Other\\Drain\\DrainCaster.mdl"
    private constant real HealFactor = 200.
    private constant integer ChannelEffect = 'A001'
    private constant string abil_OrderID = "channel"
endglobals

private struct Data
    unit cs
    unit target
    unit dum1
    unit dum2
    effect fx
    
    static method Init takes nothing returns Data
        return Data.allocate()
    endmethod
endstruct

private function Cond takes nothing returns boolean
    return GetSpellAbilityId() == abil_id
endfunction

private function Heal takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local Data a = GetTimerStructA(t)
    
    if GetUnitCurrentOrder(a.cs) == String2OrderIdBJ(abil_OrderID) then
        call SetUnitPosition(a.dum2,GetUnitX(a.target),GetUnitY(a.target))
        call SetUnitState(a.target,UNIT_STATE_LIFE,GetUnitState(a.target,UNIT_STATE_LIFE) + GetUnitState(a.cs,UNIT_STATE_LIFE) / HealFactor)
    else
        call PauseTimer(t)
        call DestroyTimer(t)
        call ClearTimerStructA(t)
        call RemoveUnit(a.dum1)
        call RemoveUnit(a.dum2)
        call DestroyEffect(a.fx)
        call a.destroy()
    endif
    
    set t = null
endfunction

private function Act takes nothing returns nothing
    local unit cs = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()
    local player p = GetOwningPlayer(cs)
    local real X = GetUnitX(cs)
    local real Y = GetUnitY(cs)
    local real tX = GetUnitX(target)
    local real tY = GetUnitY(target)
    local unit dum1 = CreateUnit(p,ChannelDummyId,X,Y,0.)
    local unit dum2 = CreateUnit(Player(7),ChannelDummyId,X,Y,0.)
    local Data a = Data.Init()
    local timer t = CreateTimer()
    set a.cs = cs
    set a.target = target
    set a.dum1 = dum1
    set a.dum2 = dum2
    set a.fx = AddSpecialEffectTarget(sfx,target,"overhead")
    call UnitAddAbility(dum1,ChannelEffect)
    call IssueTargetOrder(dum1,"drain",dum2)
    call SetTimerStructA(t,a)
    call TimerStart(t,.1,true,function Heal)
    set cs = null
    set target = null
    set p = null
    set dum1 = null
    set dum2 = null
    set t = null
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerAddCondition(t,Condition(function Cond))
    call TriggerAddAction(t, function Act)
    set t = null
endfunction

endscope
 

zoidbergZA

New Member
Reaction score
0
hey guys i know this is going to sound retarted but plz keep in mind that im totaly new and im trying hard to learn.

i copied the JASS code above that kingkingyyk3 kindly wrote for me into to a blank trigger on my map. i then changed the global constant values at the top to match those on my map.

When i try to test the map i get a vJASS compiler message telling me there was 4 compiler errors. (i downloaded the newgen pack for WE on this forum)

can anybody plz steer this newbie in the right direction?
 

saw792

Is known to say things. That is all.
Reaction score
280
His attempt requires the ABC attachment system, which can be found in resources somewhere.
 

UndeadDragon

Super Moderator
Reaction score
447
What are the errors?

EDIT: Above ^^
 

Faust

You can change this now in User CP.
Reaction score
123
You really should start off with something easier.
Make a mass entangle in vJASS
Make the mass entangle deal hero-stat based damage.
Things like that. :)
Put this one on hold, and try again in 2 days.
 

zoidbergZA

New Member
Reaction score
0
thanks, i added the ABC system trigger and vJass no longer gives errors when saving.

however, when i cast the spell ingame only the base ability 'channel' occurs, ie no HP boost or spell effect occurs. i checked and re-checked to make sure i set the global constant values to match mine in the object editor :banghead:
 
General chit-chat
Help Users
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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