Alright so here is what i'm stuck on. I would like a little experience bar down at the bottom of the screen and when you gain experience it updates and increases depending on the amount of experience you've gained. I'm totally stuck on this one.
To make the bar, you'll need to make a dialog and do all the visuals yourself using images and labels and whatever you want. Then monitor a hero's veterancy stats and update your xp bar however you wish.
I have done the First Part. But I'm having trouble doing the second part, i dont understand what you mean by monitor a heroes veterancy stats how can i do that?
There's a Unit Gains Experience event. I was looking through actions, but I couldn't figure out how to determine the current xp / xp needed to level / current level. But if you use that event, then check which unit, that's a start.
Sorry I can't be more help on my way to bed have work tomorrow but I can try to look into it more later if nobody else has a more complete answer for you before then. :)
You need to create a behavior of type veterancy and put it on the unit. You can specify different levels and experience requirements for those levels, as well as stat changes to occur at each of those levels.
i disagree with veteran behavior for a thread asking for triggers.
ITS COMPLETELY POSSIBLE WITHOUT VETERNCY AND BEHAVIORS.
basically you have a trigger for kills that linked to another trigger when the player accumulates enough exp. this would require a global int or real variable. you can modify damage via triggers but its not an exactly happy process. you would create a attack trigger that would override damage made by units when a unit attacks. You will also need remove some way of showing the unit's true damage. Attributes for damage is strongly recommended for damage since it would be easier than the work around.
HYBRID:
you can use attributes instead of veterncy, attributes behaviors are easy to apply and easy to use. you would manage leveling up via triggers like before but instead of changing the unit's stats you would simply add attributes.
I believe he said he has the leveling part working using veterancy. He's trying to create an experience bar to show on the screen.
Obviously this would require a dialog with some items to represent the current/needed xp, the bar, whatever else the OP wants as per his visual requirements. But I believe the remaining question is how to determine the current/needed xp and the level number.
I found an example of this online but it was really bad using variables to track xp on a unit that was using veterency and the unit's xp bar and the custom one didn't match. Working on fixing it but only have a few minutes.
In the meantime, xp is apparently a real. So if you create a real variable then assign it to the experience level of triggering unit, that's your unit's level. Assign it to total experience of triggering unit, that's their current xp. Haven't figured out how to get how much xp is needed for their level yet.
For custom exp bar you will need to screw the data completely, as SoulTaker said, cuz there is no function to easily track % of xp needed to proceed on the next level.
For custom exp bar you will need to screw the data completely, as SoulTaker said, cuz there is no function to easily track % of xp needed to proceed on the next level.
Who needs it to be easy? It's certainly possible.
I've attached a working example of a custom xp bar using dialog items which tracks based on veterancy. Note: I didn't make the original map, this was grabbed from another forum post. I forget who did it. I just redid how the xp calculations are done so that it uses veterancy rather than a custom trigger-based xp system.
It's actually not too complex. I used a lot of variables to help anyone looking at it to follow along, but it can certainly be simplified and streamlined. This is just for demonstration purposes.
The thick of it is thus:
On Gain XP
Events
Unit - Any Unit gains experience
Local Variables
player = 0 <Integer>
xp = 0.0 <Real>
prev_xp = 0.0 <Real>
needed_xp = 0.0 <Real>
xp_into_level = 0.0 <Real>
xp_for_level = 0.0 <Real>
remaining_xp = 0.0 <Real>
percent = 1.0 <Real>
level = 0 <Integer>
Conditions
Actions
Variable - Set player = (Owner of (Triggering unit))
Variable - Set level = (Experience level of (Triggering unit))
Variable - Set xp = (Total experience of (Triggering unit))
Variable - Set prev_xp = 0.0
Variable - Set needed_xp = 0.0
General - Pick each integer from 0 to level, and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) < MAX_LEVEL
Then
Variable - Set needed_xp = (needed_xp + (Real((Value of Behaviors GainExperience VeterancyLevelArray[(Picked integer)].MinVeterancyXP for player player as an integer))))
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) == (level - 1)
Then
Variable - Set prev_xp = needed_xp
Else
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
prev_xp < needed_xp
Then
Variable - Set xp_into_level = (xp - prev_xp)
Variable - Set xp_for_level = (needed_xp - prev_xp)
Variable - Set percent = (xp_into_level / xp_for_level)
Else
General - Custom Script: UIDisplayMessage(PlayerGroupAll(), c_messageA...
General - If (Conditions) then do (Actions) else do (Actions)
If
percent == 0.0
Then
Dialog - Hide Experience Bar for (Player group(player))
Else
Dialog - Set Experience Bar size to ((Integer((XP_BAR_WIDTH * percent))), 50) for (Player group(player))
Dialog - Show Experience Bar for (Player group(player))
Dialog - Set Experience Bar tooltip to (Text(((String(xp) with 0 decimal places) + ("/" + (String(needed_xp) with 0 decimal places))))) for (Player group(player))
Alright so here is what i'm stuck on. I would like a little experience bar down at the bottom of the screen and when you gain experience it updates and increases depending on the amount of experience you've gained. I'm totally stuck on this one.
@ZionSC2: Go
I haven't done it myself but I believe that's typically done through veterancy. https://www.google.com/search?q=sc2+editor+how+to+level+heroes&oq=sc2+editor+how+to+level+heroes&aqs=chrome..69i57j0l2j69i64l2.11829j0j7&sourceid=chrome&espv=210&es_sm=122&ie=UTF-8#es_sm=122&espv=210&q=sc2+editor+how+to+level+heroes+veterancy
To make the bar, you'll need to make a dialog and do all the visuals yourself using images and labels and whatever you want. Then monitor a hero's veterancy stats and update your xp bar however you wish.
@Nurdguy: Go
I have done the First Part. But I'm having trouble doing the second part, i dont understand what you mean by monitor a heroes veterancy stats how can i do that?
@ZionSC2: Go
There's a Unit Gains Experience event. I was looking through actions, but I couldn't figure out how to determine the current xp / xp needed to level / current level. But if you use that event, then check which unit, that's a start.
Sorry I can't be more help on my way to bed have work tomorrow but I can try to look into it more later if nobody else has a more complete answer for you before then. :)
@ZionSC2: Go
You need to create a behavior of type veterancy and put it on the unit. You can specify different levels and experience requirements for those levels, as well as stat changes to occur at each of those levels.
i disagree with veteran behavior for a thread asking for triggers.
ITS COMPLETELY POSSIBLE WITHOUT VETERNCY AND BEHAVIORS. basically you have a trigger for kills that linked to another trigger when the player accumulates enough exp. this would require a global int or real variable. you can modify damage via triggers but its not an exactly happy process. you would create a attack trigger that would override damage made by units when a unit attacks. You will also need remove some way of showing the unit's true damage. Attributes for damage is strongly recommended for damage since it would be easier than the work around.
HYBRID: you can use attributes instead of veterncy, attributes behaviors are easy to apply and easy to use. you would manage leveling up via triggers like before but instead of changing the unit's stats you would simply add attributes.
@SoulTaker916: Go
Of course it's possible... Just kinda dumb. I don't think that's really what the guy meant anyways.
I believe he said he has the leveling part working using veterancy. He's trying to create an experience bar to show on the screen.
Obviously this would require a dialog with some items to represent the current/needed xp, the bar, whatever else the OP wants as per his visual requirements. But I believe the remaining question is how to determine the current/needed xp and the level number.
I found an example of this online but it was really bad using variables to track xp on a unit that was using veterency and the unit's xp bar and the custom one didn't match. Working on fixing it but only have a few minutes.
In the meantime, xp is apparently a real. So if you create a real variable then assign it to the experience level of triggering unit, that's your unit's level. Assign it to total experience of triggering unit, that's their current xp. Haven't figured out how to get how much xp is needed for their level yet.
@MasterWrath: Go
yes but he asked for trigger based leveling. triggers allow for exp from quests and odd sources.
For custom exp bar you will need to screw the data completely, as SoulTaker said, cuz there is no function to easily track % of xp needed to proceed on the next level.
Who needs it to be easy? It's certainly possible.
I've attached a working example of a custom xp bar using dialog items which tracks based on veterancy. Note: I didn't make the original map, this was grabbed from another forum post. I forget who did it. I just redid how the xp calculations are done so that it uses veterancy rather than a custom trigger-based xp system.
It's actually not too complex. I used a lot of variables to help anyone looking at it to follow along, but it can certainly be simplified and streamlined. This is just for demonstration purposes.
The thick of it is thus: