• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Using HP to cast spells

Status
Not open for further replies.
Level 1
Joined
Dec 11, 2014
Messages
6
Hi!

I would like to ask, if there is an easy way to change mana cost of spell to life cost of spell? U know, some kind of blood magic hero or unit? I suspect that it's impossible without triggers, am I right or not? If this is possible only with triggers, then it could be solved by using some simple script, converting mana cost of every hero spell to life damage, and recovering mana used for casting that spell?

Thanks in advance for help.

Ps. sorry for my "engrish" :b
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
  • Cost
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Triggering unit)) Greater than 10.00
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 10.00)
        • Else - Actions
          • Unit - Order (Triggering unit) to Stop
You might as well think of a unit begins casting an ability but I have to check the ability system again.

Anyway, just change the ability comparison and the life needed and you should be fine.
If there are problems set the event to a unit begins casting an ability.

EDIT: You can change "Greater than" to "Greater than or equal to" if you want the unit to be able to suicide.
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
you could do it like that:

Trigger1:

- Map Initialization -

Ability[0] = Thunderclap
Life[0] = 5

Ability[1] = Flamestrike
Life[1] = 20

Ability[2] = Starfall
Life[2] = 25

...



Trigger 2:

- Unit casts an ability -

for each Int from 0 to X do
IF
Ability being cast equal to Ability[Int]
THEN
Set Life of triggering unit to life - Life[Int]



Note:
X is the number of abilities that you initialized
Ability[] is an ability-type variable with an array
Life[] is a real variable with an array
Int is an integer variable
 
Level 1
Joined
Dec 11, 2014
Messages
6
Thanks for quick reply. The problem is that i need something more versatile. Becouse in my map i need this for every hero unit in game not only for one custom hero and making 70 or more triggers for only one item...
(thats becouse i want to make item that change game mechanic for owner of item, some kind of "cloak of blood magic" or other "bloody sacrificial dagger", u know, something that can change everyone into bloody bastard and make mana useless :b)

So one of condition probably will be: "((Casting unit) has (Item carried by (Casting unit) of type BloodyItemXXX)) = YES"
But the rest is more problematic.

Edit:WOW you are realy fast in this forum. I wrote a post, before saw the Gimli answers :)

Edit2: Ok Gimli, but this still does not solve the problem and is not so simple like i hope it will be.
1) I need mana cost=0 for every spell or immediate return of mana cost (for owner of "blood item")
2) Editor really does not have a function, which returns mana consumed for spell as a integer/real?
3) Hmmm... I think about this aaaand... Maybe it would be misguided idea, but what you think about trying something like '(Hero Current Health) = (Hero Current Health) - (Max Hero mana - Hero Current Mana)' after every spell that hero cast? It's posible to do this in WAR3 World Editor without "fighting" with JASS?
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
You want an Item that turns mana cost into health cost?

I do have an idea. However you will have to register ALL abilities that a hero can have.
In a few of my maps, I register all units and items for an alternative damage system and I can tell you it is not very hard.

There are a few things that you should be familiar with though.
Do you have any JASS experience?
Do you know how you can define a unit-type/item-type/ability-type/upgrade-type/etc in JASS?

I will make a nice system for ya but if you are not familiar with those 2, you will spend some time to actually be able to use it.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
This is as much as I have atm:

First of all, the system:
JASS:
function ACS_AddAbilityCost takes integer abilityCode, real manaCost returns nothing
    local integer i = 0
    loop
        exitwhen(LoadReal(udg_ACS_Hashtable, abilityCode, i) == 0)
        set i = i + 1
    endloop
    call SaveReal(udg_ACS_Hashtable, abilityCode, i, manaCost)
endfunction

function InitTrig_ACS_Initialization takes nothing returns nothing
    local integer i
    set gg_trg_ACS_Initialization = CreateTrigger()
    set udg_ACS_Hashtable = InitHashtableBJ()
    
    set i = 'AHtc' //Ability code of Thunder clap.
    call ACS_AddAbilityCost(i, 90)  //level 1
    call ACS_AddAbilityCost(i, 120) //level 2
    call ACS_AddAbilityCost(i, 150) //level 3
    
