I'm getting acquainted with banks and can save/load units no problem. but i want to save and load heroes that have spent skill points Warcraft 3 style. I find that the "save unit" bank doesn't really do this accurately or completely as I'm sure it wasn't designed with this sort of unit in mind.
What's a way to make the bank remember skill point expenditure for individual units?
What's a way to make the bank remember skill point expenditure for individual units?
Save every value you want to be saved individually and upon loading the hero, set all the desired stats manually. To set skill levels learned via learn ability correctly, I think you need to issue a learn order.
You can use the UnitAbilityGetLevel function to get the levels of your skills, save those levels to the bank. On restoring the hero, you set its level and issue orders to learn the same amount of skills you saved.
Note, that the function returns Abilitylevel -1, so it will return 0, if you learned the ability one level, and it will also return 0, if you didn't learn it at all. You will need to check, if the unit has the ability at all, using the UnitAbilityCheck function.
It is a native galaxy function returning the level of an ability as an integer. In the Gui, you will find it translated in your local language in the function list. Make sure, to select an integer field (since it returns an integer, it will only visible, if you select an integer field) and search for it in the list.
In the english editor, the non-raw function name is Current level for unit ability, call it like this:
I think I got it saved fine but I'm having trouble recalling the information. Earlier you mentioned,
"On restoring the hero, you set its level and issue orders to learn the same amount of skills you saved."
I'm not sure how to set up the issue order command to reference what I have banked as integers. I was hoping there would be something like a "restore integer" like there is with "restore unit" action, but there's not. Oh and thank you tremendously by the way :)
After extensive testing I found out what's going wrong... when I restore my hero unit, if I have spent any skill points at all, it spends 1 skill point in particular skill. This action is done right when the unit is created and is done independently of any banked skills (ie, restored integers) that I try to restore. I'm pretty stumped as to how to get around this as it seems that this one skill point being learned is coded pretty hard into the restoring of the unit...
I'm getting acquainted with banks and can save/load units no problem. but i want to save and load heroes that have spent skill points Warcraft 3 style. I find that the "save unit" bank doesn't really do this accurately or completely as I'm sure it wasn't designed with this sort of unit in mind.
What's a way to make the bank remember skill point expenditure for individual units?
<Click Here> To See My Epic Single Player Campaign (LifeForceCampaign.com)
Save every value you want to be saved individually and upon loading the hero, set all the desired stats manually. To set skill levels learned via learn ability correctly, I think you need to issue a learn order.
@Kueken531:
Thanks for the response. How do i go about saving skill point expenditure into the bank? I can't find a trigger action that looks right.
<Click Here> To See My Epic Single Player Campaign (LifeForceCampaign.com)
You can use the UnitAbilityGetLevel function to get the levels of your skills, save those levels to the bank. On restoring the hero, you set its level and issue orders to learn the same amount of skills you saved.
Note, that the function returns Abilitylevel -1, so it will return 0, if you learned the ability one level, and it will also return 0, if you didn't learn it at all. You will need to check, if the unit has the ability at all, using the UnitAbilityCheck function.
@Kueken531:
So what exactly is "UnitAbilityGetLevel" and how do I find it?
<Click Here> To See My Epic Single Player Campaign (LifeForceCampaign.com)
It is a native galaxy function returning the level of an ability as an integer. In the Gui, you will find it translated in your local language in the function list. Make sure, to select an integer field (since it returns an integer, it will only visible, if you select an integer field) and search for it in the list.
In the english editor, the non-raw function name is Current level for unit ability, call it like this:
You can also enable the Raw Data view by pressing Ctrl + D and search for UnitAbilityGetLevel directly, this works for all language versions.
@Kueken531:
I think I got it saved fine but I'm having trouble recalling the information. Earlier you mentioned,
"On restoring the hero, you set its level and issue orders to learn the same amount of skills you saved."
I'm not sure how to set up the issue order command to reference what I have banked as integers. I was hoping there would be something like a "restore integer" like there is with "restore unit" action, but there's not. Oh and thank you tremendously by the way :)
<Click Here> To See My Epic Single Player Campaign (LifeForceCampaign.com)
Try something like this:
@Bilxor: Go Read this: http://www.sc2mapster.com/forums/resources/tutorials/28875-trigger-bank-facts/#p1
@Kueken531:
After extensive testing I found out what's going wrong... when I restore my hero unit, if I have spent any skill points at all, it spends 1 skill point in particular skill. This action is done right when the unit is created and is done independently of any banked skills (ie, restored integers) that I try to restore. I'm pretty stumped as to how to get around this as it seems that this one skill point being learned is coded pretty hard into the restoring of the unit...
<Click Here> To See My Epic Single Player Campaign (LifeForceCampaign.com)