Aller au contenu

Photo

Question about flags/conversations/scripts


3 réponses à ce sujet

#1
ArathWoeeye

ArathWoeeye
  • Members
  • 205 messages
 Greetings.
I've been working on a dialogue and got some questions.
To summarize, I borrowed the npc spawn code from an online tutorial (you probably have seen or heard it, it was a merchant spawn).
This code basically checks for the npc in the area and spawns it if it's not there.

I slightly changed the code a few times to see what I can do with it very simply. For example, I made it check if sten was there, I made it display a floating message about a plot flag status...

Now, it doesn't work. The merchant spawn does, but I can't get it to display anything. Not only that, but also one of my plot flags is apparently Set on start, eventhough it's supposed to be not-set.

There are some assumptions of mine on how these work. For example, I assume that, each time I load a game, the flag starts from its first condition. So, say, if I load a game, do something to change that flag then quit the game and later on load that save to check something, its value isn't the last value.

By the way, the reason I load games is because that's the only way I know how to test stuff. It's an NPC, dialogue-based test in camp, so i keep loading a save in campsite.

Here are my questions:
1-) When I place an 2da file (PRCSCR_one) to load a script for that area, does it require an area transition? Or simply loading the area loads it? I assume it must be the latter. However, there has been a few times when a script didn't fire when I loaded my camp save, but worked when I traveled to another spot and re-entered camp. Got me confused. Or is it just random problem or some problem because of bad code?
///////////////////////////////
#include "wrappers_h" (i dont know what this includes actually:P)#include "plot_h" (included when I tried getting plot flags. not sure if needed)#include "plt_csc_plt_traveler_dlg" (again, this is included because I tried getting plot flags from the file)#include "utility_h" (included to troubleshoot a few problems, probably not really needed)void main(){object oPlayer = GetMainControlled();object oMerchant = UT_GetNearestObjectByTag(oPlayer, "csc_traveler");if (!IsObjectValid(oMerchant)){object oArea = GetObjectByTag("cam100ar_camp_plains");location lMerchantLocation = Location(oArea, Vector(166.61, 124.77, -1.33), 85.4);CreateObject(OBJECT_TYPE_CREATURE, R"csc_traveler.utc", lMerchantLocation);
}
/////////////////////////////////

2) How right am I about the plot flag values? Does it reset each time you load a game? I mean it should. It actually works with one of the flags. While talking you have a chance to learn something from him, which unlocks some options. This always works. However, as i said, there is a flag that is meant to be not set initially, but behaves as if its set. I checked its situation by assigning the plot to a conversation child condition. Now I can easily change set/not set values in the conversation, but I don't understand why it doesn't start as a not-set value. Any ideas on what could cause this?

3) What is the best way to test mods? I'm mostly doing conversations, so I think I'll be able to test them if I set a stage and all.

4) Is there a way to search the conversation to find Conditions and/or Actions? Or use of a certain flag? Or the only way is the expand and check all branches?

5) Is my method of spawning npc any good? Any advices or suggestions on that? I'm quite the noob with modding, so I don't know the general way modders take.

I think I skipped a question or two, I'll post them later.

#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
1) The area load event is fired when the player transitions to an area from another area, not when the player "loads" a save game within the area.



2) I'm not quite sure what you're asking about plot flags, so I'll try and explain. When you load a save game, plot flag values are whatever they were when you made that save. If you save, set some flags then load without saving, the flags set after the save will be reset. However, flags do not reset to their original values. Plot flags are they principle way progress through the game is tracked. If they reset when the game was load, all progress would be lost.



3) It depends what you need to test. I tend to make a save game as close to my change as possible, but in another area before I've ever entered the changed area. If the change is to a script or conversation file, then this isn't necessary and the save can be directly next to the change. For some kinds of changes, you need to start a new game and use cheat commands to quickly progress to the area in question. Unfortunately, understanding what is a safe way to test requires an understanding of what dats is saved into the save game and what is global and outside of the save.



4) In the conversation editor, press ctrl f to search. Press the Show Fields button to expand a list of fields to search. You can check or uncheck the action and condition plots and plot flags to search for whatever you want.



5) If what you want is to add an NPC to the main campaign in a way which will be compatable with other people's mods, then yes, that's a good way. If you aren't interseted in compatability, you could directly edit the main campaign module and place your NPC in the area. This wouldn't be compatible with any save game that had already entered the area however. For making large changes intended for future playthroughs, this method would likely be simpler than spawning creatures in dynamicaly however.

#3
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
How are you testing these flags. Is it from a save game? Have you previously deleted any flags from this plot?



I ask because of the way flags are stored. The game doesn't care what a flags name is, only what it's number is. If you delete a flag and add a new one, it re-uses the number, so a previous save game could already have set that flag to be some valuel, even though think you're working with a new flag.



Other than that, I'm drawing a blank, but it's hard for me to tell where you're going wrong without being able to look over what you've done.

#4
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
GetNearestObjectByTag returns an array of all creatures in the current area wth the given tag, sorted by distance to the specificied object.



UT_GetNearestObjectByTag returns the object in the current area which both has the given tag and is closest to the speicified object.



The UT version is more convenient if you only want one creature, and runs much faster if you're worried about performance. I'd only use GetNearestObjectByTag if you want to do something to multiple creatures that have the same tag, and you care about their distance from some object.