endfunction
The first function is very simple and just adds one real to an array that can be accessed by an ability-type-integer.
The second function runs on initialization (hardcoded WC3 stuff) and adds 3 integers for ability 'AHtc' which represents the Thunder Clap of our beloved Mountain King.
It starts with level one and sets the cost to 90.
Level 2 has a 120 cost and level 3 has a 150 cost.
All levels after that have a 0 cost but you can be a smart man an know that you have to add more of the same lines... after all, there are no abilities that make more levels during the game.

Now lets go to the effect:
  • ACS Effect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: set udg_TempInteger = GetSpellAbilityId()
      • Set TempInteger2 = ((Level of (Ability being cast) for (Triggering unit)) - 1)
      • Set TempReal = (Load TempInteger2 of TempInteger from ACS_Hashtable)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Red Drake Egg) Equal to True
        • Then - Actions
          • Set TempReal = (TempReal / 2.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Triggering unit)) Greater than TempReal
            • Then - Actions
              • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - TempReal)
            • Else - Actions
              • Unit - Order (Triggering unit) to Stop
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Triggering unit)) Greater than TempReal
        • Then - Actions
          • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - TempReal)
        • Else - Actions
          • Unit - Order (Triggering unit) to Stop
This trigger removes the mana of a unit by the amount that is registered in the other trigger.
If the unit has the item Red Drake Egg (yea in my example it is a drake egg :D) then the cost is reduced and is token from the life instead.
(The amount / 2 is just an example of how you should deal with the amount and how to change it. You shouldnt change the amount in "set life of triggering unit ..." so you can keep it simple.)

You must set all ability costs to 0 and put up some nice stuff in the descriptions.
Something like: "|cff66ffffMana cost: 90|r|n|n"
The |n|n are two so called "newlines" and are just to make it look nice.
The |cff66ffff ... |r is a color code and a return code. This code adds a color to the text between them.
The color used is 66ffff which is a hex-color code that represents a nice light blue. (Change it to whatever you want.)
This has to be done for every level in every ability.
Because WC3 has not very good tooltips, you cannot make it have a better tooltip than this without doubling your abilities. I also want better ones in WC4 if it ever comes.

Please dont forget to add the global variables when you implement it into your maps. Thank you.
 

Attachments

  • HPAbilityCost.w3x
    18 KB · Views: 108
Level 1
Joined
Dec 11, 2014
Messages
6
You want an Item that turns mana cost into health cost?

I do have an idea. However you will have to register ALL abilities that a hero can have.
In a few of my maps, I register all units and items for an alternative damage system and I can tell you it is not very hard.

There are a few things that you should be familiar with though.
Do you have any JASS experience?
Do you know how you can define a unit-type/item-type/ability-type/upgrade-type/etc in JASS?

I will make a nice system for ya but if you are not familiar with those 2, you will spend some time to actually be able to use it.

Thanks for answer Wietlol.

It's funny becouse i spend (off and on) something about 10 years
making maps for Warcraft 3, but only with World Editor, no JASS experience here, never made custom trigger with that. :b Only World Editor operations on a variables, triggers etc.

"ALL abilities" - ou, but it's map where every player can play with every hero + there are some custom heroes, and abilities.


This is as much as I have atm:

First of all, the system:
JASS:
function 
    set i = 'AHtc' //Ability code of Thunder clap.
    call ACS_AddAbilityCost(i, 90)  //level 1
    call ACS_AddAbilityCost(i, 120) //level 2
    call ACS_AddAbilityCost(i, 150) //level 3
    
endfunction

I understand that it's mana cost... but why ascending? It's constant for Thunder Clap or am i wrong?



So, this formula "(Hero Current Health) = (Hero Current Health) - (Max Hero mana - Hero Current Mana)" and full mana restore after casting a spell, by owner of "blood item", can't be implemented to War3 World Editor and i must made custom trigger for every hero skill in game? I know it's "quick&dirty" but i'm looking for something simple, in 99,9% of cases hero with that item have full mana becouse he no longer use mana anymore.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
The biggest problem is that you cannot access the object editor via triggers. I really have no idea why the hell we cant, but anyway that is why you cannot know how much mana the unit spend on a spell.
You could calculate the difference between casting and finishing but you don't add the mana regain with that.

Next to that, if you would refund the mana, you cannot cast the spell if you havent got enough mana, even though you have numberless health.

