[Trigger] A specific spell trigger doesn't fully work even though it should

Status
Not open for further replies.
Level 3
Joined
Sep 20, 2013
Messages
29
Hi,
Recently I've been creating a trigger standing for just a simple triggered version of renamed Holy Light Spell, concretely Sing of Life, with different description and healing amount. The spell is also supposed to damage and enemy unit for half of its basic healing amount, which in turn works properly as well as healing itself. The main problem however is the fact that the healing part of the trigger is still run even when a targeted unit is at full health despite the fact that it shouldn't happen at all as actions responsible for it shouldn't be even executed in this case according to the trigger code. The whole trigger is by the way split in 3 parts as separated triggers, whereas 2 of them just stand for the actions related to floating text used by the main trigger.
Here is the trigger code:

Main Trigger:

  • Sign Of Life
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sign of Life
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is Magic Immune) Equal to False
        • Then - Actions
          • Set SignOfLifeTarget = (Target unit of ability being cast)
          • Set SignOfLifeCaster = (Triggering unit)
          • Special Effect - Create a special effect attached to the origin of SignOfLifeTarget using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SignOfLifeTarget belongs to an enemy of (Owner of SignOfLifeCaster)) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of HUMAN for SignOfLifeTarget) Not equal to 1
                • Then - Actions
                  • Sound - Play HolyBolt <gen>
                  • Unit - Cause SignOfLifeCaster to damage SignOfLifeTarget, dealing (SignOfLifeAmount[(Level of Sign of Life for SignOfLifeCaster)] / 2.00) damage of attack type Spells and damage type Normal
                • Else - Actions
                  • Unit - Order (Triggering unit) to Stop
                  • Trigger - Run Human Warning Floating Text <gen> (checking conditions)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Percentage life of SignOfLifeTarget) Equal to 100.00
                • Then - Actions
                  • Unit - Order (Triggering unit) to Stop
                  • Trigger - Run Full Health Floating Text <gen> (checking conditions)
                • Else - Actions
                  • Sound - Play HolyBolt <gen>
                  • Unit - Set life of SignOfLifeTarget to ((Life of SignOfLifeTarget) + SignOfLifeAmount[(Level of Sign of Life for SignOfLifeCaster)])
        • Else - Actions
          • Unit - Order (Triggering unit) to Stop
2nd Trigger:

  • Full Health Floating Text
    • Events
    • Conditions
      • ((This trigger) is on) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Floating Text - Create floating text that reads Already at full hea... above SignOfLifeCaster with Z offset 0.00, using font size 10.00, color (VertexColorRed%, VertexColorGreen%, VertexColorBlue%), and 0.00% transparency
      • Set FullHealth = (Last created floating text)
      • Wait 4.50 seconds
      • Floating Text - Destroy FullHealth
      • Trigger - Turn on (This trigger)
3rd Trigger:

  • Human Warning Floating Text
    • Events
    • Conditions
      • ((This trigger) is on) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Floating Text - Create floating text that reads Can't target an ene... above SignOfLifeCaster with Z offset 0.00, using font size 10.00, color (VertexColorRed%, VertexColorGreen%, VertexColorBlue%), and 0.00% transparency
      • Set HumanWarning = (Last created floating text)
      • Wait 4.50 seconds
      • Floating Text - Destroy HumanWarning
      • Trigger - Turn on (This trigger)

Please, if it's possible, advise me based on these pictures what should i change while modifying trigger to make it not to leak. Thanks in advance.
 
Level 28
Joined
Sep 26, 2009
Messages
2,545
So what you're trying to say is that the last If/Then/Else in the main trigger never gets into the "Then" block? (= the one with full health floating text?)
If so, the problem is in condition. Try to change "(Percentage life of SignOfLifeTarget) Equal to 100.00" to "(Percentage life of SignOfLifeTarget) Greater than 99.00.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Make a new trigger:
Events: A unit is issued an order with a target.
Conditions: Issued order equal to "holybolt" (I suppose it is that one but am not sure.)
Level of Song of Life for triggering unit is greater than 0
Targeted unit belongs to an ally of Owner of triggering unit
Health% of Targeted unit is greater than 99
Actions:
Set TempPlayer = owner of Triggering unit
Play sound for TempPlayer "Errormessage" <<< Don't know what it is called.
Clear messages for TempPlayer
Display autotimed text to TempPlayer "The target is already at maximum health"
Start a 0 seconds timer and issue the unit to stop when that timer finished.

