TrippyTheSquirrel Posted October 3, 2016 Share Posted October 3, 2016 My scripting skills are rudimentary, but I've been able to work things out and make them work up until now. I'm humbly beseeching help on what seems to be a very simple thing. I am adding a quest to a mod, in which a main mod character sends the player to talk to an NPC that has been bribed to provide information. I want the information-bearing NPC to exist in the game only for the stages of the quest that require her. So the result I want is for her to start disabled (checked the box), become enabled when the quest hits a certain stage and the player enters the Wawnet Inn, hang around to provide reminder information until another stage is reached, then disappear (disable). I tried including my script in the main quest script, and it didn't work. So I attached the following short script to the NPC object (persistent reference,) ref ID 'DorritaaMSB'. Still no luck. I have no idea what I'm doing wrong - I have had no problems enabling or disabling objects with other scripts. SCN DorritScriptShort DorritOnShort DorritOffBegin Gamemode If [GetStage aaMSB == 30] If DorritOn == 0 If (Player.GetInCell WawnetInnTavern) "DorritaaMSB".Enable Set DorritOn to 1 EndIf EndIf EndIfEndBegin Gamemode If DorritOn == 1 If DorritOff == 0 If [GetStage aaMSB == 50] "DorritaaMSB".Disable Set DorritOff to 1 EndIf EndIf EndIfEnd I would sincerely appreciate any and all advice on making this work. Thanks, Trippy Link to comment Share on other sites More sharing options...
PushTheWinButton Posted October 3, 2016 Share Posted October 3, 2016 (edited) Why are there quotation marks around the reference's ID? Also you should have only one GameMode block, containing both if statements. Never use more than one of any block type unless it's something like MenuMode "[different menu code]". You're much better doing this in the quest script or in quest stages because GameMode scripts attached to world objects run every frame, which is bad for performance. Edited October 3, 2016 by PushTheWinButton Link to comment Share on other sites More sharing options...
lubronbrons Posted October 3, 2016 Share Posted October 3, 2016 hello TrippyI have suggestion for improvement SCN DorritScript Begin GameMode if GetDisabled ;no need to store enable disable in variable, you can use function GetDisabled if GetStage aaMSB == 30 Enable endif else if GetStage aaMSB == 50 Disable endif endif End PushTheWinButton said that GameMode is bad for performance, I agreebut I think you can rest assured,because object script attached to npc will only run if player is in the same cellspace with that npc (or object)the script only contain small code enable disable function, that is very light performance. even though the gamemode in attached script run per 0.001 sec / 1 millisecondif you have Maskar Oblivion Overhaul modyou can see that MOO have many object script attached in npcs or objectsbut the game still considered stable and lightweightso ... I believe attaching script object is pretty lightweight if we use it only for small use Link to comment Share on other sites More sharing options...
TrippyTheSquirrel Posted October 3, 2016 Author Share Posted October 3, 2016 Thanks to you both for these helpful suggestions. I'll try it out and report the results. The quotation marks were something I picked up from a tutorial, some time ago, and since they worked, I kept using them. Probably unnecessary, and just a cargo cult thing. I'll omit them and see if it makes a difference. Regards, T. Edit: the elegant script you proposed worked like a charm. Thanks! Link to comment Share on other sites More sharing options...
lubronbrons Posted October 4, 2016 Share Posted October 4, 2016 Good to know that it works :)happy modding ! Link to comment Share on other sites More sharing options...
Recommended Posts