Jump to content

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


Recommended Posts

scn EnableStuffOncePerGameHours

int iEnabled

Begin GameMode

   if 6 < GameHour && GameHour <= 18 && iEnabled == 0
   
      let iEnabled := 1
      ;enable stuff once in this time

   elseif (6 >= GameHour || GameHour > 18) && iEnabled == 1
   
      let iEnabled := 0
      ;disable stuff once in this time
	  
   endif
   
End

 

 

Link to comment
Share on other sites

  • Replies 82
  • Created
  • Last Reply

Top Posters In This Topic

The time period is either inclusive or exclusive - boolean.

The requirement, per time period, is either achieved or not - boolean.

 

Have I missed something here?

Link to comment
Share on other sites

The heading states "NPC's" which qualifies 1 NPC - the code would be on it. The grammar on the heading suggests a request for action on multiple NPCs - that code would have a somewhat different structure to the singularity.

 

I provided object enabling code but various NPCs would have other requirements.

Link to comment
Share on other sites

Hey there. I am trying to do something similar with lights amd leveled creatures. But it doesn't work. This time, both of them are enabled in the time during which I don't want them.

 

Propably something wrong with condition or variable setting in a script which control them, but without seeing the actual script I can only guess.

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.

Sorry to confuse things RomanR, having bicycled around 80km on the day of my previous post, I was a bit manic. I completely missed the GetDisabled, let alone overlooking it as the solution.

Link to comment
Share on other sites

@glowplug: There wasn't need to apologize to me, I didn't feel to be offended in any way. But it seems you're reffering to tha part of this thread which seems already solved? Again, as it's propably some new issue, Dimitrisgb should present actual script to be examined for (assuming logical) errors.

Link to comment
Share on other sites

Hi there. Thanx for the responses. This is the script for the creatures (ghosts):

scn GHOUndeadTownEnemies
begin GameMode
if GameHour >= 23 || GameHour < 6
TownGhost1.GetDisabled != 0
TownGhost1.Enable
TownGhost2.GetDisabled != 0
TownGhost2.Enable
TownGhost3.GetDisabled != 0
TownGhost3.Enable
TownGhost4.GetDisabled != 0
TownGhost4.Enable
else
TownGhost1.GetDisabled != 0
TownGhost1.Disable
TownGhost2.GetDisabled != 0
TownGhost2.Disable
TownGhost3.GetDisabled != 0
TownGhost3.Disable
TownGhost4.GetDisabled != 0
TownGhost4.Disable
endif
end
Link to comment
Share on other sites

And this is for the lights:

scn ELSRhondalCityLights
begin GameMode
if GameHour >= 20 || GameHour < 6
RenasHouseLight.GetDisabled != 0
RenasHouseLight.Enable
PlayersHouseLight1.GetDisabled != 0
PlayersHouseLight1.Enable
PlayersHouseLight2.GetDisabled != 0
PlayersHouseLight2.Enable
MageMinaretLight.GetDisabled != 0
MageMinaretLight.Enable
TempleExtLight1.GetDisabled != 0
TempleExtLight1.Enable
TempleExtLight2.GetDisabled != 0
TempleExtLight2.Enable
MinaretExtLight.GetDisabled != 0
MinaretExtLight.Enable
MelinaShopLight.GetDisabled != 0
MelinaShopLight.Enable
else
RenasHouseLight.GetDisabled != 0
RenasHouseLight.Disable
PlayersHouseLight1.GetDisabled != 0
PlayersHouseLight1.Disable
PlayersHouseLight2.GetDisabled != 0
PlayersHouseLight2.Disable
MageMinaretLight.GetDisabled != 0
MageMinaretLight.Disable
TempleExtLight1.GetDisabled != 0
TempleExtLight1.Disable
TempleExtLight2.GetDisabled != 0
TempleExtLight2.Disable
MinaretExtLight.GetDisabled != 0
MinaretExtLight.Disable
MelinaShopLight.GetDisabled != 0
MelinaShopLight.Disable
endif
end
Link to comment
Share on other sites

There are opposite checkings after else commands in both scripts you present - should be GetDisabled == 0

scn GHOUndeadTownEnemies
 
begin GameMode
 
if GameHour >= 23 || GameHour < 6 ;midnight to morning
 
   if TownGhost1.GetDisabled != 0 ;ghost IS disabled
     TownGhost1.Enable
   endif
   if TownGhost2.GetDisabled != 0
     TownGhost2.Enable
   endif
   if TownGhost3.GetDisabled != 0
     TownGhost3.Enable
   endif
   if TownGhost4.GetDisabled != 0
     TownGhost4.Enable
   endif 

else 

   if TownGhost1.GetDisabled == 0 ;ghost IS NOT disabled
     TownGhost1.Disable
   endif
   if TownGhost2.GetDisabled == 0
     TownGhost2.Disable
   endif
   if TownGhost3.GetDisabled == 0
     TownGhost3.Disable
   endif 
   if TownGhost4.GetDisabled == 0
     TownGhost4.Disable
   endif 

endif
 
end

Similar in second script.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...