Jump to content
Sign in to follow this  
saa0d

Lvl up npc

Recommended Posts

Hello guys,

I want to make a Lvl up NPC that would lvl you up. It works this way:

Say you have 1x Old Ticket. You go to the npc, checks your lvl, takes the old ticket and lvl u up to the next lvl. 

I tried using GetChaAttr to get the lvl - which I copied from functions.lua- but when I approach the npc, it stops functioning. I tried making a function similar to AddExp_1 but When I apply it, nothing happens. I tried modifying AddExp_1 its self but when I apply it, I don't get the modified effects. Anybody can help? Thanks

Share this post


Link to post
Share on other sites
2 часа назад, saa0d сказал:

Hello guys,

I want to make a Lvl up NPC that would lvl you up. It works this way:

Say you have 1x Old Ticket. You go to the npc, checks your lvl, takes the old ticket and lvl u up to the next lvl. 

I tried using GetChaAttr to get the lvl - which I copied from functions.lua- but when I approach the npc, it stops functioning. I tried making a function similar to AddExp_1 but When I apply it, nothing happens. I tried modifying AddExp_1 its self but when I apply it, I don't get the modified effects. Anybody can help? Thanks

mb, you can give an example that you are using?

 

In general it works

local lv_role = GetChaAttr ( role , ATTR_LV )
	local lv_next = lv_role + 1
	SetChaAttrI( role , ATTR_LV , lv_next )

 

Share this post


Link to post
Share on other sites
50 minutes ago, mangojkee said:

mb, you can give an example that you are using?

 

In general it works


local lv_role = GetChaAttr ( role , ATTR_LV )
	local lv_next = lv_role + 1
	SetChaAttrI( role , ATTR_LV , lv_next )

 

Yes, I have done that! Well tbh it works but not fully. What happens is that the lvl changes only after i relog or teleport! Plus when I do that, I don't get the lvl up visual effect! I tried using the AddExp method but turns out that the exp table is wrong for all lvls above 2! Usually, the method u stated is the logical one but as I said, I need to teleport to see change and I don't get the lvl up effect which I want. Help?! Thanks

Share this post


Link to post
Share on other sites
7 минут назад, saa0d сказал:

Yes, I have done that! Well tbh it works but not fully. What happens is that the lvl changes only after i relog or teleport! Plus when I do that, I don't get the lvl up visual effect! I tried using the AddExp method but turns out that the exp table is wrong for all lvls above 2! Usually, the method u stated is the logical one but as I said, I need to teleport to see change and I don't get the lvl up effect which I want. Help?! Thanks

Also, you can teleport cha after lvl_up with goto function))

Share this post


Link to post
Share on other sites
2 minutes ago, mangojkee said:

Also, you can teleport cha after lvl_up with goto function))

But I still won't get the lvl up effect..

Plus isn't goto function only ingame? or i can use it in lua?

Share this post


Link to post
Share on other sites
6 минут назад, saa0d сказал:

But I still won't get the lvl up effect..

Plus isn't goto function only ingame? or i can use it in lua?

GoTo( role,  pos_x, pos_y, map) - function

for example 

 local x, y = GetChaPos(role)
    local map_name = GetChaMapName (role)
    local x = math.floor (x/100)
    local y = math.floor (y/100)
	GoTo( role,  x, y, map)

 

Edited by mangojkee

Share this post


Link to post
Share on other sites
4 minutes ago, mangojkee said:

GoTo( role,  pos_x, pos_y, map) - function

Thanks it works, But still.. I want the Lvl Up effect, any idea how to make it work?! I noticed that it appears when I lvl up using AddExp but not SetChaAttr!

1.png

Share this post


Link to post
Share on other sites
6 минут назад, saa0d сказал:

Thanks it works, But still.. I want the Lvl Up effect, any idea how to make it work?! I noticed that it appears when I lvl up using AddExp but not SetChaAttr!

 

As far as I understand, the accumulated experience is stored in the database, and as you say: "exp table is wrong for all lvls above 2", most likely when the level is raised through SetChaAttrI - ATTR_LB - the level rises, but visually there is no effect due to the fact that where that is checking Ex. From exp tables

Mb if you fix exp tables -> lvl_up will work
Sorry for a Google translate

Edited by mangojkee

Share this post


Link to post
Share on other sites
4 minutes ago, mangojkee said:

As far as I understand, the accumulated experience is stored in the database, and as you say: "exp table is wrong for all lvls above 2", most likely when the level is raised through SetChaAttrI - ATTR_LB - the level rises, but visually there is no effect due to the fact that where that is checking Ex. From exp tables

Mb if you fix exp tables -> lvl_up will work
Sorry for a Google translate

Actually I tried changing the exp table using another clean server files, nothing has changed!

Share this post


Link to post
Share on other sites
12 minutes ago, mangojkee said:

Please describe the fix

He did something that he called npc binding where he registered something in npcsdk which i have no idea of. I can't get the codes now am not on my computer sorry.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...