Thread: Help creating a ruleset
-
June 17th, 2022, 14:07 #1
- Join Date
- Aug 2017
- Posts
- 5
Help creating a ruleset
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.
-
June 17th, 2022, 14:12 #2
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?Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
June 17th, 2022, 15:42 #3
- Join Date
- Aug 2017
- Posts
- 5
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:
Code: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);
-
June 17th, 2022, 16:04 #4
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)Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
June 17th, 2022, 17:48 #5
- Join Date
- Aug 2017
- Posts
- 5
Thanks a lot, it did it.
Maybe SmiteWorks should include it in the documentation, would be very useful.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks