• 🏆 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!

Mana drain - but the other one around! -> gives mana to unit

Status
Not open for further replies.

Ardenian

A

Ardenian

I am searching for a spell that channels mana to a targeted unit. So it is like mana drain, but instead of taking mana, it gives mana to the targeted unit.
It should work similar to the generator link in 'Power Towers TD', in case someone knows this map.

Content
- Transfer a certain value of own mana per second to the target
- Changeable amount of targets ( allow two, three, ... targets at the same time)
- Disrupt in case own mana is empty
- stop transfer in case targets mana is full, but do not destroy link! ( so if targets mana drops under max, transfer will apply again without that you have to link again)
 
Last edited by a moderator:

Ardenian

A

Ardenian

I will have it up in no time.
Challenge accepted.

Question:
It states that it allow 2,3 targets at the same time. You want it to be AoE and affect all allies within the radius?

Oh, that is really kind of you!

NO, it is not an aoe ability, but a target ability. That means, if you lock on a target, it channels the mana. If you use the ability again, it locks on a second target, that means there are two units that will gain mana from the unit and the mana of the caster is reduced twice as fast.
Hope you understand.

Therefore you may also add an un-link ability if the caster doesn't want to give mana to a specific target anymore
 

Ardenian

A

Ardenian

Oh ok it is way more complicated.
Another Question:
Is it channeling? E.g. Does walking cancels the ability?

The Ability will primary be used by a building ( 'Power Generator', 'Crystal' and such), therefore it is not necessary that you include walking interrupts ability, but may add it, I don't know whether later there will be a walking unit using this ability.

EDIT: Yes please add 'walking interrupts ability', as it will be used by a Necromancer
 

Ardenian

A

Ardenian

This was kinda rushed since I'm sleepy (its 10:32 in where I am).

Anyway just modify it a bit.
Hope this helps.

Note: this is MPI not MUI.

Thank you, I will try it out later and give you feedback!

EDIT: okay, tested it, there are two major things I noticed:

1. Mana Give still gives mana although caster has no mana
2. Dummy is displayed, as well as it's death animation

The other things seem to work fine, but I have a question: Does MPI means only one unit can cast it at the same time ?
 
Last edited by a moderator:
Level 22
Joined
Feb 6, 2014
Messages
2,466
I will fix it tomorrow if that's ok.
MPI means different player casting it is ok but if the player has 2 units casting it, it will have erraneous result.
if I can, I will also make it MUI tomorrow

Message me if you want me to fix it. Im on my phone (no worldedit) so this will have to wait for tomorrow.
 

Ardenian

A

Ardenian

I will fix it tomorrow if that's ok.
MPI means different player casting it is ok but if the player has 2 units casting it, it will have erraneous result.
if I can, I will also make it MUI tomorrow

Message me if you want me to fix it. Im on my phone (no worldedit) so this will have to wait for tomorrow.

Yes, please fix it and please make it MUI, so multiple units of one player can cast it.

Don't worry about time, it is more than okay if I get it next days, I don't need it as fast as possible.
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
Content
- Transfer a certain value of own mana per second to the target
- Changeable amount of targets ( allow two, three, ... targets at the same time)
- Disrupt in case own mana is empty
- stop transfer in case targets mana is full, but do not destroy link! ( so if targets mana drops under max, transfer will apply again without that you have to link again)

Ok here it is. This time I fully checked your requirements unlike last time because I was feeling tired, sorry. I made it transfer 10 mana per second but it is easily editable and can even be made by levels. E.g. Lv1: 10 mps, Lv2: 15 mps, etc.

If you have any questions, don't hesitate to ask. Also I only disabled the BJDebugMsg and not removed it for you to understand it as well.
 

Attachments

  • Opposite Mana Drain.w3x
    22.1 KB · Views: 67

Ardenian

A

Ardenian

Ok here it is. This time I fully checked your requirements unlike last time because I was feeling tired, sorry. I made it transfer 10 mana per second but it is easily editable and can even be made by levels. E.g. Lv1: 10 mps, Lv2: 15 mps, etc.

