I'm having a problem getting passed an issue with my hero based map. The heroes are able to enter/exit vehicles via the bunker ability that's applied to the vehicle units. The problem is that when the hero is inside the vehicle, he no longer gains experience. I need to find a way for the hero to gain experience for whatever the "vehicle" units kills. Any suggestions would be greatly appreciated!! (:
I don't really know a good way to do this, but here's what I know. You can add experience to a unit manually by making Modify Unit effects that add experience. You would make a bunch of these effects with different amounts and make a function that applies them so they give the unit the exact exp you want to give them. There is a tutorial on hero exp in the tutorials forum that has a function for this.
The second problem is figuring out how much xp to give the hero everytime the vehicle kills something. I don't know if theres a way to get the "Kill Experience" field from a unit's data with triggers. Otherwise you could do it all manually through triggers, but that's no fun. I can think of a couple of elaborate ways to do it with the data editor but they are probably really bad.
Not really sure if it will work but since you said that the the vehicle kill unit instead of hero, he wont gain any exp. Create a veterancy behavior that share EXP (shared radius set to max and fraction to 1) and put it on your vehicle.
Edit: Or you can use trigger to apply that behavior only when hero entered bunker and remove it when he was out
I found out how to get the kill experience a unit is supposed to give. You make a trigger for Unit dies event. You put a condition for if the hero is inside the vehicle and a condition to see if the Killing Unit is the vehicle. To get how much experience to give to the hero, you put a temporary string variable and set it to Catalog Field Value Get. The Catalog is the Preset: Unit, the entry is the game link to the Triggering Unit, the field is KillXP. You just pass that string as convert string to real to your hero xp function.
I found out how to get the kill experience a unit is supposed to give. You make a trigger for Unit dies event. You put a condition for if the hero is inside the vehicle and a condition to see if the Killing Unit is the vehicle. To get how much experience to give to the hero, you put a temporary string variable and set it to Catalog Field Value Get. The Catalog is the Preset: Unit, the entry is the game link to the Triggering Unit, the field is KillXP. You just pass that string as convert string to real to your hero xp function.
Hmm, i'm not using a function for hero exp, im using the veterancy behavior. Is there still a way to pass the converted string?
EDIT: So I've got the trigger set up to the point where I have gotten the value from the unit, but I don't know how to pass it to the heroes exp. Not sure if I can pass it to him using veterancy or not, I also dont see an action that converts string to real, only real to string.
You have to make an experience function. The function applys effects to the hero, the effects being Modify Unit effects that give certain amounts of xp. IE:
function parameters: Unit, XP (to give to it)
while XP >= 1000:
apply effect xp1000
xp = xp - 1000
while XP >= 100:
apply effect xp100
xp = xp - 100
while XP >= 10:
apply effect xp10
xp = xp - 10
while XP >= 1:
apply effect xp1
xp = xp - 1
this is not the most efficient way to do it (a bitmask would be better) but it works
So I am actually sticking with the veterancy behavior. Like programmer said, by applying a share exp behavior to the vehicle i am able to now gain exp while inside. Thanks to both of you for all the help!! The SC2mapster community rocks!
Just so you know, the experience function thing isn't separate from veterancy behavior. It is the only way to add xp through triggers is what I was saying. It is used with the veterancy behavior.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm having a problem getting passed an issue with my hero based map. The heroes are able to enter/exit vehicles via the bunker ability that's applied to the vehicle units. The problem is that when the hero is inside the vehicle, he no longer gains experience. I need to find a way for the hero to gain experience for whatever the "vehicle" units kills. Any suggestions would be greatly appreciated!! (:
I don't really know a good way to do this, but here's what I know. You can add experience to a unit manually by making Modify Unit effects that add experience. You would make a bunch of these effects with different amounts and make a function that applies them so they give the unit the exact exp you want to give them. There is a tutorial on hero exp in the tutorials forum that has a function for this.
The second problem is figuring out how much xp to give the hero everytime the vehicle kills something. I don't know if theres a way to get the "Kill Experience" field from a unit's data with triggers. Otherwise you could do it all manually through triggers, but that's no fun. I can think of a couple of elaborate ways to do it with the data editor but they are probably really bad.
@Southpaw444: Go
Not really sure if it will work but since you said that the the vehicle kill unit instead of hero, he wont gain any exp. Create a veterancy behavior that share EXP (shared radius set to max and fraction to 1) and put it on your vehicle.
Edit: Or you can use trigger to apply that behavior only when hero entered bunker and remove it when he was out
I found out how to get the kill experience a unit is supposed to give. You make a trigger for Unit dies event. You put a condition for if the hero is inside the vehicle and a condition to see if the Killing Unit is the vehicle. To get how much experience to give to the hero, you put a temporary string variable and set it to Catalog Field Value Get. The Catalog is the Preset: Unit, the entry is the game link to the Triggering Unit, the field is KillXP. You just pass that string as convert string to real to your hero xp function.
Hmm, i'm not using a function for hero exp, im using the veterancy behavior. Is there still a way to pass the converted string?
EDIT: So I've got the trigger set up to the point where I have gotten the value from the unit, but I don't know how to pass it to the heroes exp. Not sure if I can pass it to him using veterancy or not, I also dont see an action that converts string to real, only real to string.
@Southpaw444:
You have to make an experience function. The function applys effects to the hero, the effects being Modify Unit effects that give certain amounts of xp. IE:
function parameters: Unit, XP (to give to it)
while XP >= 1000:
apply effect xp1000
xp = xp - 1000
while XP >= 100:
apply effect xp100
xp = xp - 100
while XP >= 10:
apply effect xp10
xp = xp - 10
while XP >= 1:
apply effect xp1
xp = xp - 1
this is not the most efficient way to do it (a bitmask would be better) but it works
edit: forgot the subractions
So I am actually sticking with the veterancy behavior. Like programmer said, by applying a share exp behavior to the vehicle i am able to now gain exp while inside. Thanks to both of you for all the help!! The SC2mapster community rocks!
Just so you know, the experience function thing isn't separate from veterancy behavior. It is the only way to add xp through triggers is what I was saying. It is used with the veterancy behavior.