Why won't this spell work?

Ayanami

칼리
Reaction score
288
Okay, I'm a beginer at JASS. I tried my first official JASS spell which is very basic (also can be made from GUI). Here is the code. I'm using WE Unlimited as NewGen doesn't work (I do not know why).

JASS:

function Trig_Spiritual_Blessing_2_Conditions takes nothing returns boolean
    if ( not ( GetUnitAbilityLevelSwapped('SB00', GetAttacker()) > 0 ) ) then
        return false
    endif
    if ( not ( GetRandomInt(1, 100) <= 25 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spiritual_Blessing_2_Actions takes nothing returns nothing
    set udg_CH_Unit = GetAttacker()
    set udg_CH_Unit_2 = GetAttackedUnitBJ()
    call UnitDamageTargetBJ( udg_CH_Unit, udg_CH_Unit_2, ( ( I2R(GetUnitAbilityLevelSwapped('SB00', udg_CH_Unit)) * 0.25 ) * I2R(GetHeroStatBJ(bj_HEROSTAT_INT, udg_CH_Unit, true)) ), ATTACK_TYPE_HERO, DAMAGE_TYPE_ENHANCED )
    call AddSpecialEffectTargetUnitBJ( "chest", udg_CH_Unit_2, "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    // Floating Text
    call CreateTextTagUnitBJ( "TRIGSTR_1429", udg_CH_Unit, 0, 10, 60.00, 10.00, 60.00, 0 )
    call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
    call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 3.50 )
    call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 0.50 )
    call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90.00 )
endfunction

//===========================================================================
function InitTrig_Spiritual_Blessing_2 takes nothing returns nothing
    set gg_trg_Spiritual_Blessing_2 = CreateTrigger(  )
    call AnyDamageEvent( gg_trg_Spiritual_Blessing_2 )
    call TriggerAddCondition( gg_trg_Spiritual_Blessing_2, Condition( function Trig_Spiritual_Blessing_2_Conditions ) )
    call TriggerAddAction( gg_trg_Spiritual_Blessing_2, function Trig_Spiritual_Blessing_2_Actions )
endfunction


After I tried saving my map, this error message popped up.

82299502pc7.jpg


I don't have any idea what this means. Can anyone help me?
 
Would AnyDamageEvent() be a custom function from a system? If it is, what are the arguments of the function, maybe you missed something.

Also, try to stay away from BJ functions, for most the the calls you make in your script, there are non-BJ calls that are better. Such as DestroyEffect() instead of DestroyEffectBJ().

And:

JASS:
set udg_CH_Unit = GetAttacker()
    set udg_CH_Unit_2 = GetAttackedUnitBJ()


can be turned into local variables:

JASS:
local unit attacker = GetAttacker()
    local unit attackee = GetTriggerUnit()


Then just refer to attacker and attackee throughout the spell.

Also, GetAttackedUnitBJ() is just a BJ function for GetTriggerUnit()
 
Any damage event is a WEU function.
If your using WEU and still getting this error, i dont know the problem....:(:(:(
If your not using WEU and still getting this function, try to create this trigger: (sorry if its in GUI)

Code:
Events
    Unit - A unit enters (Playable map area)
Conditions
Actions
    Trigger - Add to (Spiritual Bessing 2 <gen>) the event (Unit - (Triggering unit) takes damage)
 
Any damage event is a WEU function.
If your using WEU and still getting this error, i dont know the problem....:(:(:(
If your not using WEU and still getting this function, try to create this trigger: (sorry if its in GUI)

Code:
Events
    Unit - A unit enters (Playable map area)
Conditions
Actions
    Trigger - Add to (Spiritual Bessing 2 <gen>) the event (Unit - (Triggering unit) takes damage)

If I use this, what do i put for "Events" in my "Spiritual Blessing 2" trigger?
 
try to recreate your trigger with NO EVENTS and WITH THE SAME CONDITIONS AND ACTIONS.

BTW, dont use Attacked unit and Attacking unit in your trigger.
Use Damage Suorce for Attacking unit, and Triggering unit for Attacked unit.
 
try to recreate your trigger with NO EVENTS and WITH THE SAME CONDITIONS AND ACTIONS.

BTW, dont use Attacked unit and Attacking unit in your trigger.
Use Damage Suorce for Attacking unit, and Triggering unit for Attacked unit.

Where can I find the "Damage Source" in GUI?
 
I tried using your method but it still doesnt work. Here are the triggers.

Code:
Events
    Unit - A unit enters (Playable map area)
Conditions
Actions
    Trigger - Add to Spiritual Blessing 2 <gen> the event (Unit - (Triggering unit) Takes damage)

Code:
Spiritual Blessing 2
    Events
    Conditions
        (Level of Spiritual Blessing  for CH_Unit) Greater than 0
    Actions
        Set CH_Unit = (Damage source)
        Set CH_Unit_2 = (Triggering unit)
        Unit - Cause CH_Unit to damage CH_Unit_2, dealing (((Real((Level of Spiritual Blessing  for CH_Unit))) x 0.25) x (Real((Intelligence of CH_Unit (Include bonuses))))) damage of attack type Hero and damage type Enhanced
        Special Effect - Create a special effect attached to the chest of CH_Unit_2 using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
        Special Effect - Destroy (Last created special effect)
        -------- Floating Text --------
        Floating Text - Create floating text that reads Spiritual Blessing! above CH_Unit with Z offset 0.00, using font size 10.00, color (60.00%, 10.00%, 60.00%), and 0.00% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
        Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees

Any ideas what's wrong? The trigger just doesn't activate o.o
 
Code:
(Level of Spiritual Blessing  for CH_Unit) Greater than 0

CH_Unit has no value and therefore is returned as null. Use this:
Code:
(Level of Spiritual Blessing  for (Damage Suorce)) Greater than 0
 
Was the unit pre-placed by any chance? If so, the Enters Region event won't detect it :p

Also, you've got an infinite loop waiting to happen. Add "Turn off (This Trigger)" at the start of Spiritual Blessing 2, and "Turn on (This Trigger)" at the end of the same trigger

What do you mean by pre-placed? My hero is like summoned from a tavern. For the code, do you mean like this?

Code:
Events
    Unit - A unit enters (Playable map area)
Conditions
Actions
    Trigger - Add to Spiritual Blessing 2 <gen> the event (Unit - (Triggering unit) Takes damage)

Code:
Spiritual Blessing 2
    Events
    Conditions
        (Level of Spiritual Blessing  for (Damage source)) Greater than 0
    Actions
        Trigger - Turn off (This trigger)
        Set CH_Unit = (Damage source)
        Set CH_Unit_2 = (Triggering unit)
        Unit - Cause CH_Unit to damage CH_Unit_2, dealing (((Real((Level of Spiritual Blessing  for CH_Unit))) x 0.25) x (Real((Intelligence of CH_Unit (Include bonuses))))) damage of attack type Hero and damage type Enhanced
        Special Effect - Create a special effect attached to the chest of CH_Unit_2 using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
        Special Effect - Destroy (Last created special effect)
        -------- Floating Text --------
        Floating Text - Create floating text that reads Spiritual Blessing! above CH_Unit with Z offset 0.00, using font size 10.00, color (60.00%, 10.00%, 60.00%), and 0.00% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Change the lifespan of (Last created floating text) to 3.50 seconds
        Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        Trigger - Turn on (This trigger)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    It is weird seeing a way more realistic users online number
  • The Helper The Helper:
    Happy Tuesday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top