The formula (unit hp = unit hp - (max unit mana - hero mana)) is kind of stupid. If you have 2k mana and 1k hp, and you have 1k current mana.
Every time you would cast the spell, you would die.

Yes all code in the example is for thunder clap. The 'i' defines the ability. After that you just call that function to add a mana cost to the first level that has none (yet).
The first time it is for level 1, the second time is for level 2, etc. etc.
You have to do it for all levels.

You have to set all abilities' mana cost to 0 and add that little text to the beginning of the tooltip.

Indeed, this takes some time but once you have this installed, you can easily add more amazing functions to it... Like a buff that the next ability cost nothing, or that you deal additional damage equal to the mana cost. You name it!

For myself, I haven't used this system before but I think I will be for my next map :)
Never actually made something that required this system.

One more hint: If you have reached the maximum number of characters in the tooltip, you should open the field by "left-shift + enter". Then you can extend the maximum characters.
You could try that on all other fields for other lovely things... "It's funny becouse i spend (off and on) something about 10 years
making maps for Warcraft 3, but only with World Editor"
I guess you already knew that but just in case XD
 
Level 12
Joined
Oct 16, 2010
Messages
680
You could calculate the difference between casting and finishing but you don't add the mana regain with that.

why can't this be the solution? on spell effect you save the mana the hero has ATM and rise his current mana to maximum (so the spell can be casted without problem) after that (on finishing cast) you chech how much mana the unit is missing and remove health correspondingly, then reset the mana to the correct amount. ONLY u have to trigger spells on finishes casting event and reset cooldown if hero lacks enough health.... but in return you don't have to store a gigantic amount of data for every existing spell and their levels.. depends on how much triggered spells you have (for a good map all should be triggered IMO:D)

or if u don't want triggered spells.. this will still work but you can't prevent selfkilling:p
 
Level 12
Joined
Oct 16, 2010
Messages
680
how could you avoid that all spells will be catched in the second?

I don't know what u mean. first trigger u check if hero has item. if don't you do nothing:p

triggered spell then should be triggered with the (Unit- A unit finishes casting an ability) event
there you make an other check if there is an item or no and make the required changes.
 
Level 1
Joined
Dec 11, 2014
Messages
6
The biggest problem is that you cannot access the object editor via triggers. I really have no idea why the hell we cant, but anyway that is why you cannot know how much mana the unit spend on a spell.

Indeed, this takes some time but once you have this installed, you can easily add more amazing functions to it... Like a buff that the next ability cost nothing, or that you deal additional damage equal to the mana cost. You name it!

For myself, I haven't used this system before but I think I will be for my next map :)
Never actually made something that required this system.

One more hint: If you have reached the maximum number of characters in the tooltip, you should open the field by "left-shift + enter". Then you can extend the maximum characters.
You could try that on all other fields for other lovely things... "It's funny becouse i spend (off and on) something about 10 years
making maps for Warcraft 3, but only with World Editor"
I guess you already knew that but just in case XD

Yeah it could be amazing but i'm less ambitious and spend so much time (i'm making combo of normal war3 skirmish, tower defence and some elements from MMORPG events system (but more primitive OFC)). And in this map every hero can have 4lvl for primary skills and 2lvl for ultimate skills, also there is some custom heroes in tavern. So for me it's too much effort. We can say that i'm casual mapper who is looking for more lazy solutions, and it will not be very far from the truth. Quite close i think :)
""left-shift + enter". Then you can extend the maximum characters." <-- aaand no, i don't know about this :b

But back to the point. If we can't play with object editor by triggers to check mana cost, so...
Lender; said:
ONLY u have to trigger spells on finishes casting event and reset cooldown if hero lacks enough health
Lender, so it's solution to make my, lazy and full of holes method, less "quick&dirty" option to solve the blood magic problem? Can someone help with the development of the idea. I'd prefer to avoid meeting with JASS, unless there is no other option. :b
 
