View Full Version : NPC attacks all in a row or they don't work

January 4th, 2016, 10:43
I'm new to FG and LUA is new to me but I am a C# coder and while I have seen a number of threads on this subject I seem to be missing something?

I have GCA and export an NPC using the correct xport to FG II txt as .xml and then use /importnpc within FG (I have also created an NPC in FG just to make sure) but for whatever reason I have issues with the Attacks. I spent a while messing with it and was able to fix it by removing all the carriage returns and just left everything one after another. It's pretty ugly trying to click an attack however since it's one giant string.

This is what I have done and it basically works but I would prefer to have each attack on it's own line:
Bite (12):[bite 1d-2 cr; C]Kick (10):[kick 1d-1 cr; C,1]Club (12):[swing 1d+2 cr; 1]Club (12):[thrust 1d cr; 1]Punch (12):[punch 1d-2 cr; C]

I've tried to use , and ; but no dice. I'm pretty sure I have the correct GURPS ruleset loaded and I did check the npcattackfield.lua at line 101 which is:
starts, ends, all, skill, meth, dam = string.find(str, "\r?(([%u%w+%s]*%u%w+%s[%w%w+]*[%(%w+%)]*%(%d%d?%):%s*)\r*(%[%w%w+)%s(%d[%d+d]*[%-%+%d%d+]*%s[%w%w+;]*)[%s%w;]*[,%w%d;]*%])", nextindex);

(The red is just marking what was mentioned in another thread on this subject a year ago or so and I'm guessing that's the latest on this.)

If I have everything as good as it gets right now please let me know because otherwise I'm going to keep chewing at this issue.

Thanks in advance and sorry if I missed an explanation somewhere. I have gone through a lot of threads looking.

January 4th, 2016, 12:25
saithan is I think the current GURPs maintainer. his last post on that suggests that the /r? allows you to enter each weapon/attack on a separate line. have you tried that?

January 4th, 2016, 16:16
Yeah, that's what I don't understand, even using the /importnpc it doesn't want to work. I did try putting an attack on it's own line (which is what I want) but then everything fails except the first one. I'm fairly certain it's the \cr that's the issue but how else can you split the attacks to their own line unless you hit the return key?

Knowing me the issue is right in front of my face. Hmmm...

January 4th, 2016, 17:56
Discussed here: https://www.fantasygrounds.com/forums/showthread.php?25266-Sooo-attack-formatting-in-the-present-GURPS-ruleset Start at post #6...

January 4th, 2016, 22:38
If you want more then one attack you separate with either ',' or ';' no space. So it would be
Brawling (13):[punch 1d-2 cr;C],Brawling (13):[bite 1d-2 cr;C],Brawling (11):[kick 1d-1 cr;C],SmallKnife (12):[swing 1d-3 cut;C],SmallKnife (12):[thrust 1d-3 imp;C]

I'll give it a shot tonight when I'm home in a few hours. The only difference is the , he put between each one. I'm thinking I tried this because I had in fact read that very thread but I'll be back.

In case I hadn't mentioned it, thanks for the responses.

January 4th, 2016, 23:25
This thread (http://www.fantasygrounds.com/forums/showthread.php?20587-Problem-with-NPC-attacks)also has some fixes/diagnoses in it

January 5th, 2016, 03:45
@Gigermann that's the one I was quoting from at the start but thanks.

This is so strange, half the time these work and then on another they don't. I tried to type them exactly the same. I wound up just cutting and pasting what worked on one to the others and modified that to reflect the correct skill values. Something is not right but I'll have to play around with it more before I can be more definitive.

January 7th, 2016, 02:32
I have not seen this problem as I usually just place corsur at the point I want to separate and hit enter no"," or ";"
some times they will not work till you separate them all.

I just tested your line from the first post worked fine.

another thing to remember that highlighting will not happen if the field has focus!

January 11th, 2016, 05:17
Hmm, ok, well here's a screenshot of one of my NPC races and when I attempt to drag anything other than the first item it pops up that Console message as shown. I hope someone can see where I'm going off the rails.

And sorry for not being super prompt at the moment, I'm in a software roll out at work and cranking on an art commission for a map at the same time. Unfortunately, FG is on my back burner right now....yay, me!

The chat window shows a swing knife but that was when I had things separated by a , and while I can live with it I'd prefer everything on it's own line since it's visually easier to look at.

So, to reiterate, you see the highlighted item, as soon as I start to drag it, BANG! console window.

I show a second screen with side by side NPCs as well because in the 2nd screen the one on the right works fine like that. The one on the left has issues, although, if I separate the lines by adding back the , (comma) it's all good.

January 11th, 2016, 05:40
Where did you get your ruleset from? Looking at my GURPS ruleset (downloaded from the link here: http://www.fantasygrounds.com/wiki/index.php/Ruleset:_GURPS Line 255 in the npcattackfield.lua script is a blank line and wouldn't raise that error. So it looks like it is a different ruleset to this one. Or are you running any extensions? Or have you modified the ruleset?

And those attacks you have listed work fine for me using the ruleset linked above.

January 11th, 2016, 22:50
you can skype me and I will try and help you figure it out.
another trusted location to download the ruleset is

January 12th, 2016, 06:11
I just want to offer a Big Time thank you to saithan for taking the time to get me straight on this.

Turns out my ruleset had an issue, either I grabbed the wrong version somehow or in my poking around botched it enough to cause problems.

Anyway, it looks like I'm in the saddle now and on my way to glorious..uh..never mind that's another speech.

Thank you all for your help and especially saithan for burning the candle to get me on my feet.