I am trying to take XP points from a player without having to reset and add his Xp.
The point is avoiding: player.xp.Reset(). And take Xp just like when you learn an item.
Is that possible?
Solved Take XP points without reset and add?
Discussion in 'Rust Development' started by Reynostrum, Jul 18, 2016.
-
Wulf Community Admin
player.xp.SetValue(long id, float total) should work.
-
player.xp.SetValue(player.userID, 20)
I am a little confused. ID should be players id?Code:cannot convert `ulong' expression to type `long'
-
Wulf Community Admin
It should be, you could try casting to long before sending it. -
I've converted the players ID to Int64, and there is no NRE, but it does not do anything. Maybe Rust developers did'nt finish that function.
-
Wulf Community Admin
Pretty sure it is already used, just not sure what the long is. -
The SetValue method is actually no longer used anywhere and looks somewhat incomplete, you can however create your own method doing what SetValue is supposed to do by using reflection.
If you want to actually just take away experience without using Reset and Add as you said you could use `SpendXp(int xpCount, string Category)` to do so. Not sure if category can be anything or has to be something specific but checking that shouldn't be too hard
-
Solved. Thank you.