Level 12
Joined
Oct 16, 2010
Messages
680
Some corretcions to me and here are the triggers

  • Setup Trigger
    • Events
      • Unit - a unit starts the effect of an ability
    • Conditions
      • ((Triggering unit) has an item of type "YourBloodItem") Equal to True
    • Actions
      • Set TempU = (triggering unit)
      • Save (current mana of(TempU)) as 0 of (key(TempU)) in YourHashTable
      • Unit - set TempU's mana to 100%
  • Your Spell
    • Events
      • Unit - A unit finishes casting an ability
    • Conditions
    • Actions
      • Set TempU = (triggering unit)
      • Custom script: if HaveSavedReal( udg_YourHashtable , GetHandleId( udg_TempU )) then
      • Set TempR = Load 0 of (key(TempU)) from YourHashtable
      • Custom script: call SetWidgetLife( udg_TempU , GetUnitState( udg_TempU , UNIT_STATE_LIFE) - (GetUnitState( udg_TempU , UNIT_STATE_MAX_MANA) - GetUnitState( udg_TempU , UNIT_STATE_MANA)))
      • Custom script: SetUnitState( udg_TempU , UNIT_STATE_MANA , udg_TempR )
      • Custom script: endif
      • The rest of your spell should go here:P
not the best solution but should work:/

test it if it works as u want.

this will kill you if have few HP. hp check can implemented as well as other features if u want

TempU - unit variable
TempR - real variable
 
If you don't use mana anywhere else other than spells, you could give it 0 regeneration and have no abilities that restore it.

