Jump to content

How to make NPC's appear out of nowhere at a certain time of the day


Recommended Posts

@OblivionAddicted: I would add some checking to not execute Disable or Enable commands at all times.

ScriptName DrimitriSGBActivateNightlyNPCScript

begin GameMode

if GameHour >= 18 || GameHour < 6
   if ELSHunbalSpirit.GetDisabled != 0
      ELSHunbalSpirit.Enable
   endif
else
   if ELSHunbalSpirit.GetDisabled == 0
      ELSHunbalSpirit.Disable
   endif
endif
end

He is using ELSHunbalSpirit reference name from ELSHunbal base NPC, if you're wondering why I didn't add Ref suffix to reference ID.

Link to comment
Share on other sites

  • Replies 82
  • Created
  • Last Reply

Top Posters In This Topic

Assuming you already gave your NPC's a unique cell reference and you want to use a quest script your script should look like this without the DoOnce variable:

 

ScriptName DrimitriSGBActivateNightlyNPCScript

 

begin GameMode

 

if GameHour >= 18 || GameHour < 6

ELSHunbalSpiritRef.enable

else

ELSHunbalSpiritRef.disable

endif

end

 

assuming your NPC with the editor ID ELSHunbalSpirit has the unique cell reference ELSHunbalSpiritRef that is, of course.

 

I used a similar script with an initially disabled NPC and gave the "quest" a 50 points priority by the way.

 

So I need to add a quest? Or just select quest script?

Link to comment
Share on other sites

For a testing purpose, there's no need. Simply attach it to player (in CS there is a defined NPC by this name, don't forget to switch the script type to right one). This will make run the script always too, regardless the place and with every-frame precision.

 

As you get the final version working, only then will be worth to make it quest script or copy these commands in GameMode block into another one script.

Link to comment
Share on other sites

@OblivionAddicted: I would add some checking to not execute Disable or Enable commands at all times.

ScriptName DrimitriSGBActivateNightlyNPCScript

begin GameMode

if GameHour >= 18 || GameHour < 6
   if ELSHunbalSpirit.GetDisabled != 0
      ELSHunbalSpirit.Enable
   endif
else
   if ELSHunbalSpirit.GetDisabled == 0
      ELSHunbalSpirit.Disable
   endif
endif
end

He is using ELSHunbalSpirit reference name from ELSHunbal base NPC, if you're wondering why I didn't add Ref suffix to reference ID.

 

Looks like this is working. But I am trying to add the rest of the NPCs and I get mismatching blocks and all that. How exactly can I add them?

This is what I wrote:

 

scn ELSJinsAppear
begin GameMode
if GameHour >= 21 || GameHour < 6
if ELSHunbalSpirit.GetDisabled != 0
ELSHunbalSpirit.Enable
if ELSAlUzzaSpirit.GetDisabled ! = 0
ELSAlUzzaSpirit.Enable
endif
else
if ELSHunbalSpirit.GetDisabled == 0
ELSHunbalSpirit.Disable
if ELSAlUzzaSpirit.GetDisabled == 0
ELSAlUzzaSpirit.Enable
endif
endif
end
Link to comment
Share on other sites

This way, you should see a pattern:

scn ELSJinsAppear

begin GameMode

if GameHour >= 21 || GameHour < 6
   if ELSHunbalSpirit.GetDisabled != 0
      ELSHunbalSpirit.Enable
   endif
   if ELSAlUzzaSpirit.GetDisabled != 0
      ELSAlUzzaSpirit.Enable
   endif
else
   if ELSHunbalSpirit.GetDisabled == 0
      ELSHunbalSpirit.Disable
   endif
   if ELSAlUzzaSpirit.GetDisabled == 0
      ELSAlUzzaSpirit.Disable
​   endif
endif
end

Similar to others.

Edited by RomanR
Link to comment
Share on other sites

This way, you should see a pattern:

scn ELSJinsAppear

begin GameMode

if GameHour >= 21 || GameHour < 6
   if ELSHunbalSpirit.GetDisabled != 0
      ELSHunbalSpirit.Enable
   endif
   if ELSAlUzzaSpirit.GetDisabled != 0
      ELSAlUzzaSpirit.Enable
   endif
else
   if ELSHunbalSpirit.GetDisabled == 0
      ELSHunbalSpirit.Disable
   endif
   if ELSAlUzzaSpirit.GetDisabled == 0
      ELSAlUzzaSpirit.Disable
​   endif
endif
end

Similar to others.

 

I get an error message that says "Missing block and keyword" for "else" and "Mismatching block" for "end".

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...