Need Help: Unit type = Parameter (string(string(u) + string(variable integer))) ??

Sensang

TH.net Regular
Reaction score
7
Hey Im working on ways to make a kind of mod, so actually I want as much as possible to be edited inside of one trigger. ATM Im working on the hero selection and I'm trying to edit it as much as possible by giving it parameters from my "setup" trigger.

Trigger:
  • Player Group - Pick each player in (All players) and do (Actions)
    • Dialog - Create a Modal dialog of size (1000, 400) at (0, 0) relative to Center of screen
    • Variable - Set ChooseHeroDialog[(Picked player)] = (Last created dialog)
    • Dialog - Set title of ChooseHeroDialog[(Picked player)] to "Choose your Warrior:"
    • Dialog - Create a Button for Dialog ChooseHeroDialog[(Picked player)] with the dimensions (161, 244) anchored to Bottom Left with an offset of ((0 + 40), (0 + 65)) setting the tooltip to ("Choose " + (Name of U1)) with button text " " and the hover image set to ""
    • Variable - Set ChooseHero[(Picked player)][0] = (Last created dialog item)
    • Dialog - Create an Image for Dialog ChooseHeroDialog[(Picked player)] with the dimensions (152, 232) anchored to Bottom Left with an offset of (((0 + 40) + 4), ((65 + 0) + 7)) setting the tooltip to "" using the image Assets\Textures\zealotportrait_static.dds as a Normal type with tiled set to true tint color White and blend mode Normal
    • Dialog - Show ChooseHeroDialog[(Picked player)] for (All players)


Now what i wanna do is, have the
Trigger:
  • Dialog - Create a Button for Dialog ChooseHeroDialog[(Picked player)] with the dimensions (161, 244) anchored to Bottom Left with an offset of ((0 + 40), (0 + 65)) setting the tooltip to ("Choose " + (Name of U1)) with button text " " and the hover image set to ""
(name of U1) actually be chosen by a "for each integer do that"-loop so I don't have to limit the action to a concrete number and types of heroes that can be selected.

So I guess what I'm trying to do is selecting a parameter by 2 strings, one of which is the variable "for each integer"-integer.

I'd also like to pick the image of the hero button by creating the image:
"Assets\Textures\(Name of string(string (u) + string(i))))portrait_static.dds"

btw. every u and every i are parameters, u is a unit type and i is the integer that is created by the
Trigger:
  • General - For each integer i from 1 to 10 with increment 1, do (Actions)


BTW. I excuse my almost non existent syntax knowledge. Atm I feel like if this problem can be solved then it's by writing custom script within the gui, so if someone who knows galaxy a little would be of great help.

And the whole sense in doing it that way would be to make it easier for other people to use the system I'm about to create. (Hack'n'Slay)
Making it as much of a customizable mod as possible
 

SerraAvenger

Cuz I can
Reaction score
234
Code:
Name of string(string (u) + string(i)))

No = )

What you want is a global string array UnitName, where UnitName is the name of the unit you want to create.
You also have a button array UnitButton, where UnitButton is the button that creates the unit with the UnitName.


So basically, you loop through all of the Heroes you could create,
then set the UnitName to the name of the corresponding unit
then set the text of UnitButton to "Choose " + UnitName
then set the button icon to the correct icon (dunno about file paths. From my feeling, it should be a tga, not a dds)

When a button is clicked, get the index i of the button within the array, and create the unit with the name of UnitName.
 

Sensang

TH.net Regular
Reaction score
7
Code:
Name of string(string (u) + string(i)))

No = )

What you want is a global string array UnitName, where UnitName is the name of the unit you want to create.
You also have a button array UnitButton, where UnitButton is the button that creates the unit with the UnitName.


So basically, you loop through all of the Heroes you could create,
then set the UnitName to the name of the corresponding unit
then set the text of UnitButton to "Choose " + UnitName
then set the button icon to the correct icon (dunno about file paths. From my feeling, it should be a tga, not a dds)

When a button is clicked, get the index i of the button within the array, and create the unit with the name of UnitName.


Ok thx I actually should've kown that, I was just caught in my other problem I guess^^

But nevertheless can someone plz tell me how the other thing is done?

How can I for example set a Unit portrait with just using the unit's name?
I've just realized I can't get the name of a unit with a string so I'd actually have to use text.

So I have the Array:
Trigger:
  • Variable - Set NameOfImage<i> = (&quot;Assets\Textures\&quot; + (&quot;(Name of HeroType(I))&quot; + &quot;portrait_static.dds&quot;))</i>


By that I could get the file address for every unit portrait that I've checked.
The question is if theres some way I can set the value for a image to that.

I figured if, then it can be done by coding it... Maybe by putting the text variable into the custom script slide at the image file.
But I don't have a clue how to get a galaxy variable... all I know is that it's not $NameOfImage ;)
 

SerraAvenger

Cuz I can
Reaction score
234
TextToString?

EDIT: GUI variables get renamed to
gv_#NAME
or

lib#ID_gv_#NAME (from within a library)
 

wingdnosring

New Member
Reaction score
16
Are you actually able to use strings to get images via variables? I didn't think you could in the Galaxy Editor. That would help me a lot if true.
 

Sensang

TH.net Regular
Reaction score
7
Are you actually able to use strings to get images via variables? I didn't think you could in the Galaxy Editor. That would help me a lot if true.

I have no idea why you shouldn't be able to do that... but it doesnt look very well.

I think the problem is that it can't use strings as variable names. But then again I don't know much about programming, yet.. :eek:
 

SerraAvenger

Cuz I can
Reaction score
234
I have no idea why you shouldn't be able to do that... but it doesnt look very well.

I think the problem is that it can't use strings as variable names. But then again I don't know much about programming, yet.. :eek:

Umm... Ever thought of using a data table for this?
 

SerraAvenger

Cuz I can
Reaction score
234
It is a data structure that allows you to map strings to any (?) other type.
So you can basically map the unit name to an image.
Just search for Data in the GUI action set.
 
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