Then set it to some astronomical value, like 100k. It will disappear from the UI, but still be functional. Then you can store values as said, like this: (unit hp = unit hp - (max unit mana - hero mana)

Since mana will never be used anywhere else, you can rarely die from this. You could also choose to make health costs non-fatal (1 hp minimum).
 
Level 1
Joined
Dec 11, 2014
Messages
6
Thanks everyone for help. Lender, i'll try this and, i'll try to add health check to prevent self killing.

If you don't use mana anywhere else other than spells, you could give it 0 regeneration and have no abilities that restore it.

Then set it to some astronomical value, like 100k. It will disappear from the UI, but still be functional. Then you can store values as said, like this: (unit hp = unit hp - (max unit mana - hero mana)

Since mana will never be used anywhere else, you can rarely die from this. You could also choose to make health costs non-fatal (1 hp minimum).

Good idea Mythic, but it's posible to change mana regeneration via triggers? I want to give player oportunity to throw away "blood item", if he want, and change casting mechanic to standard rules with mana points. So before we change his max mana and mana regeneration, we can store this values and give them back to hero, when he throw away, sell, or give "blood item" to other hero.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
One simple thing that I am not very confident of...

Finishes casting an ability has a massive delay from the actual casting.
Next to that, you can cancel the finishing of an ability once the effect has already taken place. Therefor you also need the event "A unit stops casting an ability"

Ok 2 things:
You should remove the stored real once you are done because if you remove your item, you are still taking the life effect because the value is still stored.

-_- 3 things then:
You are still not able to cast spells when you haven't got enough mana.

4 :( I think I have to stop soon.
You still have some effect from regain... especcially because the finishing duration can take up to 2 seconds for some spells.


I suggest something like this rather than what we have now.
There is still a problem that you require mana to cast the ability.
  • ACS Simple
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) has an item of type Red Drake Egg) Equal to True
    • Actions
      • Custom script: local unit udg_TempUnit
      • Custom script: local real udg_TempReal
      • Set TempUnit = (Triggering unit)
      • Custom script: set udg_TempInteger = GetHandleId(udg_TempUnit)
      • Set TempReal = (Mana of TempUnit)
      • Unit - Set mana of TempUnit to 100.00%
      • Wait 0.01 seconds
      • Set TempReal2 = ((Max mana of TempUnit) - (Mana of TempUnit))
      • Set TempReal2 = (TempReal2 / 2.00)
      • Unit - Set life of TempUnit to ((Life of TempUnit) - TempReal2)
      • Unit - Set mana of TempUnit to TempReal
Change Red Drake Egg to your item.
Add variables:
- real: TempReal
- real: TempReal2
- unit: TempUnit
You can use these variables outside this trigger.
 
Level 16
Joined
May 2, 2011
Messages
1,345
The biggest problem is that you cannot access the object editor via triggers. I really have no idea why the hell we cant, but anyway that is why you cannot know how much mana the unit spend on a spell.
You could calculate the difference between casting and finishing but you don't add the mana regain with that.

you sure about that? if not i will test that tomorrow. also, if yes maybe we can add some tweak to put the reg into the equation.

why can't this be the solution? on spell effect you save the mana the hero has ATM and rise his current mana to maximum (so the spell can be casted without problem) after that (on finishing cast) you chech how much mana the unit is missing and remove health correspondingly, then reset the mana to the correct amount. ONLY u have to trigger spells on finishes casting event and reset cooldown if hero lacks enough health.... but in return you don't have to store a gigantic amount of data for every existing spell and their levels.. depends on how much triggered spells you have (for a good map all should be triggered IMO:D)

or if u don't want triggered spells.. this will still work but you can't prevent selfkilling:p

about setting mana, can mana be set to more than max via trigger? because blood mage can have beyond max mana. not sure if mana siphon used in his map though, but generaly speaking
 
Level 12
Joined
Oct 16, 2010
Messages
680
-_- 3 things then:
You are still not able to cast spells when you haven't got enough mana.
explain this pls... starts effect triggers before mana taken and cooldown applied. have u tested?

Finishes casting an ability has a massive delay from the actual casting.
Next to that, you can cancel the finishing of an ability once the effect has already taken place. Therefor you also need the event "A unit stops casting an ability"
than just use stop casting. useful info

You should remove the stored real once you are done because if you remove your item, you are still taking the life effect because the value is still stored.
thx I just forgot it out:p

  • Setup Trigger
    • Events
      • Unit - a unit starts the effect of an ability
    • Conditions
      • ((Triggering unit) has an item of type "YourBloodItem") Equal to True
    • Actions
      • Set TempU = (triggering unit)
      • Save (current mana of(TempU)) as 0 of (key(TempU)) in YourHashTable
      • Unit - set TempU's mana to 100%
  • Your Spell
    • Events
      • Unit - A unit stops casting an ability
    • Conditions
      • Actions
    • Set TempU = (triggering unit)
      • Custom script: if HaveSavedReal( udg_YourHashtable , GetHandleId( udg_TempU )) then
      • Set TempR = Load 0 of (key(TempU)) from YourHashtable
      • Custom script: call SetWidgetLife( udg_TempU , GetUnitState( udg_TempU , UNIT_STATE_LIFE) - (GetUnitState( udg_TempU , UNIT_STATE_MAX_MANA) - GetUnitState( udg_TempU , UNIT_STATE_MANA)))
      • Custom script: SetUnitState( udg_TempU , UNIT_STATE_MANA , udg_TempR )
      • Remove Saved Real from the hashtable ( don't know how the actual line reads:D , flush child or stg )
      • Custom script: endif
      • The rest of your spell should go here:P
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
explain this pls... starts effect triggers before mana taken and cooldown applied. have u tested?
That is true but that means that you actually starts casting.
When you click the button (ability), WC3 checks if you have enough mana and if you have then it starts channeling -> casting -> effect starts -> mana is taken.
You are required to have enough mana to start channeling an ability.


than just use stop casting. useful info
I said also...
You need them both.

  • Setup Trigger
    • Events
      • Unit - a unit starts the effect of an ability
    • Conditions
      • ((Triggering unit) has an item of type "YourBloodItem") Equal to True
    • Actions
      • Set TempU = (triggering unit)
      • Save (current mana of(TempU)) as 0 of (key(TempU)) in YourHashTable
      • Unit - set TempU's mana to 100%
  • Your Spell
    • Events
      • Unit - A unit stops casting an ability
    • Conditions
      • Actions
    • Set TempU = (triggering unit)
      • Custom script: if HaveSavedReal( udg_YourHashtable , GetHandleId( udg_TempU )) then
      • Set TempR = Load 0 of (key(TempU)) from YourHashtable
      • Custom script: call SetWidgetLife( udg_TempU , GetUnitState( udg_TempU , UNIT_STATE_LIFE) - (GetUnitState( udg_TempU , UNIT_STATE_MAX_MANA) - GetUnitState( udg_TempU , UNIT_STATE_MANA)))
      • Custom script: SetUnitState( udg_TempU , UNIT_STATE_MANA , udg_TempR )
      • Remove Saved Real from the hashtable ( don't know how the actual line reads:D , flush child or stg )
      • Custom script: endif
      • The rest of your spell should go here:P

I still stick to my option:
I suggest something like this rather than what we have now.
There is still a problem that you require mana to cast the ability.
  • ACS Simple
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) has an item of type Red Drake Egg) Equal to True
    • Actions
      • Custom script: local unit udg_TempUnit
      • Custom script: local real udg_TempReal
      • Set TempUnit = (Triggering unit)
      • Custom script: set udg_TempInteger = GetHandleId(udg_TempUnit)
      • Set TempReal = (Mana of TempUnit)
      • Unit - Set mana of TempUnit to 100.00%
      • Wait 0.01 seconds
      • Set TempReal2 = ((Max mana of TempUnit) - (Mana of TempUnit))
      • Set TempReal2 = (TempReal2 / 2.00)
      • Unit - Set life of TempUnit to ((Life of TempUnit) - TempReal2)
      • Unit - Set mana of TempUnit to TempReal
Change Red Drake Egg to your item.
Add variables:
- real: TempReal
- real: TempReal2
- unit: TempUnit
You can use these variables outside this trigger.
The biggest difference is that my trigger runs faster (your 2nd trigger is called with an up to 2 seconds delay.
Next to that it is easier to modify and it is put in one trigger.

You can tell.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
How about this



  • Test1
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Triggering unit)) Greater than 75.00
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 75.00)
        • Else - Actions
          • Custom script: set udg_localp = GetLocalPlayer()
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering player) Equal to localp
            • Then - Actions
              • Sound - Play Error <gen>
            • Else - Actions
          • Set pg = (Player group((Triggering player)))
          • Cinematic - Clear the screen of text messages for pg
          • Game - Display to pg for 2.00 seconds the text: (|cffffcc00 + ( Not enough hit points, + |r))
          • Unit - Order (Triggering unit) to Stop
          • Custom script: call DestroyForce(udg_pg)
  • Test2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set u1 = (Triggering unit)
      • Set mana1 = (Mana of u1)
      • Countdown Timer - Start tmr as a One-shot timer that will expire in 0.00 seconds
  • Test3
    • Events
      • Time - tmr expires
    • Conditions
    • Actions
      • Set mana2 = (mana1 - (Mana of u1))
      • Unit - Set mana of u1 to ((Mana of u1) + mana2)
      • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: (String(mana2))

 

