Spell Help and Mass Upgrade stuff.

hopy

Active Member
Reaction score
64
Two questions for now, one is a spell and the other is using a spell in a spellbook for multiple units at once without creating an endless loop.

Question One: Ancestral Guardian.
What this spell is supposed to do: The Spirit Walker summons a Spirit that will copie the next spell cast at the Spirit Walker and cast it back at the unit casting it.

So in simple: Create a dummy unit and order the dummy to cast the same spell back at the unit casting it at the Spirit Walker.

(I've made my trigger a bit shorter in order to make it easier to read, the origonal version is longer with all the single target abilities in my map.
Trigger:
  • Spirit Barrier Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Target unit of ability being cast) has buff Ancestral Guardian ) Equal to True
      • ((Casting unit) belongs to an enemy of (Owner of (Target unit of ability being cast))) Equal to True
      • ((Casting unit) is Magic Immune) Equal to False
      • (Unit-type of (Casting unit)) Not equal to Dummy Unit
      • (Unit-type of (Casting unit)) Not equal to Spell Breaker
      • (Ability being cast) Not equal to Death Coil
      • (Ability being cast) Not equal to Anger
      • (Ability being cast) Not equal to Voodoo Doll
      • (Ability being cast) Not equal to Charge
      • (Ability being cast) Not equal to Epidemic
      • (Ability being cast) Not equal to No Pain
      • (Ability being cast) Not equal to Soul Link
      • (Ability being cast) Not equal to Bladerush
    • Actions
      • Set Interger = 0
      • Set Point = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy Unit for (Owner of (Target unit of ability being cast)) at Point facing Default building facing degrees
      • Unit - Add (Ability being cast) to (Last created unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Frost Nova (Neutral Hostile)
          • (Ability being cast) Equal to Frost Bolt
        • Then - Actions
          • Unit - Order (Last created unit) to Undead Lich - Frost Nova (Casting unit)
        • Else - Actions
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Interger Equal to 0
        • Then - Actions
          • Floating Text - Create floating text that reads (Name of (Ability being cast)) above (Target unit of ability being cast) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
          • Unit - Remove Ancestral Guardian buff from (Target unit of ability being cast)
        • Else - Actions

For this short test I only used Frost Nova (Neutral Hostile), that's why my testing trigger looks like this. :)

With this trigger the Floating Text worked, but as far as I can see the spell doesn't get casted at the caster. Does anyone see any mestake, or a reason why this shouldn't work in this trigger?

Question 2:
I've got a Warstomp in a Spellbook, it works fine and everything... but when I try to get the unit to use the ability with a trigger:
Trigger:
  • Unit - Order (Picked unit) to Orc Tauren Chieftain - War Stomp

It doesn't work at all, is it posible to order units to use abilities in spellbooks using triggers, or should I look somewere else for the problem?

(Extra question... forgot about this one:
The missile arts when using the ability Channel don't work at all, I've set an animation, speed and everything but it just doesn't show any missile art, should I use a different ability?).

Thanks for any helpfull replies and +rep for people giving any helpfull stuff. :)
 

Ashlebede

New Member
Reaction score
43
1. ^ bad in GUI.

2.
Andrewgosu said:
HOW TO ORDER A UNIT TO OPEN A SPELLBOOK
There is no way to do that.

HOW TO CAST SPELLS INSIDE A SPELLBOOK WITH TRIGGERS
There is no way to do that because there is no way to open the spellbook with triggers.

Look for an alternative.

3. Channel's missile art doesn't work. Try Storm bolt (though it interrupts casting), Shadow Strike (I never used it, so maybe you can't disable its floating text)...

Or, if you really can't find the "perfect" ability, you can still trigger the missile.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
@Ashlebede: you can open spellbooks with triggers, you can force a player to press a key. however this only works if A) the unit is selected by the owning player and B) the spellbook got a shortkey. it wont work for the author of this thread though i guess.

on-topic:
i cant really see where the problem is. try to add some debug messages, like set a debug message within this block:
Code:
# If (All Conditions are True) then do (Then Actions) else do (Else Actions)

    * If - Conditions
          o (Ability being cast) Equal to Frost Nova (Neutral Hostile)
          o (Ability being cast) Equal to Frost Bolt
    * Then - Actions
          DEBUG MESSAGE
          o Unit - Order (Last created unit) to Undead Lich - Frost Nova (Casting unit)
    * Else - Actions
and see whether it occurs or not.
or a debug message whenever a dummy unit is issued any order.

this way you can sort out whether the bug is within the conditions or the actions.
 

Bogrim