If you have any questions, don't hesitate to ask. Also I only disabled the BJDebugMsg and not removed it for you to understand it as well.

Thank you a lot!
I understand sleeping is much more important than reading requirements, therefore I do not judge you for anything.

It can probably take a lot of time before I will ask a question, in case I will have one, so I hope it is not a problem if you get PMed in a week/month/any undefined time.

Nevertheless I will check it out and will EDIT in case I have something to say.

Thank you a lot, again!

EDIT: okay, seems to work smooth now. But, only one time the link was interrupted for no reason, I will have to check several times again to see what causes this.

Something else I noticed, what is, of course, my mistake,
could you please add a range limit ? So if target unit leaves a certain range of caster, link will be interrupted.
could you please add a casting range ? -> is already added, I think
 
Last edited by a moderator:
Level 22
Joined
Feb 6, 2014
Messages
2,466
For the range limit, just edit the periodic trigger that if distance between picked unit and manaGiveTarget, lets say less than 1000, then the mana transfer will run. Else, it will kill the dummy unit.

For the casting range, just edit the ability object editor

Edit: also forgot to emotional that for it to be MUI, each unit that can cast the ability must have different custom values
 
Last edited:

Ardenian

A

Ardenian

For the range limit, just edit the periodic trigger that if distance between picked unit and manaGiveTarget, lets say less than 1000, then the mana transfer will run. Else, it will kill the dummy unit.

For the casting range, just edit the ability object editor

Edit: also forgot to emotional that for it to be MUI, each unit that can cast the ability must have different custom values

Oh okay, easy.

@EDIT: so, that means what ?
 

Ardenian

A

Ardenian

Sorry I meant mention not emotional. Stupid autocorrect .

Anyway, it means that each time you create a unit in your map which is not a dummy, you should set a custom value to it that no other unit has.

You demand a skyscraper from me :´( so how do I have to do this ? hashtabel, Index, something I never heard of ?
You have to excuse, I am really bad in things that are beyond basic map-making. Could you please explain it to me ?
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
You demand a skyscraper from me :´( so how do I have to do this ? hashtabel, Index, something I never heard of ?
You have to excuse, I am really bad in things that are beyond basic map-making. Could you please explain it to me ?

It depends on your map.
My suggestion is create a counter variable for assigning custom values.
Create a trigger that fires when your unit with the Give Mana ability is created and set its custom value to the counter. Then set counter = counter +1.
when another unit with give mana is created, it will have a custom value equal to counter which is now different with the last one. That way, all unit with give mana ability has different custom values and the trigger will run perfectly.
 

Ardenian

A

Ardenian

It depends on your map.
My suggestion is create a counter variable for assigning custom values.
Create a trigger that fires when your unit with the Give Mana ability is created and set its custom value to the counter. Then set counter = counter +1.
when another unit with give mana is created, it will have a custom value equal to counter which is now different with the last one. That way, all unit with give mana ability has different custom values and the trigger will run perfectly.

I have problems to get it working in my map, I have to check that.

About that counter, it's an integer variable ? Or do I use 'counter', the variable you created ?
 

Ardenian

A

Ardenian

  • Give Mana
    • Ereignisse
      • Einheit - A unit Startet den Effekt einer Fähigkeit
    • Bedingungen
      • (Ability being cast) Gleich Give Mana
    • Aktionen
      • Set playerNum = (Custom value of (Triggering unit))
      • Set counter = 0
      • For each (Integer A) from 0 to 2, do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • manaGiveTarget[((playerNum x 3) + (Integer A))] Gleich Keine Einheit
            • 'THEN'-Aktionen
              • Set tempInt = (Integer A)
              • Custom script: set bj_forLoopAIndex = 2
              • Custom script: call BJDebugMsg("tempInt = " + I2S(udg_tempInt))
            • 'ELSE'-Aktionen
              • Set counter = (counter + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • counter Größer als 2
                • 'THEN'-Aktionen
                  • -------- Max Num of target is reached --------
                  • Einheit - Order (Triggering unit) to Stoppen
                  • Set tempInt = 10
                • 'ELSE'-Aktionen
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • tempInt Ungleich 10
        • 'THEN'-Aktionen
          • Set unitPt = (Position of (Target unit of ability being cast))
          • Set manaGiveTarget[((playerNum x 3) + tempInt)] = (Target unit of ability being cast)
          • Einheitengruppe - Add (Triggering unit) to manaGivers
          • Einheit - Create 1 Camp for Neutral feindlich at unitPt facing Vorgabe für Gebäude-Ausrichtung degrees
          • Set manaGiveTargetEffect[((playerNum x 3) + tempInt)] = (Last created unit)
          • Einheit - Order (Last created unit) to Menschen-Blutmagier - 'Mana abziehen' (Triggering unit)
          • Custom script: call RemoveLocation(udg_unitPt)
          • Auslöser - Turn on Give Mana Periodic <gen>
        • 'ELSE'-Aktionen
  • Give Mana Periodic
    • Ereignisse
      • Zeit - Every 0.10 seconds of game time
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Pick every unit in manaGivers and do (Actions)
        • Schleifen - Aktionen
          • Set playerNum = (Custom value of (Picked unit))
          • For each (Integer A) from 0 to 2, do (Actions)
            • Schleifen - Aktionen
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • manaGiveTarget[((playerNum x 3) + (Integer A))] Ungleich Keine Einheit
                • 'THEN'-Aktionen
                  • Custom script: call SetUnitX(udg_manaGiveTargetEffect[udg_playerNum*3 + bj_forLoopAIndex], GetUnitX(udg_manaGiveTarget[udg_playerNum*3 + bj_forLoopAIndex]) )
                  • Custom script: call SetUnitY(udg_manaGiveTargetEffect[udg_playerNum*3 + bj_forLoopAIndex], GetUnitY(udg_manaGiveTarget[udg_playerNum*3 + bj_forLoopAIndex]) )
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Bedingungen
                      • (Mana of (Picked unit)) Größer als 1.00
                    • 'THEN'-Aktionen
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • 'IF'-Bedingungen
                          • (Mana of manaGiveTarget[((playerNum x 3) + (Integer A))]) Kleiner als (Max. Mana of manaGiveTarget[((playerNum x 3) + (Integer A))])
                        • 'THEN'-Aktionen
                          • Einheit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - 1.00)
                          • Einheit - Set mana of manaGiveTarget[((playerNum x 3) + (Integer A))] to ((Mana of manaGiveTarget[((playerNum x 3) + (Integer A))]) + 1.00)
                        • 'ELSE'-Aktionen
                    • 'ELSE'-Aktionen
                      • Custom script: call BJDebugMsg("No more Mana to GIVE")
                      • Einheit - Kill manaGiveTargetEffect[((playerNum x 3) + (Integer A))]
                      • Set manaGiveTargetEffect[((playerNum x 3) + (Integer A))] = Keine Einheit
                      • Set manaGiveTarget[((playerNum x 3) + (Integer A))] = Keine Einheit
                • 'ELSE'-Aktionen
  • Stop Giving Mana
    • Ereignisse
      • Einheit - A unit Startet den Effekt einer Fähigkeit
    • Bedingungen
      • (Ability being cast) Gleich Stop Giving Mana
    • Aktionen
      • Set playerNum = (Custom value of (Triggering unit))
      • Custom script: call BJDebugMsg("Target Name : " + GetUnitName(GetSpellTargetUnit()))
      • For each (Integer A) from 0 to 2, do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • manaGiveTarget[((playerNum x 3) + (Integer A))] Gleich (Target unit of ability being cast)
            • 'THEN'-Aktionen
              • Custom script: call BJDebugMsg("Killed: Link number " + I2S(bj_forLoopAIndex))
              • Einheit - Kill manaGiveTargetEffect[((playerNum x 3) + (Integer A))]
              • Set manaGiveTargetEffect[((playerNum x 3) + (Integer A))] = Keine Einheit
              • Set manaGiveTarget[((playerNum x 3) + (Integer A))] = Keine Einheit
              • Custom script: call BJDebugMsg("Variable Update : " + GetUnitName(udg_manaGiveTarget[udg_playerNum*3]))
              • Custom script: call BJDebugMsg("Variable Update : " + GetUnitName(udg_manaGiveTarget[udg_playerNum*3 + 2]))
              • Custom script: call BJDebugMsg("Variable Update : " + GetUnitName(udg_manaGiveTarget[udg_playerNum*3 + 1]))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • manaGiveTarget[((playerNum x 3) + 0)] Gleich Keine Einheit
                  • manaGiveTarget[((playerNum x 3) + 1)] Gleich Keine Einheit
                  • manaGiveTarget[((playerNum x 3) + 2)] Gleich Keine Einheit
                • 'THEN'-Aktionen
                  • Custom script: call BJDebugMsg("No more unit to give mana")
                  • Einheitengruppe - Remove (Triggering unit) from manaGivers
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Bedingungen
                      • (Number of units in manaGivers) Gleich 0
                    • 'THEN'-Aktionen
                      • Auslöser - Turn off Give Mana Periodic <gen>
                    • 'ELSE'-Aktionen
                • 'ELSE'-Aktionen
            • 'ELSE'-Aktionen
  • A unit Dies
    • Ereignisse
      • Einheit - A unit Stirbt
    • Bedingungen
      • (Unit-type of (Triggering unit)) Gleich Soulbasin
    • Aktionen
      • Set playerNum = (Custom value of (Triggering unit))
      • For each (Integer A) from 0 to 2, do (Actions)
        • Schleifen - Aktionen
          • Set manaGiveTargetEffect[((playerNum x 3) + (Integer A))] = Keine Einheit
          • Einheit - Kill manaGiveTargetEffect[((playerNum x 3) + (Integer A))]
          • Set manaGiveTarget[((playerNum x 3) + (Integer A))] = Keine Einheit
      • Einheitengruppe - Remove (Triggering unit) from manaGivers
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Number of units in manaGivers) Gleich 0
        • 'THEN'-Aktionen
          • Auslöser - Turn off Give Mana Periodic <gen>
        • 'ELSE'-Aktionen
There has to be a mistake I did, because casting 'Give Mana' creates 'Camp', the basic building of another race...

EDIT: okay I found the thing with camp, but still it isn't working, could you help me please ?
 

Ardenian

A

Ardenian

You create a new counter not the one I created.
For the Give Mana trigger, yes the unit is created for player hostile because mana drain can only be targeted to an enemy

Uhm ,okay err, but it still does not work...
it works perfectly fine in your test map, but not in mine :(
 

Ardenian

A

Ardenian

Do not create Camp. Create a dummy caster and in object editor, add the mana drain effect ability to your dummy caster

Yes, I compared it to sample map and then changed it the way you describe it in the quote.

It seems to work now, I guess, but it does not show any animation ( bloodmage-draineffect).

And to be honest, I struggle with the custom variable you want me to create.
 

Ardenian

A

Ardenian

The reason there is no mana drain animation is because maybe you did not add the mana drain effect ability to the dummy caster.
look at my sample map and look at the init trigger. You will see that I set the custom value of the 2 bloodmage different to prevent conflict.

Hm, okay I will try to. But I added 'Mana Drain Effect' to 'Dummy Caster' and there isn't any animation...
 

Ardenian

A

Ardenian

Hmm that's odd it should show the mana drain animation.
Due to lack of information, I cannot give you a solution to the animation problem and I think you can solve it on your own since you already have a basis working map.

Yes, I won't bother you anymore.
thank you a lot for creating this spell!
 

Ardenian

A

Ardenian

You can still ask question about how it works and all but questions like why it is not working in your map is difficult to answer.

Yes, I fully understand that it is near impossible to solve a 'not working' problem without any information.
Therefore I posted map-triggers of my map, but seems to be an unit problem or such.

For the moment, I am fine with that it is working.
 
Status
Not open for further replies.
Top