Page 7 of 18

Re: Syntax highlighting

Posted: Sat Sep 15, 2018 2:36 pm
by TheLacus
Jay_H wrote: Fri Sep 07, 2018 7:52 pm Trying to use the "named" parameter when defining a quest NPC produces red underlines. Here's an example:

Code: Select all

Person _crow_ named The_Crow faction The_Crow male
Are you sure you can use named and faction at the same time? My understanding is that individual npcs are already their own factions, in fact you are using The_Crow for both. I believe faction value is just ignored here, but correct me if i'm wrong :)

Re: Syntax highlighting

Posted: Sat Sep 15, 2018 4:29 pm
by Hazelnut
Yes you can specify both, in fact in this case it has to otherwise the faction which is an individual doesn't match correctly because it should have a name. I was just reading how the Person class worked, so I am assuming it's implemented correctly.

FYI I advised Jay how to get this working here: https://forums.dfworkshop.net/viewtopic ... 049#p15049

Re: Syntax highlighting

Posted: Wed Sep 19, 2018 6:53 pm
by TheLacus
Hazelnut wrote: Sat Sep 15, 2018 4:29 pm Yes you can specify both, in fact in this case it has to otherwise the faction which is an individual doesn't match correctly because it should have a name. I was just reading how the Person class worked, so I am assuming it's implemented correctly.

FYI I advised Jay how to get this working here: https://forums.dfworkshop.net/viewtopic ... 049#p15049
Thank you for your answer Hazelnut, but i'm not able to put in practice what you said. In the link you posted, Jay_H changed Person _crow_ faction The_Crow to Person _crow_ named The_Crow faction The_Crow. From what i read in the Person definition interpreter, this means that factionData is set by SetupIndividualNPC() instead of SetupFactionAllianceNPC(); it looks like factionAlliance is simply not stored if a name is found. What am i missing?

Re: Syntax highlighting

Posted: Wed Sep 19, 2018 9:08 pm
by Hazelnut
Hmm, in that case we will have to wait for Interkarma to weigh in as this is his code and I don't really understand it.

When I advised Jay it was after diagnosing that the code in QuestResourceBehaviour.DoClick() where it tests if the faction is an individual and then in ClickAllIndividualNPCs(int factionID) it gets person resources from active quests, checking person.IsIndividualNPC which only returns true if the parsing caused Person.SetupIndividualNPC() to be called. This is only called when the person line contains a name. It does look like the faction is simply unneccessary so maybe my advice should have been to replace it to give:

Person _crow_ named The_Crow male

This may be incorrect logic but that's what's currently there, and my advice to Jay was simply from reading the code and thus could have been wrong. Was just trying to help and reduce Interkarma's workload.

Re: Syntax highlighting

Posted: Wed Sep 19, 2018 9:35 pm
by Interkarma
Individual NPCs are of type 4 in their faction data. They have unique sprites and appear in quests with the name defined in FACTION.TXT. Examples are "King Gothryd" and "Lady Brisienna". These NPCs are usually found automatically in their home location (e.g. Gothryd is in Daggerfall Castle) but can be moved or placed specifically for a quest (e.g. Lady Brisienna is placed to random tavern).

Faction Alliance NPCs are random NPCs generated at runtime. Their faction data defines themed male and female sprites to be shown when placed by a quest and they receive a random name. Most factions entries define flat data and could be used as a faction NPC. For example, it lets you place a member of the Thieves Guild somewhere as part of a TG quest and their sprite will look appropriately shady. Same concept for merchants, nobles, etc.

My understanding is that individual NPCs and faction NPCs are mutually exclusive. When setting up a Person resource, my code will prioritise individual NPCs over faction NPCs, you can't use both at once. In this case, the following should be all that's needed to use The Crow in a quest.

Code: Select all

Person _crow_ named The_Crow
I didn't look too deeply at Jay's original problem, I'm sorry. By the time I read the thread he seemed happy the problem was solved so I just moved on.

You're likely correct Hazelnut that something else is going on around the click itself. I'd need to look back at the original issue again. And thank you, your help is always appreciated. :)

Re: Syntax highlighting

Posted: Wed Sep 19, 2018 10:54 pm
by Hazelnut
Thanks for the explanation, I think that TheLacus is correct and these are mutually exclusive - my mistake.

Jay, can you change that person definition again and check it works?

Re: Syntax highlighting

Posted: Wed Sep 19, 2018 10:55 pm
by Interkarma
I just posted more information to that bug report. I think it was just the usage of "give pc _reward_". This action always opens a message box with QuestComplete text.

Re: Syntax highlighting

Posted: Wed Sep 19, 2018 11:01 pm
by Jay_H
Hazelnut wrote: Wed Sep 19, 2018 10:54 pm Jay, can you change that person definition again and check it works?
Yep, just "named The_Crow" is enough, and it works fine in TheLacus' editor. We'll go with this simple iteration then.

Re: Syntax highlighting

Posted: Thu Sep 20, 2018 4:03 pm
by Binarynova
I did a search through this topic, and I see that it kind of came up, but I didn't see like a definitive answer or a download, so I just wanted to ask, is there a way to get this functionality in Atom.io?

Re: Syntax highlighting

Posted: Thu Sep 20, 2018 4:07 pm
by Hazelnut
I figured out how to do this at one point but I didn't get around to documenting it. I tried what I could remember with a more recent release and it didn't work. I spent 0 time trying to figure out why. I can give you the info I can recall if you fancy working it out and reporting back. I may get around to doing this myself (I did intend to) but it wont be for a while.