Thread: Warhammer Fantasy RPG 4 ed
-
October 23rd, 2021, 15:27 #101
- Join Date
- Jun 2016
- Posts
- 141
Cool! Thanks!
-
October 24th, 2021, 10:15 #102
- Join Date
- Mar 2018
- Location
- Norway
- Posts
- 104
Thank you for the tip.
I dug a little bit more so I can explain the challenge a bit better.
I'm used to using onValueChanged() in my scripts. But I can't find a proper way to find the path to each "strength_bonus" to use with onValueChanged().
The trouble here is that the value of strength bonus is in each line of the list.
I think that the path (for my setup) would be
nodeWin.getChild("weaponlist").getChild("id-0000X").getChild("strength_bonus")();
Now, each line of the list has an id, which I need to go through.
I.E. I have three weapons in the list, that means I have to go through id-00001, id-00002 and id-00003 and find the "strength_bonus" in each and update that.
-
October 24th, 2021, 11:26 #103
You will need to use a
for loop
You will do something like
for k, v in pairs
You will need to post more code so we can try and suggest the right syntax to use
-
October 24th, 2021, 11:39 #104
- Join Date
- Mar 2018
- Location
- Norway
- Posts
- 104
Okey, I will try to post what I've found
Code:function sbonus() local nodeWin = window.getDatabaseNode(); local nS = nodeWin.getChild("totS").getValue(); local nSB = math.floor(nS/10) local test = nodeWin.getChild("weaponlist"); for _,v in pairs(test.getChildren()) do v.strength_bonus.setValue(nSB); end end
I think the path is nodeWin.weaponlist.id-0000X.strength_bonus.
where x = the listnumber in the weaponlist.
-
October 24th, 2021, 12:21 #105
I km not near my computer but first start with debug statements
Debug.chat(nodeWin)
Debug.chat(nS)
Debug.chat(test)
Debug.chat(v)
-
October 24th, 2021, 15:14 #106
Assuming test is valid then this should work:
Code:for k,v in pairs (test.getChildren()) v.getChild("strength_bonus").setValue(nSB)); end
-
October 25th, 2021, 09:34 #107
- Join Date
- Mar 2018
- Location
- Norway
- Posts
- 104
-
October 25th, 2021, 18:11 #108
- Join Date
- Mar 2018
- Location
- Norway
- Posts
- 104
Haha! That worked perfectly! Thank you very much damned!
One step closer
-
October 27th, 2021, 03:53 #109
Continued here:
https://www.fantasygrounds.com/forum...munity-Ruleset
-
December 7th, 2021, 01:58 #110
I ended up just buying Foundry.... They have an official ruleset that works well. I'd much rather play in FG but I don't think there is any interest in making an official ruleset.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks