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.
  • 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

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top