A trigger determines which unit is it and what it's portrait is and then proceeds to display the said portrait.
I am currently making a map in which the IU is hidden, so to display the portrait I need to use the "Create Portrait".
The way I am currently doing it really bugs me, setting the portrait inside a "if/else", meaning I would need to do one for each unit type I use. It's like this:
If
((Unit Type of (A)) = Zergling
Then
Set "A-Portrait" = Portrait - Zergling
Else
If
((Unit Type of (A)) = Roach
Then
Set "A-Portrait" = Portrait - Roach
Else
.
.
.
(and so on...)
Is it possible to do something like this:
Portrait - Set the model of ql_DialogQuest Accept/Decline.PortraidId as (Get Portrait Model(aUnit) (Don't wait))
NOTE: This line above is not actually a trigger, it's just stating what I want to do, but can't.
Apparently I can get the portrait and change it, but not refer to it with the "Create Portrait" trigger.
All the options I get there is either a single strange function that I don't understand or linking directly to the model file (which is what I am doing).
Sorry to tell you this but Ive researched this a lot more than I should have. Months of asking and waiting and researching.
The answer I have found is, no, you cannot dynamically call on unit portraits or models.
Now if there is a way, I havent found it, so there still could be hope. My last attempt was through using the catalogs but what I found was, you cannot call a catalog without specifying the unit with text, meaning player entry. So since this is the case, having the trigger dynamically enter the data for you based on your selection is impossible. Unless im missing something.
I was working on a targetting system, my only solution was to make generic images for each unit type. (Enemyunit, Allyunit, item, structure, weapon, upgrade... etc.)
I just tried messing a bit with the catalog, but the damn thing won't work! At all!
I tried specifically the examples given in the post linked here and they only trigger errors. "ErrorCatalogFieldNotWritten".
I hope it is possible BasicGear, 'cause I don't want to link every unit portrait that I use for this, ugh!
If anyone knows how to, could you post the way to change a unit's portrait with triggers? Like change the Zealot portrait to the player currently selected unit portrait (like if a Marine was selected, it would change the portrait to Marine) only using triggers, so that the switch can occur during the game.
Would be something on the lines of:
Trigger - Change Zealot Portrait to (Selected Unit) Portrait
Ahhhhh, that would be a dream trigger to have now =/
its very easy, i kinda repeat myself here since few threads but make custom database.
basic 2 values struct/record
Unitx[].UnitType (UnitType)
Unitx[].Portrait (game link - model)
At init you do like (for each unit you use)
Unitx[1].UnitType = marine
Unitx[1].Portrait = marine portrait
Unitx[2].UnitType = zergling
Unitx[2].Portrait = zergling portrait
Note or save in var total amount of such entry's, lets say you have 10.
Now on call you do. For each n from 1 to 10: if selected unit type = unitx[n].UnitType, then: set/create portrait with model Unitx[n].Portrait (create because i heard its better to destroy and create again new portrait.
Man oh man... this is a good day. Im not complaining but where the hell were you guys for the past 7 months...
Yes this is exactly what I needed. The static image is what I was looking for, something resizable and movable. Creating a function is the only way I guess. I still cant believe I didnt come to this conclusion at any point.
Tolkfans solution is the best one possible at the moment.
However, it only works if the main actor of the unit has the same name (or better: id) than the unit itself, whats not always the case, specially when creating custom units.
Sadly there seems to be no possibility to get the main actor of a unit as game link, since you cant convert an actor to a game link at all and the main actor of a unit isnt saved in any data field of the unit itself, its just linked to it.
We would need smth like "Actor type of actor" (same as "Unit type of unit) to be able to create a perfect working portrait function.
You could create 1 instance of the unit, get its main actor and make an actor to game link function (I am pretty sure it is possible, at least in galaxy script). Still, would be pretty stupid, if it needs to be done this way.
Using the convention of actor id = unit id makes sense, though, thats exactly what I do.
You could create 1 instance of the unit, get its main actor and make an actor to game link function (I am pretty sure it is possible, at least in galaxy script). Still, would be pretty stupid, if it needs to be done this way.
Using the convention of actor id = unit id makes sense, though, thats exactly what I do.
Nope, you cant convert an actor to a game link since it represents a specific actor (not an actor type) and blizzard doesnt privide any function to get the actor type of an actor like for units.
Actually the editor is missing a ActorToString function.
Basically what I want to do is this:
I select a unit in-game.
A trigger determines which unit is it and what it's portrait is and then proceeds to display the said portrait.
I am currently making a map in which the IU is hidden, so to display the portrait I need to use the "Create Portrait".
The way I am currently doing it really bugs me, setting the portrait inside a "if/else", meaning I would need to do one for each unit type I use. It's like this:
If ((Unit Type of (A)) = Zergling Then Set "A-Portrait" = Portrait - Zergling Else If ((Unit Type of (A)) = Roach Then Set "A-Portrait" = Portrait - Roach Else . . . (and so on...)
Is it possible to do something like this:
Portrait - Set the model of ql_DialogQuest Accept/Decline.PortraidId as (Get Portrait Model(aUnit) (Don't wait))
NOTE: This line above is not actually a trigger, it's just stating what I want to do, but can't.
Any help is appreciated!
You can use catalog triggers to get the portrait of a specific actor and there should be functions to get the actor for a unit as well.
Apparently I can get the portrait and change it, but not refer to it with the "Create Portrait" trigger.
All the options I get there is either a single strange function that I don't understand or linking directly to the model file (which is what I am doing).
Do I have to make a whole new function for this?
Sorry to tell you this but Ive researched this a lot more than I should have. Months of asking and waiting and researching.
The answer I have found is, no, you cannot dynamically call on unit portraits or models.
Now if there is a way, I havent found it, so there still could be hope. My last attempt was through using the catalogs but what I found was, you cannot call a catalog without specifying the unit with text, meaning player entry. So since this is the case, having the trigger dynamically enter the data for you based on your selection is impossible. Unless im missing something.
I was working on a targetting system, my only solution was to make generic images for each unit type. (Enemyunit, Allyunit, item, structure, weapon, upgrade... etc.)
So goodluck, if you find a solution please PM me.
I just tried messing a bit with the catalog, but the damn thing won't work! At all!
I tried specifically the examples given in the post linked here and they only trigger errors. "ErrorCatalogFieldNotWritten".
I hope it is possible BasicGear, 'cause I don't want to link every unit portrait that I use for this, ugh!
If anyone knows how to, could you post the way to change a unit's portrait with triggers? Like change the Zealot portrait to the player currently selected unit portrait (like if a Marine was selected, it would change the portrait to Marine) only using triggers, so that the switch can occur during the game.
Would be something on the lines of:
Trigger - Change Zealot Portrait to (Selected Unit) Portrait
Ahhhhh, that would be a dream trigger to have now =/
its very easy, i kinda repeat myself here since few threads but make custom database.
basic 2 values struct/record
Unitx[].UnitType (UnitType)
Unitx[].Portrait (game link - model)
At init you do like (for each unit you use)
Unitx[1].UnitType = marine
Unitx[1].Portrait = marine portrait
Unitx[2].UnitType = zergling
Unitx[2].Portrait = zergling portrait
Note or save in var total amount of such entry's, lets say you have 10.
Now on call you do. For each n from 1 to 10: if selected unit type = unitx[n].UnitType, then: set/create portrait with model Unitx[n].Portrait
(create because i heard its better to destroy and create again new portrait.
Is this what you were looking for?
Man oh man... this is a good day. Im not complaining but where the hell were you guys for the past 7 months...
Yes this is exactly what I needed. The static image is what I was looking for, something resizable and movable. Creating a function is the only way I guess. I still cant believe I didnt come to this conclusion at any point.
Thanks a ton Tolkfan, you sir, are the man!!
Tolkfans solution is the best one possible at the moment.
However, it only works if the main actor of the unit has the same name (or better: id) than the unit itself, whats not always the case, specially when creating custom units.
Sadly there seems to be no possibility to get the main actor of a unit as game link, since you cant convert an actor to a game link at all and the main actor of a unit isnt saved in any data field of the unit itself, its just linked to it.
We would need smth like "Actor type of actor" (same as "Unit type of unit) to be able to create a perfect working portrait function.
You could create 1 instance of the unit, get its main actor and make an actor to game link function (I am pretty sure it is possible, at least in galaxy script). Still, would be pretty stupid, if it needs to be done this way.
Using the convention of actor id = unit id makes sense, though, thats exactly what I do.
Nope, you cant convert an actor to a game link since it represents a specific actor (not an actor type) and blizzard doesnt privide any function to get the actor type of an actor like for units.
Actually the editor is missing a ActorToString function.
Tolkfan I feel the need to say that I love you right now man.
That was exactly what I needed! Thank you very much!
Oh, and this method did work for my custom units, so YAY!