View Full Version : Help creating a ruleset
JesusDH
June 17th, 2022, 14:07
Hi,
I'm creating my own custom ruleset. I need to create a link from a script outside of the window that contains the said link (so I cannot access its windowreferencefield to use its getValue function). I tried to create a databasenode of type windowreference, which contained the subnodes class and recordname with the correct strings. The values are updated (even if the link doesn't work) until the campaign is saved, where the subnodes are deleted. Obviously must be another way of doing it, but I don't know how. Can anybody help me?
Thanks.
Trenloe
June 17th, 2022, 14:12
Moved to the Workshop forum - this is the best place to get help regarding ruleset coding.
I'm not sure exactly what you're trying to do and where your code is running. Can you provide more details please?
JesusDH
June 17th, 2022, 15:42
I'm trying to do a random item generator. In my ruleset, the item record has a window list with bounded spells (consisting on a CoreRPG linkfield to the spell record and a stringlabel with the name). The script that creates the item requires to tell the linkfield where to find the bound spell. I tried to do it updating the databasenode of the linkfield instead of using the linkfield itself, as when the item is generated, the item window is not open. I did it this way:
local nodeListNew = nodeItem.createChild("powers");
local nodeNewSpell = nodeListNew.createChild();
local nodeLink = nodeNewSpell.createChild("link", "windowreference");
DB.setValue(nodeLink, "class", "string", "power");
DB.setValue(nodeLink, "recordname", "string", sPath);
This creates the nodeLink node and its childs class and recordname with their values (checked via Debug.chat) but the linkfield still doesn't work. Also, as soon as the campaign is saved, the child nodes are deleted (I suppose because only nodes without type can have child nodes according to documentation). I imagine there must be a correct way of implementing this, but I don't know which is it.
Trenloe
June 17th, 2022, 16:04
Thanks for the extra info, that helps a lot.
This is something that I struggled with at first too. The database won't work correctly when trying to set the child data of the link node with individual setValue commands - which is what you're seeing, it's not saving in the database.
The way to do it is set the class and recordname values in one setValue. Try: nodeLink.setValue("power", sPath)
JesusDH
June 17th, 2022, 17:48
Thanks a lot, it did it.
Maybe SmiteWorks should include it in the documentation, would be very useful.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.