Attachments

  • ManaHp.w3x
    13.8 KB · Views: 56
Level 24
Joined
Aug 1, 2013
Messages
4,657
Yes that is also working good...
However I would change the set life to the last trigger.

Next to that... isnt there a problem once multiple units cast an ability at the same time?
With heroes that is practically impossible but with normal units it can.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
If you have a group of units... and you order them to cast a spell.
They all cast the spell right? If so they cast it at the same time.

You could avoid it if you create a simple action that runs the third trigger and add that action to the timer (the second trigger has to be written in JASS to do that, but it will remove this problem completely)
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You absolutely should make it MUI, either use a unit group or a unit array

If you make a timer in GUI and convert the trigger to JASS, you can see that you are giving a null function as an action when the trigger ends.
If you replace that by the function that resets the mana and removes hp, then you have it MUI.
The most easiest way to get the proper unit is make a hashtable and store the handleid of the unit as the first value in the row (handle id of timer)
Once you have that, it is MUI.
 
Level 12
Joined
Oct 16, 2010
Messages
680
If you make a timer in GUI and convert the trigger to JASS, you can see that you are giving a null function as an action when the trigger ends.
that is a thing you have to consider using GUI, but I still don't know why ucame up all the time with this "if u convert to JASS" thing... basically if u do jass you would do many things different and I would use a struct extending array, for it's much more efficient then hashtables

I'm pretty sure about Maker know what his triggers do and how, he wrote it in GUI bcoz the thread opener told he doesen't have any JASS knowledge.
 
Level 1
Joined
Dec 11, 2014
Messages
6
Christmas, Christmas, and now it is after Christmas :b

I want to thanks again everyone who help me with my blood-magic-problem.
I really appreciate your commitment. :)

Now I'll back again to work with my map. First i tried with Maker example map. Got some errors becouse of "custom scripts". The same with Wietlol.

I'm not expert by any means but i think they are not very needed in Wietlol trigger (rare cases with memory leaks if i heard the true), so i cut them away. It Works nice. Overall, I am quite satisfied. But, any issues can still occur with long-casting spells or mana siphon, am i right?

If you have a little more patience... do u have any thoughts on this subject? :)
 
Status
Not open for further replies.
Top