Jump to content

[LE] problem with function


Recommended Posts

Hi people,

 

i want make script that when i read selected book i got exp. But i cant make it work, i can do onlny "SetPlayerExperience" but i want add experience not set.

 

Scriptname dostanieekspa extends objectreference

Event onread()
ble()
endevent

function ble()
Game.SetPlayerExperience(Exp)
endfunction


Int Property exp Auto

 

I hope someone will help me :)

Link to comment
Share on other sites

There's no problem with that function, it's just that it doesn't invoke the level up screen and further more it doesn't invoke the level progress screen either. With that being said, it will appear that it is not working. You'd have to form your own notification system around this function. If you want to have the player gain whole levels by reading a book, here's how I'd go about it:

 

 

Function SetNewPlayerLevel()

Int level = Game.GetPlayer().GetLevel()

; How far the player is into the current level.
Float currentEXPForLevel = Game.GetPlayerExperience()

; Get the experience required to level up to the next level from
; the current amount of exp gained from the current level.
Float expForNextLevel = (Game.GetExperienceForLevel(level + 1) - currentEXPForLevel) + currentEXPForLevel + 1

; Level up player
Game.SetPlayerExperience(expForNextLevel)
EndFunction

 

To reiterate the thing about it "seemingly not working" - this will trigger a "silent" level up. The player wont know they gained a level, until they go to the menu with skills, magic, items (skills will be replaced with LEVEL UP).

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...