y hello thar
Reaction score
154
The problem with reflecting spells in GUI is that you cannot input any event responses or variables when selecting an order, even if you manage to copy the ability for the dummy unit. While there are much better JASS alternatives, the GUI form would look like this:
Trigger:
  • Spell Reflect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Target unit of ability being cast) has buff Spell Reflect ) Equal to True
    • Actions
      • Set Temp_Integer = (Load (Key Array Index) of (Key (Name of (Ability being cast))) from Hashtable_SpellReflect)
      • Trigger - Run Reflect_Trigger[Temp_Integer] (ignoring conditions)

Now this *looks* simple, but this method also includes:

1. Making a hashtable library in your map initialization that assigns a unique number to each reflect-able ability's name.
2. Making a trigger for each reflect-able ability that creates a dummy unit, adds the right ability and issues the right order.
3. Saving each of those triggers in the array with the corresponding indexes in the map initialization as well.

For example, a trigger from the array might look like this:
Trigger:
  • Reflect Storm Bolt
    • Events
    • Conditions
    • Actions
      • Set Temp_Point = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy Unit for (Owner of (Target unit of ability being cast)) at Temp_Point facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Storm Bolt to (Last created unit)
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Triggering unit)
      • Custom script: call RemoveLocation( udg_Temp_Point )

Then to save the ability in the hashtable and array in the map initialization:
Trigger:
  • Actions
    • Set Reflect_Trigger[1] = Reflect Storm Bolt <gen>
    • Hashtable - Save 1 as (Key Array Index) of (Key Storm Bolt) in Hashtable_SpellReflect

Not terribly hard, but a lot of work if you have a dozen of abilities!
 

hopy

Active Member
Reaction score
64
First of all thank you all for replying.

@Ashlebede: you can open spellbooks with triggers, you can force a player to press a key. however this only works if A) the unit is selected by the owning player and B) the spellbook got a shortkey. it wont work for the author of this thread though i guess.
The unit IS selected by the owning player, and the spellbook didn't have a hotkey yet, but that takes about 10 seconds to add right? :p

So it is posible to order a spellbook ability? Cause the thing is: I want that when a unit uses an ability from his Spellbook, all other units being selected do the same thing.

