Help on client side scripting - Tool for herbalism

Place for sharing your game modifications for Life is Feudal: Your Own

Kmat
 
Posts: 7
Joined: 10 Aug 2015, 17:42

Help on client side scripting - Tool for herbalism

Post by Kmat » 10 Aug 2015, 17:55

Hi!

I have been trying to make a client side script, but unfortunatly I am having some problems. I was thinking to make a script to make herbalism easier. Making a GUI windows that showed all herb and the effects that the player has discovered. But rigth now I am struggeling with finding the objects to use. Found some resources and started a Mod page in the wiki (http://lifeisfeudal.gamepedia.com/Mod_development).

How do I access the player object, and the player's inventoy? Think I found the player class by using the function listAllServers(). It listed a number associated with a player, but a bit inconvenient not to get the player id directly from a function.

I was also wondering if someone knows how to get access to the properties of the herbs? I think they should be accessable through the CmMixingManager or CmHerbalManager, but I do not know how to access these classes.

Hope anyone can help :)
Last edited by Kmat on 11 Aug 2015, 10:41, edited 1 time in total.


Kmat
 
Posts: 7
Joined: 10 Aug 2015, 17:42

Re: Help on client side scripting

Post by Kmat » 11 Aug 2015, 10:26

Ok, I found out some more. Apparently there is a tree of objects, where RootGroup is the root of the tree. RootGroup.listObjects lists all the objects attached to the RootGroup. I found the player from there, but not really any interesting methods there.

I did however find the inventory GUI. If I use the method PlayGui.listObjects I find the GuiInventoryContainer, and manage to do some things with the inventory GUI. Like move items around, change image of items and get the amount of each item. However my changes are not saved when I close the inventory. If I move an item manually the games saves the positions, but I did not find the command to do this from the console.

It would however be more iteresting to get access to the inventory item classes directly, without having to go through the GUI window. I tried to look inside the client and server exe files and the .dso files of the server for any clientCmd and serverCmd that could have something to do with the inventory, but no luck.

Anyone having any tips?

User avatar
Custodian
Mod Developer
 
Posts: 655
Joined: 08 Jun 2015, 14:58
Location: Lisbon

Re: Help on client side scripting

Post by Custodian » 11 Aug 2015, 11:40

Kmat wrote:Ok, I found out some more.

All your findings are described at links, that you have posted to the wiki. Read official torquescript manual about objects life-time and hierarchy.

Kmat wrote:However my changes are not saved when I close the inventory.

Because you change visual appearence of the objects. It does not reflect changes back.
Also, LiF is a server-based game. Altering client does not affect server, or everybody would just cheat.

Kmat wrote:If I move an item manually the games saves the positions, but I did not find the command to do this from the console.

If c++ <-> ts binding was not created, it is not possible. Not all parts parts of the game accessible from ts, only tiny amount of it.

Kmat wrote:that could have something to do with the inventory, but no luck.
Anyone having any tips?

This part of game is not accessible from ts.


Kmat
 
Posts: 7
Joined: 10 Aug 2015, 17:42

Re: Help on client side scripting - Tool for herbalism

Post by Kmat » 12 Aug 2015, 07:19

Thanks for the input, it helped a lot. I am new to Torque scripting, so was a bit of a learning curve to come over.

As a lot of the functions I was planning to use are not a part of the script, I guess it would be hard to make the script I intended to make.

Return to Game mods