• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Variables and Heroes

Status
Not open for further replies.
Level 22
Joined
Jul 25, 2009
Messages
3,091
Okay so I just started making a map with Gay-Laxy Editor as I like to call it... And I am incapable of finding the solutions to my problems alone...

1. How do you create variables?

2. How do you make a hero have a exp bar and skill tree?

3. How do I completely change the SFX for a weapon? What are the differences between the settings etc.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
1. How do you create variables?
Same way you do in C. Infact it has a prety much identical syntax. Obviously more complex opperators are not supported, but the syntax is the same.

Example:
Code:
int HELLO[3]; //Array of ints called HELLO with 3 indicies

Globals are declared outside functions. Locals are declared at the start of a function (like in older C environments).
Due to the lack of optimizing compilation and for security, pointers and volitiles are probably not supported (pointers were removed in beta, sigh).

You can also make variables using the lame GUI provided.
Globals...
Right click the Triggers panel (you can toggle this in the View menu) and select the New menu and choose New Variable.
Locals
Any GUI procedure part will give you access to a locals section. Ricght click the procedure part and select the New manue and choose New Variable to create a new local for use in that procedure.

2. How do you make a hero have a exp bar and skill tree?
EXP bar is done by the veterancy behaviour in the data editor. You will need to create a new behaviour extending the veterancy constructor and customize it to suit your needs. Finally go to all the units which should use that experience system and add the customized veterancy behaviour to their behaviours list.

No idea what you mean by a Skill tree...
For a full screen skill tree you will need a lot of trigger coding. This is done with dialogs for the graphics and some internal engine (made using a variery of triggers) to do the actual skill responses.
For a WC3 style skill system you will have to use the learn ability. Add all abilities the hero should learn to the learn ability. Add the learn ability and all abilites that get learned via it to the correct hero unit. Go the the hero unit command card and then make an icon for the learn ability and attach it (redirect to a blank command card). Then in that blank command card you place your learn icons and link them to the appropiate orders of the learn ability.

3. How do I completely change the SFX for a weapon? What are the differences between the settings etc.
Actors in the data editor. All sound effects are controled by actors. Actors get attached to other data elements by their event fields. This is the most complex part of the data editor (because there is no documentation) but luckilly for simple tasks it is really easy.
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
Same way you do in C. Infact it has a prety much identical syntax. Obviously more complex opperators are not supported, but the syntax is the same.

Example:
Code:
int HELLO[3]; //Array of ints called HELLO with 3 indicies

Globals are declared outside functions. Locals are declared at the start of a function (like in older C environments).
Due to the lack of optimizing compilation and for security, pointers and volitiles are probably not supported (pointers were removed in beta, sigh).

You can also make variables using the lame GUI provided.
Globals...
Right click the Triggers panel (you can toggle this in the View menu) and select the New menu and choose New Variable.
Locals
Any GUI procedure part will give you access to a locals section. Ricght click the procedure part and select the New manue and choose New Variable to create a new local for use in that procedure.


EXP bar is done by the veterancy behaviour in the data editor. You will need to create a new behaviour extending the veterancy constructor and customize it to suit your needs. Finally go to all the units which should use that experience system and add the customized veterancy behaviour to their behaviours list.

No idea what you mean by a Skill tree...
For a full screen skill tree you will need a lot of trigger coding. This is done with dialogs for the graphics and some internal engine (made using a variery of triggers) to do the actual skill responses.
For a WC3 style skill system you will have to use the learn ability. Add all abilities the hero should learn to the learn ability. Add the learn ability and all abilites that get learned via it to the correct hero unit. Go the the hero unit command card and then make an icon for the learn ability and attach it (redirect to a blank command card). Then in that blank command card you place your learn icons and link them to the appropiate orders of the learn ability.


Actors in the data editor. All sound effects are controled by actors. Actors get attached to other data elements by their event fields. This is the most complex part of the data editor (because there is no documentation) but luckilly for simple tasks it is really easy.

Thank you for the response. I don't know C I've never had any coding experience except with Python script... So is there any easier way to do so? Or is there a list of custom script functions somewhere like there was for WC3...? Like call destroygroup(udg_tempgroup) etc... Somewhere I could find all of the answers to my coding problems?

One last question can I make my own custom abilities just as in depth as WC3 and is there a recommended set of base spells to use? Like Point-Target, Unit-Target, No-Target etc...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Thank you for the response. I don't know C I've never had any coding experience except with Python script... So is there any easier way to do so? Or is there a list of custom script functions somewhere like there was for WC3...? Like call destroygroup(udg_tempgroup) etc... Somewhere I could find all of the answers to my coding problems?
Like I mentioned, you can also do it with GUI. Yes there is a large number of files which make up the native list in SC2. Some of the natives are even documented (although still poorly).

