New User Stats

General Chat, Comments
Post Reply
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

New User Stats

Post 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?
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: New User Stats

Post 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.
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: New User Stats

Post 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.
Creator of Dot World Maker
Mad programmer and annoying composer
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

Re: New User Stats

Post 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.
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: New User Stats

Post 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.
Creator of Dot World Maker
Mad programmer and annoying composer
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

Re: New User Stats

Post by KaL »

Super easy!

I just copy "Level" stats and change the name around and add a new "id" number to it. it works! :D

thanks Alain!
Post Reply

Return to “General”