HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hero Experiance Gain

08-29-2004, 05:24 PM#1
Progniss
Ok i have it set so that when a hero is choosen that hero is set to a unit array player one being Heros [1], player two being Heros [2]...ect along with this the heros xp gain is disabled. What i want to happen is at the end of every round the hero is auto level'd instead of gaining xp. So I made this trigger.

Code:
Hero LvLing
    Events
        Unit - A unit owned by Player 11 (Dark Green) Dies
    Conditions
        (Number of living Unit_Types[Level] units owned by Player 11 (Dark Green)) Equal to 0
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Level Less than or equal to 10
            Then - Actions
                Hero - Set Heros[1] Hero-level to ((Hero level of Heros[1]) + 1), Show level-up graphics
                Hero - Set Heros[2] Hero-level to ((Hero level of Heros[2]) + 1), Show level-up graphics
                Hero - Set Heros[3] Hero-level to ((Hero level of Heros[3]) + 1), Show level-up graphics
                Hero - Set Heros[4] Hero-level to ((Hero level of Heros[4]) + 1), Show level-up graphics
                Hero - Set Heros[5] Hero-level to ((Hero level of Heros[5]) + 1), Show level-up graphics
                Hero - Set Heros[6] Hero-level to ((Hero level of Heros[6]) + 1), Show level-up graphics
                Hero - Set Heros[7] Hero-level to ((Hero level of Heros[7]) + 1), Show level-up graphics
                Hero - Set Heros[8] Hero-level to ((Hero level of Heros[8]) + 1), Show level-up graphics
                Hero - Set Heros[9] Hero-level to ((Hero level of Heros[9]) + 1), Show level-up graphics
                Hero - Set Heros[10] Hero-level to ((Hero level of Heros[10]) + 1), Show level-up graphics
                Game - Display to (All players) the text: Hero Experiance: Ea...
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Level Greater than 10
            Then - Actions
                Hero - Enable experience gain for Heros[1]
                Hero - Enable experience gain for Heros[2]
                Hero - Enable experience gain for Heros[3]
                Hero - Enable experience gain for Heros[4]
                Hero - Enable experience gain for Heros[5]
                Hero - Enable experience gain for Heros[6]
                Hero - Enable experience gain for Heros[7]
                Hero - Enable experience gain for Heros[8]
                Hero - Enable experience gain for Heros[9]
                Hero - Enable experience gain for Heros[10]
                Sound - Play Hint <gen>
                Game - Display to (All players) the text: Hero Experiance Gai...
                Trigger - Turn off (This trigger)
            Else - Actions
                Do nothing

Also at the end of level 10 this trigger would also give the hero back its ability to gain xp, and also removes the auto-leveling after each level. My problem is, is that this doesnt work... and Im not sure why... Help would be really appriciated on my end thanks.
08-29-2004, 09:13 PM#2
Anitarf
How exactly does it not work. Does the trigger run, are conditions met? You can check this by having the game display text messages at various points in your trigger, so you see how far the trigger gets and where the problem might be.

Oh, and there is a very good reason why we use arrays, and not a seperate variable for each unit:
Code:
            For each Integer A from 1 to 10 do actions
              Loop - actions:
                Hero - Set Heros[(Integer A)] Hero-level to ((Hero level of Heros[(Integer A)]) + 1), Show level-up graphics
08-29-2004, 09:57 PM#3
Progniss
Ya, I do that text thing thats why I asked because the text fired but the heros didnt gain levels. Thanks for the Integer help I didnt know what that was for until now. Im testing it now, again thanks a lot.
08-29-2004, 10:04 PM#4
Progniss
Ok the sound and text fire, but the heros do not level up... this is what I changed the trigger to (because of you telling me how intergers work haha).

Code:
Hero LvLing
    Events
        Unit - A unit owned by Player 11 (Dark Green) Dies
    Conditions
        (Number of living Unit_Types[Level] units owned by Player 11 (Dark Green)) Equal to 0
        Level Less than or equal to 10
    Actions
        Sound - Play Hint <gen>
        Game - Display to (All players) the text: Hero Experiance: Ea...
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                Hero - Set Heros[(Integer A)] Hero-level to ((Hero level of Heros[(Integer A)]) + 1), Show level-up graphics

Just incase why the heros don't level here's the trigger that sets them to the variable.

Code:
Heros
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Choose Hero 
    Actions
        If ((Owner of (Casting unit)) Equal to Player 1 (Red)) then do (Set Heros[1] = (Target unit of ability being cast)) else do (Do nothing)
        If ((Owner of (Casting unit)) Equal to Player 2 (Blue)) then do (Set Heros[2] = (Target unit of ability being cast)) else do (Do nothing)
        If ((Owner of (Casting unit)) Equal to Player 3 (Teal)) then do (Set Heros[3] = (Target unit of ability being cast)) else do (Do nothing)
        If ((Owner of (Casting unit)) Equal to Player 4 (Purple)) then do (Set Heros[4] = (Target unit of ability being cast)) else do (Do nothing)
        If ((Owner of (Casting unit)) Equal to Player 5 (Yellow)) then do (Set Heros[5] = (Target unit of ability being cast)) else do (Do nothing)
        If ((Owner of (Casting unit)) Equal to Player 6 (Orange)) then do (Set Heros[6] = (Target unit of ability being cast)) else do (Do nothing)
        If ((Owner of (Casting unit)) Equal to Player 7 (Green)) then do (Set Heros[7] = (Target unit of ability being cast)) else do (Do nothing)
        If ((Owner of (Casting unit)) Equal to Player 8 (Pink)) then do (Set Heros[8] = (Target unit of ability being cast)) else do (Do nothing)
        If ((Owner of (Casting unit)) Equal to Player 9 (Gray)) then do (Set Heros[9] = (Target unit of ability being cast)) else do (Do nothing)
        If ((Owner of (Casting unit)) Equal to Player 10 (Light Blue)) then do (Set Heros[10] = (Target unit of ability being cast)) else do (Do nothing)
        Hero - Disable experience gain for (Target unit of ability being cast)
        Unit - Move (Target unit of ability being cast) instantly to (Center of Middle <gen>)
        Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Change color
        Camera - Pan camera for (Owner of (Casting unit)) to (Center of Middle <gen>) over 2.00 seconds
        Unit - Kill (Casting unit)

The hero's become the owner of the casting unit. The Casting unit dies, the camera pans, and the heros expierance gain is haulted... so I know most of this trigger works (and it works for all players, I tested it with multiple people).

Thanks for the help again.
08-30-2004, 05:52 PM#5
Progniss
I was thinking about it and I didnt define my array to a value, and I thought that might be my problem. So I set it to 10... and it still doesnt work. Any ideas?
08-30-2004, 06:17 PM#6
Anitarf
Ok, this is just a guess, but try this:

Code:
       For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                Hero - Enable experience gain for Heros[(Integer A)]
                Hero - Set Heros[(Integer A)] Hero-level to ((Hero level of Heros[(Integer A)]) + 1), Show level-up graphics
                Hero - Disable experience gain for Heros[(Integer A)]

And, your other trigger can be optimized like the first one, just instead of all if-then-elses put in this: ;)
Code:
Set Heros[(player number of (owner of(casting unit)))] = (Target unit of ability being cast)
08-30-2004, 07:19 PM#7
Progniss
Wow thanks a lot it works. I would give you a better rep again for helping me once more, but it wont let me.