3. Channel's missile art doesn't work. Try Storm bolt (though it interrupts casting), Shadow Strike (I never used it, so maybe you can't disable its floating text)...

Or, if you really can't find the "perfect" ability, you can still trigger the missile.

Strange that an ability like Channel can't even do a missile art... alright, I'll look for a good alternative than.

1. Making a hashtable library in your map initialization that assigns a unique number to each reflect-able ability's name.
2. Making a trigger for each reflect-able ability that creates a dummy unit, adds the right ability and issues the right order.
3. Saving each of those triggers in the array with the corresponding indexes in the map initialization as well.
Why do I need a trigger for each ability, and a hastible when I can add the right ability to my dummy using "Ability being cast" and than just check with Ifs/Else what the base order ID of the ability is, and than order my dummy to cast this. As far as I know that should work right? D:

Anyways, if it doesn't work I think I'll have to seach for an alternative, I'd rather not have about 50 triggers for one spell, and I haven't got a clue how Hastible work. :p
 

Bogrim

y hello thar
Reaction score
154
Why do I need a trigger for each ability, and a hastible when I can add the right ability to my dummy using "Ability being cast" and than just check with Ifs/Else what the base order ID of the ability is, and than order my dummy to cast this. As far as I know that should work right? D:
The idea of using a trigger for each spell reflect is to reduce the process to the absolute minimum (= most effective). If you run an "If Then Else" for every ability in the same trigger then your trigger will probably bring lag to a new level.

Making an individual trigger for each ability would also allow you to customize the nature of each reflect to make sure it works properly.

The problem here is that you're not making "50 triggers for 1 spell", you're making a system for spell reflection. If there are no mechanics for spell reflecting, you have to create them yourself. It's not a pretty solution, but not all GUI solutions are as good as they would be in JASS.
 

hopy

Active Member
Reaction score
64
Sorry for the late reply. :(

The problem here is that you're not making "50 triggers for 1 spell", you're making a system for spell reflection. If there are no mechanics for spell reflecting, you have to create them yourself. It's not a pretty solution, but not all GUI solutions are as good as they would be in JASS.
The current trigger has 21 If/else's, one for every type of enemie targetted single target ability in WIII. Is this realy too much?
Else, I have the choise to either:
1. Have a lot of lag.
2. Learn JASS.
3. Think of a different ability.

I also still need a reply on:
How do I cast an ability from a spell book (with triggers), the spellbook has a Hotkey, and the unit is being selected.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
you can force a player to press a key. its a trigger function:
Trigger:
  • Game - Force UI key

this way you can do things like:
Trigger:
  • Game - Force Player 1 (Red) to press the key A

and in case your units with the spellbook is selected and the spellbooks shortkey is 'A' the spellbook will be opened.
 

hopy

Active Member
Reaction score
64
you can force a player to press a key. its a trigger function:
Trigger:
  • Game - Force UI key

this way you can do things like:
Trigger:
  • Game - Force Player 1 (Red) to press the key A

and in case your units with the spellbook is selected and the spellbooks shortkey is 'A' the spellbook will be opened.

Thank you very much for the fast reply.

Alright, I think that would work perfectly, however I had one last question: Would doing this work for multiple units at once?
Since this was all about multiple units using an ability from a spellbook at once.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
you know how the wc3 engine works do you? a player cannot open the spellbooks of multiple units, that wouldnt make any sense since his command buttons are limited to 12 and these are already taken by a single spellbook.

i doubt it will work to use an ability out of a spellbook for multiple units.
 

hopy

Active Member
Reaction score
64
you know how the wc3 engine works do you? a player cannot open the spellbooks of multiple units, that wouldnt make any sense since his command buttons are limited to 12 and these are already taken by a single spellbook.

i doubt it will work to use an ability out of a spellbook for multiple units.

Well... how about... err... ehm...
I put every selected unit in a unit group and pick every unit in it, I select the picked unit and order them to open the spell book and cast that ability. Once all of that is done I'll select the total unit group again... I think that would work right? And I think it might look a little strange in game... but who cares. xD
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
go ahead and check it out, i never did something like this and i doubt many did.
 

hopy

Active Member
Reaction score
64
go ahead and check it out, i never did something like this and i doubt many did.

What I have so far:
Trigger:
  • Berserker Start
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • ((Matching unit) is in Train_Group[(Player number of (Owner of (Triggering unit)))]) Not equal to True
      • (Ability being cast) Equal to Warrior
    • Actions
      • Unit Group - Add (Triggering unit) to Train_Group[(Player number of (Owner of (Triggering unit)))]
      • Set Unit_Group = (Units owned by (Owner of (Triggering unit)) matching ((((Matching unit) is selected by (Owner of (Triggering unit))) Equal to True) and (((Unit-type of (Matching unit)) Equal to Noob) and (((Matching unit) is in Train_Group[(Player number of
      • Selection - Clear selection for (Owner of (Triggering unit))
      • Unit Group - Pick every unit in Unit_Group and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to Train_Group[(Player number of (Owner of (Triggering unit)))]
          • Selection - Select (Picked unit)
          • Game - Force (Owner of (Triggering unit)) to press the key T
          • Unit - Order (Picked unit) to Orc Tauren Chieftain - War Stomp
          • Selection - Select (Picked unit)
      • Selection - Select Unit_Group for (Owner of (Triggering unit))
      • Custom script: call DestroyGroup (udg_Unit_Group)

If a worker casts Berserker:
- The main caster will be added to Train_Group[Pnmr.oTU]
- Selection is cleared.
- All units that were also selected while the main unit casts are picked.
- Picked units will be added and placed into Train_Group as well to prevent an endless loop when they're casting.
- The Picked units are forced to use the ability in the spell book.
- Units are removed from selection.

- All units that were origonally selected are selected again.

Trigger:
  • Berserker
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Matching unit) is in Train_Group[(Player number of (Owner of (Triggering unit)))]) Equal to True
      • (Ability being cast) Equal to Warrior
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) Current gold) Greater than or equal to 70
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to 4
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Triggering unit)) Food used) Less than or equal to (((Owner of (Triggering unit)) Food cap) - 1)
                • Then - Actions
                  • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) - 70)
                  • Player - Set (Owner of (Triggering unit)) Current lumber to (((Owner of (Triggering unit)) Current lumber) - 4)
                  • Unit - Replace (Triggering unit) with a Warrior using The new unit's default life and mana
                  • Unit Group - Remove (Triggering unit) from Train_Group[(Player number of (Owner of (Triggering unit)))]
                • Else - Actions
                  • Game - Display to (All players matching ((Matching player) Equal to (Owner of (Triggering unit)))) the text: |cffff0000You need ...
                  • Unit Group - Remove (Triggering unit) from Train_Group[(Player number of (Owner of (Triggering unit)))]
            • Else - Actions
              • Game - Display to (All players matching ((Matching player) Equal to (Owner of (Triggering unit)))) the text: |cffff0000You need ...
              • Unit Group - Remove (Triggering unit) from Train_Group[(Player number of (Owner of (Triggering unit)))]
        • Else - Actions
          • Game - Display to (All players matching ((Matching player) Equal to (Owner of (Triggering unit)))) the text: |cffff0000You need ...
          • Unit Group - Remove (Triggering unit) from Train_Group[(Player number of (Owner of (Triggering unit)))]

- When the caster finishes the trigger checks if you have enough Gold, Wood and Food for the upgrade and if that's right than the unit will upgrade, if the player doesn't have enough recourses he'll get a massage.

What happens is: Nothing at all... the upgrading doesn't happen, the selection stuff doesn't work.... <,<

Does anyone see a problem with this here?
 
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