Page 1 of 1
New User Stats
Posted: Fri Jan 10, 2014 7:45 pm
by hallsofvallhalla
So I notice one cant edit or see the user stats table from the admin panel. If I want to add new stats should I create a new table and make it a part of a module and just link the player id?
Re: New User Stats
Posted: Fri Jan 10, 2014 11:17 pm
by KyleMassacre
Yes you could create a new "module" and add that table in the config.xml to be browsable or you can use an existing config and add the table as browsable.
If you create a new module then its kind of a waste of space and just adds to clutter which in reality its not that bad but still :p
If you add it to saaaaaayy the root config file any update Alain does will most likely overwrite your change
And also there may be a reason why stats are hidden in the first place but or it could be that in order for the table editor to work there must be a column that's set to AI and if memory serves me I don't think that table has one. If so, my whole explanation above was pointless haha.
Re: New User Stats
Posted: Sat Jan 11, 2014 4:59 am
by a_bertrand
Stats are cached, so after adding a new entry in the "user_stat_types" you will have to log out and login to be able to see them. Also the reason why I didn't added the stats in the admin menu as editable table is that you can very easily screw up a game by doing bad changes.
Re: New User Stats
Posted: Thu Feb 27, 2014 5:43 pm
by KaL
I would like to add new stats to the game and use it with all the userstats function. So I can use the commands like this: $userStat['Cooklevel']->value+=1. So where do I go and what file. Yes! I want this new stat 'cooklevel' to be cached like all the rest. If Alain overwrite it that will be fine. I'll create a back up.
Re: New User Stats
Posted: Thu Feb 27, 2014 6:34 pm
by a_bertrand
Dead easy
http://www.nw-engine.com/wiki/index.php/UserStat
Basically the stats are defined in the DB directly. Check out the install/package.sql the first lines defines the default stats. Just add a new entry in your user_stat_types table and don't forget to log out / login and you should have your fresh new stat.
Re: New User Stats
Posted: Fri Feb 28, 2014 6:09 am
by KaL
Super easy!
I just copy "Level" stats and change the name around and add a new "id" number to it. it works!
thanks Alain!