Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google Log In with Steam Sign In
  • Create Account
Photo

LUA get XP value

- - - - -

  • Please log in to reply
6 replies to this topic

#1
OFFLINE   NoHero

NoHero

    Newbie

  • Members
  • Pip
  • 5 posts
5
A step in the right direction

I was originally asked to modify a autolevel lua script seen the same script in slight different forms around the internet. Thing is both in the original scrip and my modified one i get the same problem:

return et.gentity_get(pID, "ps.persistant", 0)

 

returns 0 when the players XP is not 0.

 

Is ps.persistant the right fieldname for XP? I bypassed this section of code and everything else in my script works last nail to be done before implementing it.



#2
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

Here is our documentation of Lua http://mygamingtalk....Lua#gentity_get. If following it doesn't result correct output, there is a bug. The index 0 is indeed correct index for the score within the ps.persistant.

 

Please provide a full test case script that is able to reproduce the issue as a bug report. Include only what is relevant to the issue.



#3
OFFLINE   Zelly

Zelly

    Regular Member

  • Coders
  • PipPipPip
  • 141 posts
73
Getting Better

If I remember correctly xp will show as 0 until at least one xp is gained in the round/map. (Bugged the hell out of me when testing) This was a long time ago though when I was testing on etpub, so I am unsure if this is still the case in silent mod.



#4
OFFLINE   NoHero

NoHero

    Newbie

  • Members
  • Pip
  • 5 posts
5
A step in the right direction

If I remember correctly xp will show as 0 until at least one xp is gained in the round/map. (Bugged the hell out of me when testing) This was a long time ago though when I was testing on etpub, so I am unsure if this is still the case in silent mod.

Thanks, that was messing me up everything was working i just didn't realise ^^


Edited by NoHero, 09 March 2014 - 11:28 AM.


#5
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

Additionally, the "ps.persistant" is probably not a good way to get the score. The better way to get the XP should be to calculate "sess.skillpoints" array values together. This way it won't be necessary to check if the player is in a team, dead or if he is speccing and the returned result will be correct. The ps (playerstate) values depend a lot on what the player is doing.



#6
OFFLINE   NoHero

NoHero

    Newbie

  • Members
  • Pip
  • 5 posts
5
A step in the right direction

Additionally, the "ps.persistant" is probably not a good way to get the score. The better way to get the XP should be to calculate "sess.skill" array values together. This way it won't be necessary to check if the player is in a team, dead or if he is speccing and the returned result will be correct. The ps (playerstate) values depend a lot on what the player is doing.

Thanks for the tip, i will definitely use it since my next project will need to get XP again.



#7
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

I needed to correct my post a bit, I wrote "sess.skill", but the correct array is "sess.skillpoints". The "sess.skill" is the stars level of the player in each of the areas.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users