Here is a jass code of how the unit is stopped:
JASS:
function IssueUnitToStop_Callback takes nothing returns nothing
    local timer t = GetExpiredTimer()
    call IssueImmediateOrder(LoadUnitHandle(udg_Hashtable, GetHandleId(t), 0), "stop")
    call FlushChildHashtable(udg_Hashtable, GetHandleId(t))
    call DestroyTimer(t)
    set t = null
endfunction
function IssueUnitToStop takes unit whichUnit returns nothing
    local timer t = CreateTimer()
    call TimerStart(t, 0, false, function IssueUnitToStop_Callback)
    call SaveUnitHandle(udg_Hashtable, GetHandleId(t), 0, whichUnit)
    set t = null
endfunction
Put that in the header.
You do a "Custom script: call IssueUnitToStop(GetTriggerUnit())" to call it.
You do have to initialize the variable Hashtable though.

This is the best way to make these targeting requirements.
 
Last edited:
Level 3
Joined
Sep 20, 2013
Messages
29
Well, thanks for your help so far.
I've tried fixing the trigger according to Nichilus' advice but it still doesn't work. When it comes in turn to Wietlol's solution, I'm really unfamiliar with JASS and in addition my trigger is based off Channel spell, which editor values are perfect for a triggered spell and so there actually is no order ID (like holybolt) assigned to it. As a result I can't really make the trigger be created this way and especially add the JASS script to it.
Any other ideas? I really need help, I'm sure there's another way ...
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
If you use Channel it will only be easier.
There is a field called "Base Order Id". That is the order string.
So you can customize what order string you will use.
About the JASS. You will not use JASS as all. Just copy and paste it in the header file.

(In the trigger editor, you have a list of categories with their triggers. At the top of the list is a blue world editor icon with the map name next to it.
That is called the header file.
Everything put in the header file can be used in all the triggers.)

As you have trouble making the script, I have made it for you... it is just a copy of how I implemented them before I started JASS-only-scriptin :D

This Sign of Life is an exact copy (except mana, cooldown and tooltips) of holy light.
 

Attachments

  • Sign of Life.w3x
    20.2 KB · Views: 75
Level 3
Joined
Sep 20, 2013
Messages
29
But the point is, when I will really assign a holybolt order to my channel-type Sign of Life spell it will kinda work like Holy Light towards its targets, due to what I won't be able to damage by use of it any unit I'd like to, but only undead ones according to Holy Light's spell description. Same problem will be then related to healing.
That's just what I wanted to avoid and that's why I triggered this whole spell.
I hope you understand.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
But that is not hardcoded in "holybolt" but in 'Holy Light'.

I will show you.
Go to the map I posted and go to the trigger "Sign of Life Targeting".
Then disable the "(TempUnit is Undead) equal to false" and "(TempUnit is Undead) equal to true".
(Right-click on the condition and then click the lowest option "Enable Function".)

Then the spell can target undead allies and living enemies.
(It will heal allies and damage enemies.)

EDIT: I am not as dumb as you look like ;)
 
Level 3
Joined
Sep 20, 2013
Messages
29
Oh, It actually works :D I thought it's really not going to be executed correctly upon units with specific classification just like in Holy Light's case due to the same order ID for both of these spells. I remember that some time before I tried to make it work almost as you did, but I couldn't make it proper no matter what :/. Anyway. thanks for help and your efforts :D You've really taught me something and helped, I'll put it in my map now with a little of edit to be able to target all enemies regardless of race except humans when it comes to dealing damage with this spell.
+ REP
 
Status
Not open for further replies.
Top