Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with two questions?

Asked by 10 years ago

Okay, I have two questions. Here is the first. So, this one is pretty simple, how would I loop this function forever?

function LevelUp()
    if Player.Exp.Value >= 100 then
        Player.PlayerLevel.Value = 2
    elseif Player.Exp.Value >= 300 then
        Player.PlayerLeve.Valuel = 3
    elseif Player.Exp.Value >= 600 then
        Player.PlayerLeve.Valuel = 4
    elseif Player.Exp.Value >= 1000 then
        Player.PlayerLevel.Value = 5
    elseif Player.Exp.Value >= 1500 then
        Player.PlayerLevel.Value = 6
    elseif Player.Exp.Value >= 2000 then
        Player.PlayerLevel.Value = 7
    elseif Player.Exp.Value >= 2500 then
        Player.PlayerLevel.Value = 8
    elseif Player.Exp.Value >= 3000 then
        Player.PlayerLevel.Value = 9
    elseif Player.Exp.Value >= 4000 then
        Player.PlayerLevel.Value = 10
    elseif Player.Exp.Value >= 5000 then
        Player.PlayerLevel.Value = 11
    elseif Player.Exp.Value >= 6500 then
        Player.PlayerLevel.Value = 12
    elseif Player.Exp.Value >= 8000 then
        Player.PlayerLevel.Value = 13
    elseif Player.Exp.Value >= 9500 then
        Player.PlayerLevel.Value = 14
    elseif Player.Exp.Value >= 11000 then
        Player.PlayerLevel.Value = 15
    elseif Player.Exp.Value >= 12500 then
        Player.PlayerLevel.Value = 16
    elseif Player.Exp.Value >= 14000 then
        Player.PlayerLevel.Value = 17
    elseif Player.Exp.Value >= 15500 then
        Player.PlayerLevel.Value = 18
    elseif Player.Exp.Value >= 18000 then
        Player.PlayerLevel.Value = 19
    elseif Player.Exp.Value >= 21000 then
        Player.PlayerLevel.Value = 20
    elseif Player.Exp.Value >= 25000 then
        Player.PlayerLevel.Value = 21
    elseif Player.Exp.Value >= 30000 then
        Player.PlayerLevel.Value = 22
    elseif Player.Exp.Value >= 35000 then
        Player.PlayerLevel.Value = 23
    elseif Player.Exp.Value >= 40000 then
        Player.PlayerLevel.Value = 24
    elseif Player.Exp.Value >= 45000 then
        Player.PlayerLevel.Value = 25
    elseif Player.Exp.Value >= 50000 then
        Player.PlayerLevel.Value = 26
    elseif Player.Exp.Value >= 57500 then
        Player.PlayerLevel.Value = 27
    elseif Player.Exp.Value >= 65000 then
        Player.PlayerLevel.Value = 28
    elseif Player.Exp.Value >= 72500 then
        Player.PlayerLevel.Value = 29
    elseif Player.Exp.Value >= 82500 then
        Player.PlayerLevel.Value = 30
    elseif Player.Exp.Value >= 100000 then
        Player.PlayerLevel.Value = 31
    else
    print("An error has occured with the LevelUp Function.")
    end
end

Basically, I want it to constantly check the Player's Exp to see if it is enough to level up.

=========================== And my second question relates to the above script, but in a different way. How would I award Exp to a player based on damage done to NPCs or Players? I want about 10 Exp awarded per 100 Damage done, but I have no idea how to do that. (The damage will be dealt with swords and bows/crossbows.)

Thanks!

Answer this question