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,463
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,463
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,463
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,463
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,463
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.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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