Soul Ring

TzalDadok

New Member
Reaction score
2
I made this function trying to copy the Soul Ring from DotA, but when I click to use the item nothing happens.

Trigger:
  • Soul Ring FUNC 1
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Soul Ring
    • Actions
      • Set ITEM_SoulRing_Caster = (Triggering unit)
      • Unit - Set life of ITEM_SoulRing_Caster to ((Life of (Triggering unit)) - 150.00)
      • Unit - Set mana of ITEM_SoulRing_Caster to ((Mana of (Triggering unit)) + 150.00)
      • Set ITEM_SoulRing_InitialMana = (Mana of ITEM_SoulRing_Caster)
      • Countdown Timer - Start ITEM_SoulRing_Timer as a One-shot timer that will expire in 10.00 seconds
      • Set ITEM_SoulRing_Activate = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ITEM_SoulRing_StartEffectEvent Equal to False
        • Then - Actions
          • Trigger - Add to Soul Ring FUNC 2 <gen> the event (Unit - ITEM_SoulRing_Caster Starts the effect of an ability)
          • Set ITEM_SoulRing_StartEffectEvent = True
        • Else - Actions
          • Do nothing


Trigger:
  • Soul Ring FUNC 2
    • Events
    • Conditions
      • ITEM_SoulRing_Activate Equal to True
    • Actions
      • Set ITEM_SoulRing_FinalMana = (ITEM_SoulRing_InitialMana - (Mana of ITEM_SoulRing_Caster))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ITEM_SoulRing_FinalMana Greater than 150.00
        • Then - Actions
          • Set ITEM_SoulRing_Activate = False
        • Else - Actions
          • Do nothing


Trigger:
  • Soul Ring FUNC 3
    • Events
      • Time - ITEM_SoulRing_Timer expires
    • Conditions
      • ITEM_SoulRing_Activate Equal to True
    • Actions
      • Unit - Set mana of ITEM_SoulRing_Caster to ((Mana of (Triggering unit)) - ITEM_SoulRing_FinalMana)
 

Smitty

Member
Reaction score
20
I believe you need to add an active ability to the ring, then use the event 'a unit begins the effect of an ability', although I may be wrong.
 

Smitty

Member
Reaction score
20
A standard item by itself doesn't have any abilities. It does nothing. Clicking on it therefore does nothing. You need to add a dummy spell to the item, which you can then detect with your trigger.
 

Inflicted

Currently inactive
Reaction score
63
I believe that the event can be used in similar cases, but that comparison wont work.
Compare the ability being used, and preferably just use Starts the Effect of an Ability Event, asif it was a Hero/Unit ability.

Do something like this:
Trigger:
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SoulRingAbility
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 150.00)
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 150.00)
      • Wait 10.00 seconds
      • Custom script: call SetUnitManaBJ( u, ( GetUnitStateSwap(UNIT_STATE_MANA, u) - 150.00 ) )
      • Custom script: set u = null


Worked for me, I know it would look better in JASS blah blah. But for GUI usage this is fine.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
What does a soul ring do? I cant help you without any further information.
 

Inflicted

Currently inactive
Reaction score
63
Yeah, there was a rule somewhere that stated users where not to expect others to know DotA hero's and items.
Soul Ring sacrifises 150 Hit Points, and turns it into Mana Points, after like 10 seconds the Mana is removed again.

My method is basic, just use it. lol.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Yeah, there was a rule somewhere that stated users where not to expect others to know DotA hero's and items.
Soul Ring sacrifises 150 Hit Points, and turns it into Mana Points, after like 10 seconds the Mana is removed again.

My method is basic, just use it. lol.

you dont need those custom script lines.
Triggering unit is not lost after waits.
 

Inflicted

Currently inactive
Reaction score
63
Really?
Dang, i thought it was. Then what is lost after Waits?

In that case:
Trigger:
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SoulRingAbility
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 150.00)
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 150.00)
      • Wait 10.00 seconds
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 150.00)

