tahadar Posted January 23, 2019 Posted January 23, 2019 I'm trying to do something that for most people here is simple, but for me is close to rocket science. I'm trying to write a script that makes a companion to come to you and say "good night" each time you are trying to sleep. Because my script is not working, it's obvious I fkd up at some point - probably at the moment I tried to write the "s" from "scn". Anyway... I find out the GetSleeping is not working for PC. So I said does not matter, a companion can wake PC up to say good night. scn aabGoodNightScript int DoOnce Begin gamemode if IsPCSleeping == 1 && DoOnce == 0 WakeUpPc MessageBoxEX "Good night" Set DoOnce to DoOnce +1 endif end I can't even make this to work, so counting companions, picking one from the list and make him / her to talk to player is out of the question. What I'm doing wrong?
Guest Posted January 23, 2019 Posted January 23, 2019 One do you have this attached to a quest so it will run and two have the script as a quest script? Not sure why but that script doesn't seem to read the end line correctly. You can use MessageBoxEX to add debug print lines if you want. scn aaaGoodNightScript short DoOnce Begin Gamemode if IsPCSleeping == 1 && DoOnce == 0 WakeUpPc MessageBoxEX "Good night" Set DoOnce to 1 endif End Unless you need DoOnce to keep counting over 1 for some reason no point in +1. Also this site can help spot some things for beginners http://www.cipscis.com/fallout/utilities/validator.aspx And maybe look on the Nexus for Notepad++ Syntax Highlighter by Doctasax.
Guest Posted January 23, 2019 Posted January 23, 2019 Never did something like that but I'm thinking that you probably want to start with Begin MenuMode, or better Begin MenuMode 1012
tahadar Posted January 24, 2019 Author Posted January 24, 2019 @aghjax thank you for the link - very useful. @A.J. Thank you for the "Begin MenuMode 1012" info. Of course this raises a whole new area of questions and problems. If I block the menu for appearing, I what kind of condition I should set in order to trigger the "good night message"? I assume PC won't be sleeping because no sleeping hours were set. ... How the hell did you, guys, learned those things? Especially because every bit of useful information is buried under a mountain of unrelated crap.
Guest Posted January 24, 2019 Posted January 24, 2019 Most documentation is provived by people doing the same you are doing, trying and write down conclusions, so there could be some wrong informations that could lead you to a wrong path. The best imho is always try on your own and find your own conclusions for what you want to achieve, never take everything for 100% correct. But in general I think it's quite easy compared to other subjects, for scripting there's a lot of tutorials around. Back to your topic, I could be wrong but I think what you want to do is doable, just less immediate that it could seem at first maybe. There's some extra considerations to make, but not knowing exactly how the mod works I will only write few extra assumption, some could be obvious of course. - I assume the Good Night message box is a placeholder and you'll want a npc to come to you and start a dialogue. - The npc will tell me Good Night only once per day, after that I'll be able to sleep: I'll have to store the value of a variable inside a quest script, or an object script attached to the npc itself, then use it as condition for the chunk of code that prevents sleeping. So, its value will go from (preventing sleeping) to (not preventing sleeping) inside the dialogue script with that npc, in the Good Night dialogue line itself. And then of course that value will have to be resetted, and could be done inside the above chunk of code. It could be that DoOnce, just to say, if the script is a quest and it is resetted inside the dialogue with the npc. - What happens if you don't sleep enough and want to sleep more hours? i.e. if you decided to sleep 4 hours, then you decide to sleep 4 more hours? will I have another Good Night or it is daily based? another thing to handle - What happens if for some reasons the npc can't tell you good night because not present, or too far, etc? - What triggers the Good Night dialogue, is it a package? what if the package fails to start? maybe putting some failsafes isn't a bad idea, so that the player won't be stuck in a Can't Sleep state because something didn't work as intended in a certain peculiar situation. Etc.etc. It's the kind of things you need to handle when you want to do something like this. Maybe the best deal could be think a bit about it and try to write down something more, then we could debug together if it doesn't work.
tahadar Posted January 26, 2019 Author Posted January 26, 2019 @A.J.Whoa, that's a lot of homework for one weekend. Thank you for taking time and writing those pointers. It suddenly became more complex than I expected. But I'm not going to give up. Because if I understand how to do this and not just copy lines of script from one place to another, I will be able to actually make something other people would enjoy. My problem right now, I write 2 lines, then I NEED to see if they are working, so I fire up FNV ... and I end up playing the game. Childish, I know. 1. GoodNight box was something to describe "You were about to go to sleep then &NPCName; comes to you bla bla bla". And yes, start dialogue. I know &PCName; display your character name, not sure about the companions name. I dug up a lot of mods trying to figure out how to create a flist storing active companions, then pick one from that list. Still working on it. (I assume this is the right way to do it, instead of checking each and every potential companion every time the script fires - less load on machines) ... and now I have to read / learn about packages and how they work. Edit. OK, it just crossed my mind. If I create a table / list with active companions, that flist will be always present in memory, taking up resources. Maybe listing companions inside the script is not such a bad idea.
Guest Posted January 26, 2019 Posted January 26, 2019 To retrieve the list of active companions, you can use JIP which returns an array with those following you. Then you can pick a random reference from the list and store it in a ref variable. At that point you can retrieve the name with NVSE GetName, but I think you can simply pass the follower's reference at the message box with the %z parameter and it'll retrieve the name automatically. However this means you going in the field of NVSE, JIP, arrays etc. which could be an added layer of initial difficulty. Still, we're here to help, so... If you're wondering if adding a prerequisite like NVSE or JIP is good or not, well that depends by you but I think the answer is always yes. Today everyone has script extender and its plugins in their installations, there's not really a single reason to not use them. It's not like an extra .esm or .esp that takes space, just to say.
tahadar Posted January 31, 2019 Author Posted January 31, 2019 Thank you. Unfortunately I don't have as much time to learn all this as I like to, because I work ~10-12 hours / day, so there are only 2-3 hours / business day while I can read or do stuff. That's why my posts are sort of delayed. I'm not slacking off, just always in need of more time... But weekends are mine.
Guest Posted January 31, 2019 Posted January 31, 2019 1 hour ago, tahadar said: Thank you. Unfortunately I don't have as much time to learn all this as I like to, because I work ~10-12 hours / day, so there are only 2-3 hours / business day while I can read or do stuff. That's why my posts are sort of delayed. I'm not slacking off, just always in need of more time... But weekends are mine. oh don't worry, no need to rush. When you'll need help, just give a holler!
tahadar Posted February 2, 2019 Author Posted February 2, 2019 Ok, this is driving me crazy. How can I get the name of a random person I talk? And how do I place that in a message? string_var talker_name let talker_name := GetName ????????? MessageEx "talker_name smiles at you." // or is ShowMessage aaaGoodNightMsgSmile where aaaGoodNightMsgSmile is something like %n smiles at you. IF the person would not be random, I guess will be something like string_var talker_name let talker_name := GetName ArcadeRef / TrudyRef / MrHouseRef MessageEx "talker_name smiles at you." ... and more important, how do I integrate this in a dialog? I tried adding the whole string_var thingie to the bottom right box in Dialog Window (script ends) then tried talking with specific NPCs.... and it crashes the game. Any clues? Thank you.
jaam Posted February 2, 2019 Posted February 2, 2019 GetDialogueTarget GetDialogueSubject GetDialogueSpeaker will return whom is talking. If I remember correctly, in player dialogue, you are looking for GetDialogueSubject
tahadar Posted February 2, 2019 Author Posted February 2, 2019 I'm even more in the dark now. I did this: string_var npc_name let npc_name := "GetDialogueSubject" MessageEx " "$npc_name" smiles happily at you." ... and Geck thows "unknown variable $npc_name for parameter variable" at me. I also tried with Subject and Speaker. Same error. I'm missing something here, or maybe this mini-script should not go in Result Script (End) window? Should have its own script file? (Btw, this comes after a couple of hours spent doing trial & error. At least now I know the proper syntax.)
dborg2 Posted February 3, 2019 Posted February 3, 2019 Quote MessageEx " "$npc_name" smiles happily at you." I didn't do much with MessageEx yet, (and can't test right now), but perhaps this works: MessageEx "%n smiles happily at you." npc_name
tahadar Posted February 3, 2019 Author Posted February 3, 2019 I've got "<no name>npc_name smiles happily at you." message. Later edit. According to geck wiki, GetDialogueTarget / Subject / Speaker are used for conversation, not for dialogues. Quote Returns the NPC who is currently being spoken to in a conversation. I guess this sends me back to square one. How do I get the name / ID of a random NPC in a dialogue?
Guest Posted February 3, 2019 Posted February 3, 2019 41 minutes ago, tahadar said: I've got "<no name>npc_name smiles happily at you." message. And what result from this: MessageEx "%z - %n - %x - %i smiles happily at you." npc_name npc_name npc_name npc_name
tahadar Posted February 3, 2019 Author Posted February 3, 2019 string_var npc_name let npc_name := "GetDialogueSubject" PrintC " %z - %n - %x - %i smiles happily at you. " npc_name npc_name npc_name npc_name MessageEx "%z - %n - %x - %i smiles happily at you." npc_name npc_name npc_name npc_name Returns in console: GetDialogueSubject <- no name -> - 1 - 00000000 smiles happily at you. Edit: ... and I wanted to clarify, if I make a global script, with "begin Gamemode", means each npc will smile at PC when I start a dialogue. That includes fiends, power gangers, bos and such. In the end I will need their "emotes" to be based on reputation - just like the random lines of dialogue evolves from eg "I'm keeping an eye on you, outsider" to "I'm glad you are here, friend". But right now I'm stuck at something that looks like 1st grade homework for most of people here.
Guest Posted February 3, 2019 Posted February 3, 2019 my own dumb debug was helpful to show I'm blind. These "" make it be treated as a string. So npc_name is getting the value of "GetDialogueSubject", these exact words, and not the npc's reference. let npc_name := GetDialogueSubject Then we could discuss if it works or not, I've never used it in this context, but this is surely the first thing to try.
tahadar Posted February 3, 2019 Author Posted February 3, 2019 If I try to remove the "", geck is yelling "Invalid operands for operator :=" According to geck wiki, apparently I'm using the function wrong. (ref) reference.GetDialogueTarget actor:reference Which in all honesty I have no clue what means. Even with their example set MyQuest.Target to GetDialogueTarget This is the link to their page.
Guest Posted February 3, 2019 Posted February 3, 2019 Mmmh... what about something like this: ref rMyREF string_var svMyName Set rMyREF to GetDialogueSubject Let svMyName := rMyREF.GetName MessageEx "%z - %n - %x - %i smiles happily at you." svMyName rMyREF rMyREF rMyREF EDIT: the difference between Subject and Target is that the former should be NPC and the latter should be player EDIT2: corrected a typo which wasn't causing harm, but still could cause you extra headaches...
tahadar Posted February 3, 2019 Author Posted February 3, 2019 1 hour ago, A.J. said: Mmmh... what about something like this: ref rMyREF string_var svMyName PrintC "referemce and variable declared" Set rMyREF to GetDialogueSubject PrintC "reference set" Let svMyName := rMyREF.GetName PrintC "got the damn name" PrintC "%z - %n - %x - %i smiles happily at you." svMyName rMyREF rMyREF rMyREF MessageEx "%z - %n - %x - %i smiles happily at you." svMyName rMyREF rMyREF rMyREF ... Console: reference and variable declared reference set Error in script 00000000 Attempting to call a NULL reference or base object File: FalloutFNV.esm Offset: 0x007D Command: Let got the damn name NULL <-no name-> - 0 - 00000000 - smiles happily at you. How do I enable debug log? Adding Papyrus section in ini like in Skyrim did not produced any log. [Papyrus] bEnableLogging=1 bEnableTrace=1 bLoadDebugInformation=1
Guest Posted February 3, 2019 Posted February 3, 2019 Yes you don't have such a thing in NV. Even because Papyrus came out with Skyrim. Ok that's where I wanted to go. The function is not retrieving the dialogue subject, hence it answers with null. The remaining errors are consequences of it. Let's see if someone else have a clue about it. How do I quote DoctaSax for example, so that he could be notified?
tahadar Posted February 3, 2019 Author Posted February 3, 2019 Like this? [quote username="A.J."] stuff [/quote]
DoctaSax Posted February 4, 2019 Posted February 4, 2019 IsPCSleeping only processes during menumode. I had something checking that in SOFO to process weird dream noises. strings stored in a string var are passed to messages and messsageboxes with the %z format specifier. Passing the ref to a message with the %n format specifier should work too. You can't have the actual var or a function inside the message's string. GetDialogueSubject, if working (never used it myself), returns the ref, not the name. The parentheses at the beginning of the syntax example give you the return type: (ref). A sure way of getting the NPC the player's having a dialog with is GetSelf, used in the result script of the dialog itself. You can then store that in a ref var of a quest script (set MyQuest.rRefVar to GetSelf) for further use.
jaam Posted February 4, 2019 Posted February 4, 2019 and you have to be in a dialogue or conversation to use them. if I remember correctly, there is a function in NVSE Extender that should return the last person the player has talked to.
tahadar Posted February 9, 2019 Author Posted February 9, 2019 It's somehow frustrating to see how something that seemed simple and easy at the 1st glance (get name / name smiles at you) evolves into... something else. Anyway, it's weekend and I have about 36 hours to read documentation and mess with variables and stuff. Thank you for the new pointers, guys. Your help is appreciated.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.