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

Soummoned unit that order summoner cast an ability

Status
Not open for further replies.
Level 3
Joined
May 15, 2021
Messages
21
Привет, help me please with making a spell. My idea. Bm summon pheonix. Pheonix has an ability that order to cast flamestrike on targetpoint. I would like to do that trigger save bm and when pheonix uses an ability bm that summoned him start an ability I need locals cuz there are a lot of same heroes.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,574
You don't need locals, you can use Arrays or a Hashtable.

This is the best system available that works with Arrays: GUI Unit Indexer 1.4.0.0

  • Events
    • Unit - A unit spawns a summoned unit
  • Conditions
    • Unit-type of (Summoned unit) Equal to Phoenix
  • Actions
    • Set Variable BM[Custom value of (Summoned unit)] = (Summoning unit)
This trigger uses the Unit Indexer method, which takes advantage of Custom Value and Arrays to store data directly to units.

In this case I'm saving the BM to the Phoenix, so as long as you have access to the Phoenix you will also have access to it's Summoner (BM).

Then here's how you can order the BM to cast Flamestrike whenever the Phoenix is ordered to cast Flamestrike:
  • Flamestrike Example
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(flamestrike))
      • (Unit-type of (Ordered unit)) Equal to Phoenix
    • Actions
      • Unit - Order BM[Custom value of (Ordered unit)] to Human Blood Mage - Flame Strike (Target point of issued order)
 
Last edited:
Level 3
Joined
May 15, 2021
Messages
21
You don't need locals, you can use Arrays or a Hashtable.

This is the best system available that works with Arrays: GUI Unit Indexer 1.4.0.0

  • Events
    • Unit - A unit spawns a summoned unit
  • Conditions
    • Unit-type of (Summoned unit) Equal to Phoenix
  • Actions
    • Set Variable BM[Custom value of (Summoned unit)] = (Summoning unit)
This trigger uses the Unit Indexer method, which takes advantage of Custom Value and Arrays to store data directly to units.

In this case I'm saving the BM to the Phoenix, so as long as you have access to the Phoenix you will also have access to it's Summoner (BM).

Then here's how you can order the BM to cast Flamestrike whenever the Phoenix is ordered to cast Flamestrike:
  • Flamestrike Example
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(flamestrike))
      • (Unit-type of (Ordered unit)) Equal to Phoenix
    • Actions
      • Unit - Order BM[Custom value of (Ordered unit)] to Human Blood Mage - Flame Strike (Target point of issued order)
thanks, is there anything similar for jass?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,574
Everything that exists in GUI also exists in Jass, and then some.


If you're just getting started I'd recommend Lua > Jass if it's available to you.

Also, those systems may be out of date seeing as how the Index limit is 32,768 now.
 
Level 3
Joined
May 15, 2021
Messages
21
f you're just getting started I'd recommend Lua > Jass if it's available to you.
Yes I am novice in maps making. I wanted to start from gui but was adviced to start from jass. But couldn't find any good tutorials for that. I wanted to retire to lua after I become better in jass. But if lua is more esier to learn and it has a lot of good tutorials i'd be happy to switch
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,574
Yes I am novice in maps making. I wanted to start from gui but was adviced to start from jass. But couldn't find any good tutorials for that. I wanted to retire to lua after I become better in jass. But if lua is more esier to learn and it has a lot of good tutorials i'd be happy to switch
Lua is going to be very similar to Jass since they use the same API, what differs is the syntax rules and some other things that are unique to the languages. But one isn't really harder to learn than the other.

The thing is, you can only use one language or the other, which means that you're restricted from using any Jass resources if you use Lua. This could be problematic if there's a Jass system out there that you really want which doesn't have a Lua alternative. Remember that Jass has been around far longer than Lua, it was there from the beginning and during Warcraft 3's prime while Lua is fairly new. So there's currently more material on Jass than Lua on this site, but Lua is documented like any other programming language: Lua 5.3 Reference Manual - contents

I went straight to Lua from GUI and I understand both languages just fine but I can't say you'll have the same experience. I think Lua is a lot easier to use in most regards, for example it's rules regarding keywords and local variables are far less strict.

Some other notes:
I have helpful Lua links in my signature. Lua removes the need for some Jass systems such as the Unit Indexer so that's a nice plus. Additionally, Lua allows you to use other languages such as C# or TypeScript (search Hive for these), which can be great if you're comfortable with them. Although, they could further restrict you from the norm. I'd only recommend them once you're confident in your programming abilities. Bribe's Damage Engine and the RUID system both support Lua which is important to note.
 
Last edited:
Level 3
Joined
May 15, 2021
Messages
21
I'd only recommend them once you're confident in your programming abilities.
I am not good at coding. I almost know nothing about coding. But I know that lua is used for another game. I also would like to try some modding in factorio that also use lua. Thanks for advice
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,574
I am not good at coding. I almost know nothing about coding. But I know that lua is used for another game. I also would like to try some modding in factorio that also use lua. Thanks for advice
Yeah, I meant that you can code in C#/Typescript and it gets compiled to Lua. I program my maps in C# for example: Home · Orden4/WCSharp Wiki

Anyway, it sounds like Lua is the right choice for you.
 
Status
Not open for further replies.
Top