Simple question that may have a more complex answer.
Does anyone know of a good way to make a dialog based buff bar? Preferably displaying behavior buffs.
Does not need countdown, but it would require it to re-organize the buffs when 1 expires etc.
I read somewhere that you can do this with indexes and similar, but my head just starts spinning when i try to figure it out. Think i am getting old :P
Any assistance would be appreciated, and please make an example trigger/code if you are able as it is easier for me to understand :o
- Make sure you show the dialog
- You might need to adjust the positioning of the dialog items a bit, I just guessed on those
- To get the buff icon/tooltip I used the Catalog Field Value Get function. If you aren't familiar with this, I suggest you run a search on these forums to become better-acquainted
- Adjust My_Dialog_Item_Array[] and the related Pick Each Integer functions to be whatever size you need... which would likely be the number of unique buffs which can be applied to your unit
- This doesn't take into account buffs which can stack since it only checks if a unit has a certain type of behavior
- You can change the event which fires this "dialog refresh" trigger to whatever you want. I just picked a periodic 5 seconds out of the blue since it was the easiest thing I could think of >.>
If you want to go more advanced you can also directly use special native functions to build a universal, always working buff bar which doesnt require entering all possible buffs manually.
There are functions which return the current behavior count on a unit, aswell as function which allow to read a behavior at a specified index. You can also use catalogs to read information, like icon, name, alignment, flags, ..
Depending on how advanced you want this to be it will require some scripting experience though.
If you want to go more advanced you can also directly use special native functions to build a universal, always working buff bar which doesnt require entering all possible buffs manually.
There are functions which return the current behavior count on a unit, aswell as function which allow to read a behavior at a specified index. You can also use catalogs to read information, like icon, name, alignment, flags, ..
Depending on how advanced you want this to be it will require some scripting experience though.
Indeed. The Galaxy editor is fairly flexible with this sort of thing, though it's easy to get in over your head with complicated stuff :)
If you want to get fancy and show the behavior stack count you can use dialog labels instead of icons and use an image tag within the label text, concatenated with the stack count and any other information you want to convey.
Hi, I see a few people have already helped but I think it would be beneficial to give you a breakdown in a format I like of how this system could work.
It will require several components. This would be a lot easier if we were to use custom definitions, however I'm not aware if you're familiar with those.
1. Creating and Displaying the Behaviors
You'll need these variables:
A constant variable, not arrayed. We'll call it "Number of Behaviors".
A non-arrayed variable, type Dialog. We'll call it "Behavior Dialog".
An arrayed variable, size [Number of Behaviors], type Dialog Item, we'll call it "Behavior Image".
This is where we create the dialog base for the behavior bar.
Create a new trigger, event map initialization, we'll call it "Create Behavior Dialog".
Create the action "create dialog" for this trigger. Leave the standard settings.
Finish setting up the dialog (size, location, showing it, hiding background, etc.)
Create the action "Set Variable". Set the variable "Behavior Dialog" and set it to the last created dialog. This serves no purpose directly for this as we won't need to be able to retrieve the dialog, however it's a nice habit to get into, saving dialogs.
Now we have our dialog to contain our many dialog items. Time to create those dialog items. We'll need this additional local variable:
Non-arrayed variable, type integer. We'll call it "Behavior Icon Size". Set it to 60 by default.
Note: This is all still in the same trigger so far.
Create the loop action "Pick Each Integer". Have it pick the integers from 1 to [Number of Behaviors].
Create the action "Create Dialog Item (Image)" for our dialog. Set the image to "white.dds" or whatever, it doesn't matter. Set both the X and Y size to our variable "Behavior Icon Size". Make sure it's of normal type and not tiled, standard stuff.
Position gets a little more tricky. Decide where you want it anchored and set that.
Assuming you want the bar horizontal, give it a straight value for the Y offset. For the X offset, use the Arithmetic (Integer) function and multiply the two values Picked Integer and "Behavior Icon Size".
Create the Set Variable action (this is in the loop, too), and set the variable Behavior Icon [Picked Integer] to last created dialog item.
We've got our dialog set up for the behavior bar.
2. Updating the Behavior Dialog to Display Current Behaviors.
Now we have to make it so that our bar reflects the buffs on a unit. I'm assuming this is going to be multiplayer.
An arrayed variable, dimensions 1, size 14 (max amount of players), type unit. We'll call this "Behavior Unit".
Create a new trigger. We'll call this "Update Behavior Dialog". Event, Periodic Event every 1 Second.
Create the action Pick Each Player in Player Group. Set the player group to Active Players.
In this loop, create the action Pick Each Integer. Set it to pick each integer from 1 to "Number of Behaviors".
In this newer loop, create the action If Then Else. Under if, put the condition: "Picked Integer <= Number of Behaviors on Unit "Behavior Unit" [Picked Player].
Under Then, create the action Show/Hide Dialog Item. Show the Dialog item "Behavior Icon" [Picked Integer] for player Picked Player.
Still under Then, create the two actions to set image and tooltip. Due to complexity/time constraints, just copy these from the attached map or from the screen shots. They're just catalog functions to retrieve information from the game data.
Under Else, create the action Show/Hide Dialog Item. Hide the dialog item "Behavior Icon" [Picked Integer] for player Picked Player.
This covers updating the dialog we made in step one.
3. Testing the Behavior Bar
We'll need to test what we just made.
Create a new trigger. We'll call it "Testing". Event, Map Initialization.
Place a unit, any unit, on the map via the terrain module.
Set variable Behavior Unit [1] to the unit just created.
Create the action add behavior to unit. Set the behavior to any behavior (some may not work if they rid themselves automatically). Caster unit/player is not important.
Repeat the last created action several times for testing.
Feel free to PM me or post to ask further questions about these directions.
Note: I uploaded the map. I never do that when giving a mini-tutorial about something and I'm only doing it now since this can get confusing and because you'll need the two catalog actions from it. My request is that you don't simply copy/paste the map and actually do it yourself (not because I care about it being stolen, but so that you learn the most, which was my intent when writing this.)
Wow, thanks alot for the suggestions and your time! :)
I have not tried any of them yet, but will do that ASAP.
My scripting skills are lacking, so I think that would be a rather big bucket over my head to go too advanced.
The buff bar does not have to be that advanced. The main purpose of it is to indicate to the player what buffs are active, as they are of great importance in combat.
If you have played the FF13 series then you should have and indication of what I am aiming for - roughly the same in regards to buff display.
@Charysmatic: You realy went through that thoroughly, many thanks for taking your time. And don't worry, I will create it myself. I agree with not learning if you just CnP.
Once again, thanks for the assistance and will update if i get it to work. And sorry for any bad grammar!
I got Charysmatic's option to work with a few modifications to suit my requirements but have run into one issue.
I have a few behaviors that are permanent and hidden, so these behaviors should not be displayed.
I have gotten them to remain hidden but the problem is that they still take up space in the dialog.
So when a unit recieves a buff, the location of the icon will be a few rows to the right, and not in the first row.
To illustrate:
[o] [o] [o] [o] [o] [o] [x]
Two buffs:
[o] [o] [o] [o] [o] [o] [x] [x]
So the "o" are hidden dialog items (the permantent hidden behaviors in this case), the player cannot see them. The "x" is the applied buff, player can see it and read the tooltip.
What i want it to be like is:
[x] [o] [o] [o] [o] [o] [o]
And when another buff is applied:
[x] [x] [o] [o] [o] [o] [o]
And so on.
Any tips on how to solve this?
EDIT:
Solved the issue, solution below if anyone is interested:
Charysmatic's suggestion is very similar to mine with one important difference: His hides/shows the dialog items, whereas mine creates/destroys them.
The reason this is important is because mine will automatically remove unused buff icons from the bar because of the way it's set up. However, in Charysmatic's option, you could use triggers to move hidden dialog items to an erroneous position, keeping shown dialog items within the dialog box.
To do this, create a local dialog item variable in the "Update Behavior Dialog" trigger and call it "temp_dialog_item." This will help with positioning.
The next part is easier to explain with a trigger:
UpdateBehaviorDialogEventsTimer-Every1.0secondsofGameTimeLocalVariablestemp_dialog_item=NoDialogItem<DialogItem>ConditionsActionsPlayerGroup-Pickeachplayerin(ActivePlayers)anddo(Actions)ActionsVariable-Settemp_dialog_item=NoDialogItemGeneral-Pickeachintegerfrom1toNumberofBehaviors,anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(NumberofbehaviorsonBehaviorUnit[(Pickedplayer)]))>=(Pickedinteger)ThenDialog-ShowBehaviorIcon[(Pickedinteger)]for(Playergroup((Pickedplayer)))------- Set icon etc. etc....------- Set tooltip etc. etc....General-If(Conditions)thendo(Actions)elsedo(Actions)Iftemp_dialog_item!=NoDialogItemThenDialog-MoveBehaviorIcon[(Pickedinteger)]to(5,0)relativetoRightoftemp_dialog_itemfor(Playergroup((Pickedplayer)))(fromLeft)ElseDialog-MoveBehaviorIcon[(Pickedinteger)]to(50,50)relativetoLeftofdialogfor(Playergroup((Pickedinteger)))Variable-Settemp_dialog_item=BehaviorIcon[(Pickedinteger)]ElseDialog-HideBehaviorIcon[(Pickedinteger)]for(Playergroup((Pickedplayer)))Dialog-MoveBehaviorIcon[(Pickedinteger)]to(9999,9999)relativetoLeftofdialogfor(Playergroup((Pickedinteger)))
This cycles through each behavior on the unit by index (which should be how Charysmatic's thing works) and, if the behavior is on the unit, slap it to the left side of the dialog, otherwise fling it off into low orbit.
Hello!
Simple question that may have a more complex answer.
Does anyone know of a good way to make a dialog based buff bar? Preferably displaying behavior buffs.
Does not need countdown, but it would require it to re-organize the buffs when 1 expires etc.
I read somewhere that you can do this with indexes and similar, but my head just starts spinning when i try to figure it out. Think i am getting old :P
Any assistance would be appreciated, and please make an example trigger/code if you are able as it is easier for me to understand :o
This should get you started:
A couple of notes:
- Make sure you show the dialog
- You might need to adjust the positioning of the dialog items a bit, I just guessed on those
- To get the buff icon/tooltip I used the Catalog Field Value Get function. If you aren't familiar with this, I suggest you run a search on these forums to become better-acquainted
- Adjust My_Dialog_Item_Array[] and the related Pick Each Integer functions to be whatever size you need... which would likely be the number of unique buffs which can be applied to your unit
- This doesn't take into account buffs which can stack since it only checks if a unit has a certain type of behavior
- You can change the event which fires this "dialog refresh" trigger to whatever you want. I just picked a periodic 5 seconds out of the blue since it was the easiest thing I could think of >.>
If you want to go more advanced you can also directly use special native functions to build a universal, always working buff bar which doesnt require entering all possible buffs manually.
There are functions which return the current behavior count on a unit, aswell as function which allow to read a behavior at a specified index. You can also use catalogs to read information, like icon, name, alignment, flags, ..
Depending on how advanced you want this to be it will require some scripting experience though.
Indeed. The Galaxy editor is fairly flexible with this sort of thing, though it's easy to get in over your head with complicated stuff :)
If you want to get fancy and show the behavior stack count you can use dialog labels instead of icons and use an image tag within the label text, concatenated with the stack count and any other information you want to convey.
@Matheusx: Go
Hi, I see a few people have already helped but I think it would be beneficial to give you a breakdown in a format I like of how this system could work.
It will require several components. This would be a lot easier if we were to use custom definitions, however I'm not aware if you're familiar with those.
1. Creating and Displaying the Behaviors
You'll need these variables:
This is where we create the dialog base for the behavior bar.
Now we have our dialog to contain our many dialog items. Time to create those dialog items. We'll need this additional local variable:
Note: This is all still in the same trigger so far.
We've got our dialog set up for the behavior bar.
2. Updating the Behavior Dialog to Display Current Behaviors.
Now we have to make it so that our bar reflects the buffs on a unit. I'm assuming this is going to be multiplayer.
This covers updating the dialog we made in step one.
3. Testing the Behavior Bar
We'll need to test what we just made.
Feel free to PM me or post to ask further questions about these directions.
Note: I uploaded the map. I never do that when giving a mini-tutorial about something and I'm only doing it now since this can get confusing and because you'll need the two catalog actions from it. My request is that you don't simply copy/paste the map and actually do it yourself (not because I care about it being stolen, but so that you learn the most, which was my intent when writing this.)
Wow, thanks alot for the suggestions and your time! :)
I have not tried any of them yet, but will do that ASAP.
My scripting skills are lacking, so I think that would be a rather big bucket over my head to go too advanced.
The buff bar does not have to be that advanced. The main purpose of it is to indicate to the player what buffs are active, as they are of great importance in combat.
If you have played the FF13 series then you should have and indication of what I am aiming for - roughly the same in regards to buff display.
@Charysmatic: You realy went through that thoroughly, many thanks for taking your time. And don't worry, I will create it myself. I agree with not learning if you just CnP.
Once again, thanks for the assistance and will update if i get it to work. And sorry for any bad grammar!
I got Charysmatic's option to work with a few modifications to suit my requirements but have run into one issue.
I have a few behaviors that are permanent and hidden, so these behaviors should not be displayed.
I have gotten them to remain hidden but the problem is that they still take up space in the dialog.
So when a unit recieves a buff, the location of the icon will be a few rows to the right, and not in the first row.
To illustrate: [o] [o] [o] [o] [o] [o] [x]
Two buffs:
[o] [o] [o] [o] [o] [o] [x] [x]
So the "o" are hidden dialog items (the permantent hidden behaviors in this case), the player cannot see them. The "x" is the applied buff, player can see it and read the tooltip.
What i want it to be like is:
[x] [o] [o] [o] [o] [o] [o]
And when another buff is applied:
[x] [x] [o] [o] [o] [o] [o]
And so on.
Any tips on how to solve this?
EDIT:
Solved the issue, solution below if anyone is interested:
Now buffs are always starting from "position 1" and when one expires the second newest takes its location.
@Matheusx: Go
Charysmatic's suggestion is very similar to mine with one important difference: His hides/shows the dialog items, whereas mine creates/destroys them.
The reason this is important is because mine will automatically remove unused buff icons from the bar because of the way it's set up. However, in Charysmatic's option, you could use triggers to move hidden dialog items to an erroneous position, keeping shown dialog items within the dialog box.
To do this, create a local dialog item variable in the "Update Behavior Dialog" trigger and call it "temp_dialog_item." This will help with positioning.
The next part is easier to explain with a trigger:
This cycles through each behavior on the unit by index (which should be how Charysmatic's thing works) and, if the behavior is on the unit, slap it to the left side of the dialog, otherwise fling it off into low orbit.
@Matheusx: Go
Clever fix, glad you got it working.
Yeah i guess removing them or "throwing them away" may perhaps be a better solution, but the current state i have it in works for the moment.
But i will keep this post bookmarked in case i have to change the system.
I removed below code as it serves no purpose.
Once again, thanks everyone for the assist! :)