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

Auto-Cast summon unit from building -Mana

Status
Not open for further replies.
Level 2
Joined
May 11, 2009
Messages
11
Hello everyone, I have a cool idea that I can make an entire game out of but Instead of doing raw grunt triggers I can cut alot of corners with a simple yet effective manipulation in the Object Editor. The problem is I can't seem to make it happen. I got it to work in Starcraft 2 but I guess thats an entirely irrelevant point, I believe its possible in the Warcraft 3 engine.

What I am trying to achieve if the title of this topic is not clear is I would like a building, any building, to be able to summon/create a unit using mana the building posseses much like a hero or caster would. This summon/create unit button would also need to be a constant thing so I am very much in need of it to be possible to auto cast the summon/create unit.

I hope I was informative enough and after many searching around the forums was unable to obtain relevant information about how to go about achieving this setup. If you know how to do this please let me know below as it will either make this project of mine a reality or stop it dead in its tracks. I might even learn more about the Object Editor in the process.

Sik.
 
Last edited:
Level 1
Joined
Dec 4, 2019
Messages
7
I would say find an autocast spell like Inner Fire, give it to the building, duration of like one second, only castable on self. Link the spell being cast to a trigger that spawns a unit. As long as the building has mana, it should try to inner fire itself every second causing a unit to spawn.

That's what i'd use as a base idea anyway.
 
Level 2
Joined
Nov 26, 2019
Messages
10
So what exactly is stopping you from achieving this? Are you trying to realize this without any triggers?

If you're using triggers you really don't need any kind of autocast ability. You could just make a periodic event and check if theres enough mana.

Otherwise you could add the ability to the unit and order it to cast X every Y. If the unit is controlled by a computer you might also find a way where it autocasts the ability on cooldown without any order to do so.
 
Last edited:
Level 2
Joined
May 11, 2009
Messages
11
Ok so lets say I do the inner fire trick and use triggers, in theory lets say the building has 25 energy, one unit costs 15, the next costs 10 and the third costs 5.

Now you have all 3 on auto cast, will it glitch out and give all three or do the triggers work in order of where they are listed like in the Broodwar editor OR is it building queue related?
 
Last edited:
Level 9
Joined
Jul 30, 2018
Messages
445
If you copy the same ability and even if you edited them not to look the same at all, the order string is hard-coded to the ability, so the game engine will try to cast all of the abilities at the same time and finally only one of them will get cast. If you want such case with different mana costs, you are going to have to use three different abilities.

Also, a unit can have only one ability on auto-cast at a time. My suggestion is to just use the Channel ability to make dummy abilities (it is the only ability where you can change the order string so you can actually have many abilities copied from the same ability) and then use a periodic trigger to order the unit to cast them.
 
Level 2
Joined
Apr 1, 2019
Messages
156
Actually you can have multiple abilities on autocast as long as you use.

-one orb effect autocast
-phase shift
-any target autocast spell

Not very viable in this situation tho. But if your looking for aesthetics.

Theres a thread somewhere on this, cant find it :(
 
Level 2
Joined
May 11, 2009
Messages
11
Actually you can have multiple abilities on autocast as long as you use.

-one orb effect autocast
-phase shift
-any target autocast spell

Not very viable in this situation tho. But if your looking for aesthetics.

Theres a thread somewhere on this, cant find it :(

I have read a few pages of good information after a quick search and found them lacking on this exact subject, the only reason they lack however is due to the fact I need the building to cast multible abilities with mana prioritising the lesser.

If you copy the same ability and even if you edited them not to look the same at all, the order string is hard-coded to the ability, so the game engine will try to cast all of the abilities at the same time and finally only one of them will get cast. If you want such case with different mana costs, you are going to have to use three different abilities.

Also, a unit can have only one ability on auto-cast at a time. My suggestion is to just use the Channel ability to make dummy abilities (it is the only ability where you can change the order string so you can actually have many abilities copied from the same ability) and then use a periodic trigger to order the unit to cast them.

Thanks for the clarifacation.
 
Level 2
Joined
May 11, 2009
Messages
11
Yea I can't get triggers to fire when auto-casting Fairy Fire or Inner Fire, I can click the ability and cast it on the building and it works but it will not fire the abilities on Auto-Cast. Anyone know the trigger or setup?

I've tried channeling/casting, two diferent ways for the trigger to fire, both work but only if you manualy cast the spell. Neither work on Auto-Cast which the ability is doing.
 
Level 7
Joined
Apr 17, 2017
Messages
316
Well for auto-cast abilities you can use order ids. To get the order ids you can try this:
  • Orderid
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Custom script: set udg_Order = GetIssuedOrderId()
      • Custom script: call BJDebugMsg(I2S(udg_Order))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Order Equal to Yourorder id
        • Then - Actions
          • ---------- your actions here ----------
        • Else - Actions
 
Level 2
Joined
May 11, 2009
Messages
11
Well for auto-cast abilities you can use order ids. To get the order ids you can try this:
  • Orderid
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Custom script: set udg_Order = GetIssuedOrderId()
      • Custom script: call BJDebugMsg(I2S(udg_Order))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Order Equal to Yourorder id
        • Then - Actions
          • ---------- your actions here ----------
        • Else - Actions
I keep getting error with "GetIssuedOrderId()", something about too many paramaters. I think I'm doing it wrong, can you explain in more detail?

What is this manipulation you're speaking of?

I thought there was some auto-casting summon units ability available at first but was completly wrong, so hopefully the above comment can get me around that.

Otherwise I've gotto use a building for each unit and with 3 tiers and 13 units per race that will equal around 25 buildings per race. Sounds painfull but I've already setup Humans, but if I can get that above trigger working then I can just make it 1 building with 12/14 abilities.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
I thought there was some auto-casting summon units ability
Carrion Beetles, but they require a corpse to cast on. You could combine it with exhume corpses/whatever the graveyard uses to automatically make them around the building.
I keep getting error with "GetIssuedOrderId()", something about too many paramaters. I think I'm doing it wrong, can you explain in more detail?
What Aeryn wrote is all there is to explain. Just type that. The “Order” variable used is an int, not a string.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,541
Is autocast even necessary though?

You can achieve this fairly easily without it. Instead, create a bunch of abilities based on Channel, "Summon Footman", "Summon Knight", etc... and make them Instant. Then have a trigger that checks when you cast one of these abilities. The first cast toggles the ability "on" and the second toggles it "off" again.

You can use Booleans in combination with a Unit Indexer to keep track of every building's current settings. Add the buildings to a Unit Group so you can enumerate through all of them easily and check "If SummonFootman[custom value of picked building] = True then create a Footman at Point".

Maybe not so noobie friendly as you'd have to track the "Cooldown" (A triggered cooldown) of each ability so that players can't abuse it but it's certainly doable.
 
Last edited:
Status
Not open for further replies.
Top