lusikas Posted June 8 Share Posted June 8 I seem to have run into a wall while making my mod and would appreciate some help. An NPC with an OnActivate block in their script starts that block instead of a conversation when activated. Is there any way to replicate that effect without having to add the script to specific NPCs in the Construction Set? I'd like it to be tied to a token (item, spell, doesn't matter) that I could add to or remove from any NPCs during gameplay. Link to comment Share on other sites More sharing options...
RomanR Posted June 9 Share Posted June 9 (edited) There shouldn't be a need for such complex solution. By editing of OnActivate block and inserting Activate command(s) in it will also begin a dialog. scn RomRSeedNeeusOnActSCR short m begin OnActivate if IsActionRef playerRef if m == 0 set m to 1 Activate Message "You activated this NPC for a first time." else Activate Message "You activated this NPC again." endif else Activate endif end For example this simple script will show a message whenever you activate NPC and begin a dialog as normal. Edited June 9 by RomanR Link to comment Share on other sites More sharing options...
lusikas Posted June 9 Author Share Posted June 9 I'm not very good at explaining the issue so please do bear with me here. Your example script there would be an object script that'd need to be attached directly to specific NPCs in the Construction Set. That's exactly what I want to avoid doing. Let's say the player has a spell that you can use on ANY NPC you want to, and whoever it hits is put in a state where activating displays the message box instead of dialogue. Is this possible? I tried using an event handler and it did play the script but unfortunately it didn't block the dialogue. Link to comment Share on other sites More sharing options...
RomanR Posted June 10 Share Posted June 10 For now the only way I found is to use event handler to put a NPC into unconscious state and adding a token which will show message box and after a choice is made, it will reset that state. Main problem is that after reseting a unconscious flag the face didn't return to its original state. Using Update3D command worked, but the way this command works makes NPC blink. Link to comment Share on other sites More sharing options...
GamerRick Posted June 11 Share Posted June 11 What if you have the spell set the actor to destroyed (SetDestroyed), which will stop the player from being able to activate them? Will your OnActivate event still fire? If so, you would need to do the 'SetDestroyed 0' to return the actor to normal. I am guessing you are using the OnActivate event to catch this. For further help please post your scripts. 1 Link to comment Share on other sites More sharing options...
RomanR Posted June 11 Share Posted June 11 9 hours ago, GamerRick said: What if you have the spell set the actor to destroyed (SetDestroyed), which will stop the player from being able to activate them? Will your OnActivate event still fire? If so, you would need to do the 'SetDestroyed 0' to return the actor to normal. I am guessing you are using the OnActivate event to catch this. For further help please post your scripts. Yes, use of this command did the trick and all seems working as it should. As I used OnActivate event in combination with a token, my result is this: Spoiler scn RomRSetHandlerQSTScript float fQuestDelayTime short showMBox begin MenuMode 1044 set fQuestDelayTime to 0.1 if GetGameRestarted SetEventHandler "OnActivate" RomRFnOnActivateHandler Message "On Activate handler set." endif end As you run Oblivion, reaching the main menu will initialize OnActivate event, editor ID of this quest is RomRActivateQST in CS (I was lazy to change that). Spoiler scn RomRFnOnActivateHandler ref actor ref object int type begin function {object, actor} if actor == playerRef && object != 0 let type := object.GetObjectType if type == 35 ;NPC if object.GetDead == 0 && RomRActivateQST.showMBox != 0 && object.GetDestroyed == 0 object.SetDestroyed 1 set type to object.GetItemCount RomRActToken if type == 0 object.AddItem RomRActToken 1 endif endif endif endif end This handler applies some filtering and adds a token to NPC which will do the rest of work. Notice the use showMBox quest variable present in previous quest script, so you must set this variable to nonzero value first . Spoiler scn RomRActTokenScript ref actor short mBox short choice begin GameMode if actor == 0 set actor to GetContainer endif if actor != 0 if mBox == 0 set mBox to 1 set choice to -1 endif if mBox > 0 MessageBox "Choose!","1","2","Nothing" set mBox to -1 endif if mBox == -1 && choice < 0 set choice to GetButtonPressed elseif mBox == -1 if choice == 0 print "You choose first." endif if choice == 1 print "You choose second." endif if choice == 2 print "You choose nothing." endif if actor.GetDestroyed != 0 actor.SetDestroyed 0 endif set mBox to -2 endif if mBox == -2 set mBox to 0 set actor to 0 RemoveMe endif endif end And this is what you wanted. In this example a token will show a message box and your choice will be printed to console. After this token will reset NPC's "destroyed" flag and detaches from inventory. As mentioned earlier, this approach is propably overkill. But all you need is to set one variable "on/off". 1 Link to comment Share on other sites More sharing options...
lusikas Posted June 11 Author Share Posted June 11 Thanks a lot to both of you, everything works perfectly now. I'm seeing a lot of potential for fun ways to utilize this. Link to comment Share on other sites More sharing options...
Recommended Posts