HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Mining XP/Leveling System

07-19-2004, 11:19 PM#1
Scyze
Thanks to Anitarf for making the level-up trigger which I partially modified to fit my needs.

This is meant to be used with an item ability--you can mess around with the mathmatics to change how much XP you want given or even the formula itself. Please give me credit however if you DO use it.

Mining Level:

Code:
Mining Level Up
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        MiningXP[(Integer A)] Greater than or equal to ((MiningLevel[(Integer A)] x 200) + 200)
                    Then - Actions
                        Set MiningLevel[(Integer A)] = (MiningLevel[(Integer A)] + 1)
                        Game - Display to (Player group((Player((Integer A))))) the text: (Your mining level is now  + ((String(MiningLevel[(Integer A)])) + .))
                    Else - Actions
                        Do nothing

Code:
Mining
    Events
        Unit - A unit Begins casting an ability
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Destructible-type of (Target destructible of ability being cast)) Equal to Unidentified Ore (Tin)
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        MiningLevel[(Player number of (Owner of (Casting unit)))] Greater than or equal to 0
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                            Then - Actions
                                Unit - Pause (Casting unit)
                                Animation - Play (Casting unit)'s stand work animation
                                Sound - Play MiningSuccess <gen> at 100.00% volume, located at (Position of (Casting unit)) with Z offset 0.00
                                Wait 2.52 seconds
                                Animation - Reset (Casting unit)'s animation
                                Hero - Create Tin Ore and give it to (Casting unit)
                                Set MiningXP[(Player number of (Owner of (Casting unit)))] = (MiningXP[(Player number of (Owner of (Casting unit)))] + (200 / MiningXP[(Player number of (Owner of (Casting unit)))]))
                                Game - Display to (Player group((Owner of (Casting unit)))) the text: (You have mined some tin ore. XP Gained:  + ((String((200 / MiningLevel[(Player number of (Owner of (Casting unit)))]))) + .))
                                Unit - Unpause (Casting unit)
                                Sound - Stop MiningSuccess <gen> After fading
                            Else - Actions
                                Game - Display to (Player group((Owner of (Casting unit)))) the text: If your seeing this...
                    Else - Actions
                        Game - Display to (Player group((Owner of (Casting unit)))) the text: If your seeing this...
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Destructible-type of (Target destructible of ability being cast)) Equal to Unidentified Ore (Copper)
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                MiningLevel[(Player number of (Owner of (Casting unit)))] Greater than or equal to 0
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                    Then - Actions
                                        Unit - Pause (Casting unit)
                                        Animation - Play (Casting unit)'s stand work animation
                                        Sound - Play MiningSuccess <gen> at 100.00% volume, located at (Position of (Casting unit)) with Z offset 0.00
                                        Wait 2.52 seconds
                                        Animation - Reset (Casting unit)'s animation
                                        Hero - Create Copper Ore and give it to (Casting unit)
                                        Set MiningXP[(Player number of (Owner of (Casting unit)))] = (MiningXP[(Player number of (Owner of (Casting unit)))] + (200 / MiningXP[(Player number of (Owner of (Casting unit)))]))
                                        Game - Display to (Player group((Owner of (Casting unit)))) the text: (You have mined some copper ore. XP Gained:  + ((String((200 / MiningLevel[(Player number of (Owner of (Casting unit)))]))) + .))
                                        Unit - Unpause (Casting unit)
                                        Sound - Stop MiningSuccess <gen> After fading
                                    Else - Actions
                                        Game - Display to (Player group((Owner of (Casting unit)))) the text: If your seeing this...
                            Else - Actions
                                Game - Display to (Player group((Owner of (Casting unit)))) the text: If your seeing this...
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Destructible-type of (Target destructible of ability being cast)) Equal to Unidentified Ore (Gold)
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        MiningLevel[(Player number of (Owner of (Casting unit)))] Greater than or equal to 20
                                    Then - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                            Then - Actions
                                                Unit - Pause (Casting unit)
                                                Animation - Play (Casting unit)'s stand work animation
                                                Sound - Play MiningSuccess <gen> at 100.00% volume, located at (Position of (Casting unit)) with Z offset 0.00
                                                Wait 5.04 seconds
                                                Animation - Reset (Casting unit)'s animation
                                                Hero - Create Gold Ore and give it to (Casting unit)
                                                Set MiningXP[(Player number of (Owner of (Casting unit)))] = (MiningXP[(Player number of (Owner of (Casting unit)))] + (2000 / MiningXP[(Player number of (Owner of (Casting unit)))]))
                                                Game - Display to (Player group((Owner of (Casting unit)))) the text: (You have mined some gold ore. XP Gained:  + ((String((2000 / MiningLevel[(Player number of (Owner of (Casting unit)))]))) + .))
                                                Unit - Unpause (Casting unit)
                                                Sound - Stop MiningSuccess <gen> After fading
                                            Else - Actions
                                                Game - Display to (Player group((Owner of (Casting unit)))) the text: If your seeing this...
                                    Else - Actions
                                        Game - Display to (Player group((Owner of (Casting unit)))) the text: You need to be leve...
                            Else - Actions
                                Do nothing
07-21-2004, 07:32 AM#2
logik
can you plz implement this into a map for dl?
07-21-2004, 07:51 AM#3
sc_freek
Quote:
Originally Posted by Scyze
Code:
Mining Level Up
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        MiningXP[(Integer A)] Greater than or equal to ((MiningLevel[(Integer A)] x 200) + 200)
                    Then - Actions
                        Set MiningLevel[(Integer A)] = (MiningLevel[(Integer A)] + 1)
                        Game - Display to (Player group((Player((Integer A))))) the text: (Your mining level is now  + ((String(MiningLevel[(Integer A)])) + .))
                    Else - Actions
                        Do nothing

couldn't you do this instead?
Code:
    Events
        Time - Every 0.10 seconds of game time
    Conditions
        MiningXP[(Integer A)] Greater than or equal to ((MiningLevel[(Integer A)] x 200) + 200)
    Actions
        Set MiningLevel[(Integer A)] = (MiningLevel[(Integer A)] + 1)
        Game - Display to (Player group((Player((Integer A))))) the text: (Your mining level is now  + ((String(MiningLevel[(Integer A)])) + .))

Seems a little easier to me
07-22-2004, 02:13 AM#4
Scyze
Quote:
Originally Posted by sc_freek
couldn't you do this instead?
Code:
    Events
        Time - Every 0.10 seconds of game time
    Conditions
        MiningXP[(Integer A)] Greater than or equal to ((MiningLevel[(Integer A)] x 200) + 200)
    Actions
        Set MiningLevel[(Integer A)] = (MiningLevel[(Integer A)] + 1)
        Game - Display to (Player group((Player((Integer A))))) the text: (Your mining level is now  + ((String(MiningLevel[(Integer A)])) + .))

Seems a little easier to me

My map I'm using it in uses Multiplayer, but you could do that without any arrays whatsoever. The Integer A is used for looping it 10 times--you do the math.

And sure, I'll upload the map that I'm using it in (Barely-Semi-Pre-Alpha o_O). Known bug with the mining system, however: The variable (for me) MiningXP seems to tweak out sometimes and I have to recreate it. And thats just about it. Also, in the map I'm uploading, it has a mini-ranged/melee weapon system. Feel free to use it if you give me a small amount of credit.