One last question can I make my own custom abilities just as in depth as WC3 and is there a recommended set of base spells to use? Like Point-Target, Unit-Target, No-Target etc...
Yes you can make them prety in depth although some WC3 things that were simple are now more difficult while other stuff is now more easy. There is no such thing as "Base spells", all abilities are made by using a constructor data type as a base and then linking to various effects.

For efficient abilities, you should try and get the data editor to do most of the work and realy on the trigger editor only to enhance effects with functionalty not provided.

Example, for a simple AoE damage ability which deals damage based on some variable factor (like level) you could use the data editor for most of it and then only trigger enhance the final effect which deals the damage.
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
Like I mentioned, you can also do it with GUI. Yes there is a large number of files which make up the native list in SC2. Some of the natives are even documented (although still poorly).


Yes you can make them prety in depth although some WC3 things that were simple are now more difficult while other stuff is now more easy. There is no such thing as "Base spells", all abilities are made by using a constructor data type as a base and then linking to various effects.

For efficient abilities, you should try and get the data editor to do most of the work and realy on the trigger editor only to enhance effects with functionalty not provided.

Example, for a simple AoE damage ability which deals damage based on some variable factor (like level) you could use the data editor for most of it and then only trigger enhance the final effect which deals the damage.

The more I work with this the more questions I have lol. How do I activate the variables I create?
Thanks for the help Docta.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
How do I activate the variables I create?
Activate variables? Sorry but I never heard of such a thing.

If you mean initialize them. You just allocate them a value when you declare them. GUI variables even have an interface for setting them to an intial value.

If you mean recalling them, then you can use them in any field that takes the variable type.

In script:
Referencing the variable name directly will evaluate to its stored value when the code executes that statement.
In GUI:
You need to find an appropiate field for the variable type and then go to the variables sub menu to see it out of the list of all variables of that type.

You can also set variables to new values.
In script this is done like this...
variable = value;
Note that opperators like += and -= are supported as well when setting variables.
In GUI you will need to use one of the set variable actions.
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
Activate variables? Sorry but I never heard of such a thing.

If you mean initialize them. You just allocate them a value when you declare them. GUI variables even have an interface for setting them to an intial value.

If you mean recalling them, then you can use them in any field that takes the variable type.

In script:
Referencing the variable name directly will evaluate to its stored value when the code executes that statement.
In GUI:
You need to find an appropiate field for the variable type and then go to the variables sub menu to see it out of the list of all variables of that type.

You can also set variables to new values.
In script this is done like this...
variable = value;
Note that opperators like += and -= are supported as well when setting variables.
In GUI you will need to use one of the set variable actions.

My problem is, I've created the variable and it shows up in every menu but the menu under "Set - Variable" I'm trying to create a variable for the last created dialog box.
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
What sort of variable did you make? Locals only have the scope of the function they are in and you are not allowed pointers.

I said Dialog in my last post... Not an item though, an actual Dialog box... When I try to set it like I would in WC3 it doesn't show up... "Variables - Set Variable - Last created dialog"


  • Variable - Set Variable = Value
That's Galaxy GUI if there is any confusion.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Is it a global or a local? I know its a integer for taking dialogs but is it global or local?
Locals will only exist within the function it was defined.
Globals will be available in all functions.

This is because locals go to the thread stack (so offer unique storage per thread) while globals go to main memory (only a static storage location).
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
Is it a global or a local? I know its a integer for taking dialogs but is it global or local?
Locals will only exist within the function it was defined.
Globals will be available in all functions.

This is because locals go to the thread stack (so offer unique storage per thread) while globals go to main memory (only a static storage location).

I can put in in the "Local Variable" section so I assume that's what it is. So my question is, how do I declare a local variable? I want to create a dialog board and set it to a variable so I can track it and use it in the future rather than the tacky and inefficient "Last Created Dialog" which would only work with one dialog box at a time.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Then you must obviously not use a local. Instead make a global variable for that.

Locals last until the end of the function they are in and are unique per thread. As there are no pointers it is imposible to use locals for any long term storage.
Globals go to a allocated space in memory and thus are static and consistent between all threads all the time.

SC2's script virtual machine is fully syncronized, so do not worry about syncronization that real threads need.
 
Status
Not open for further replies.
Top