lol.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Really?
Dang, i thought it was. Then what is lost after Waits?

In that case:
Trigger:
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SoulRingAbility
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 150.00)
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 150.00)
      • Wait 10.00 seconds
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 150.00)

lol.

Anything but "Triggering XXX".
 

TzalDadok

New Member
Reaction score
2
Here's the thing. If in those 10 seconds 150 or more mana is used, I think they are not taken away afterwards. But if it's used less than 150 it will take 150 - MANA USED, do I explain myself?
 

TzalDadok

New Member
Reaction score
2
I think it should be something like this, but is not working properly... :(

Trigger:
  • Soul Ring FUNC 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sacrifice
    • Actions
      • Set ITEM_SoulRing_Caster = (Triggering unit)
      • Unit - Set life of ITEM_SoulRing_Caster to ((Life of ITEM_SoulRing_Caster) - 150.00)
      • Unit - Set mana of ITEM_SoulRing_Caster to ((Mana of ITEM_SoulRing_Caster) + 150.00)
      • Set ITEM_SoulRing_InitialMana = (Mana of ITEM_SoulRing_Caster)
      • Countdown Timer - Start ITEM_SoulRing_Timer as a One-shot timer that will expire in 10.00 seconds


Trigger:
  • Soul Ring FUNC 2
    • Events
      • Time - ITEM_SoulRing_Timer expires
    • Conditions
    • Actions
      • Set ITEM_SoulRing_FinalMana = (ITEM_SoulRing_InitialMana - (Mana of ITEM_SoulRing_Caster))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ITEM_SoulRing_FinalMana Less than 150.00
        • Then - Actions
          • Unit - Set mana of ITEM_SoulRing_Caster to ((Mana of ITEM_SoulRing_Caster) - ITEM_SoulRing_FinalMana)
        • Else - Actions
          • Do nothing
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
those triggers should work if its not supposed to be MUI.
I would suggest to remove the "do nothing" action though because it sucks performance.

Maybe you should also use a temporary real variable to store the difference in mana instead of calculating it twice in the same trigger.
 

TzalDadok

New Member
Reaction score
2
The thing is, with those triggers as they are is not working properly. I tried using item and an ability that costs 120 mana. Supposedly when timer expires 30 mana should be taken but instead takes a lot more.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
The thing is, with those triggers as they are is not working properly. I tried using item and an ability that costs 120 mana. Supposedly when timer expires 30 mana should be taken but instead takes a lot more.

The code looks good. One possibility might be if you use those variables at another point in the triggers somewhere.
My advice is to use some debug messages in your second trigger. Make it tell you the initial mana, the current mana, and the difference between both in separate text messages and you can probably work out the problem this way yourself.
 

TzalDadok

New Member
Reaction score
2
I keep trying to solve this but I can't if anyone is willing to help, please tell me and I'll send the map. Thanks :D
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Trigger:
  • Soul Ring
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Soul Ring
    • Actions
      • Custom script: local real InitialMana
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Triggering unit)) Less than or equal to 150.00
        • Then - Actions
          • Unit - Cause (Triggering unit) to damage (Triggering unit), dealing 1000000000.00 damage of attack type Chaos and damage type Universal
          • Skip remaining actions
        • Else - Actions
          • Custom script: set InitialMana = GetUnitStateSwap(UNIT_STATE_MANA, GetTriggerUnit())
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 150.00)
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 150.00)
          • Wait 10.00 seconds
          • Custom script: set udg_TempReal = InitialMana
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of (Triggering unit)) Greater than TempReal
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Mana of (Triggering unit)) Greater than (TempReal + 150.00)
                • Then - Actions
                  • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 150.00)
                • Else - Actions
                  • Unit - Set mana of (Triggering unit) to TempReal
            • Else - Actions

This might work.
 

TzalDadok

New Member
Reaction score
2
I don't understand the Custom Script functions. Can you explain them to me please? :D

Also please tell me what and which type of variables are you using here. Thanks.
 
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