Jump to content

Monsters that only appear at night.


Xamator

Recommended Posts

I am currently working on a mod and I am I need of some script assistance because I'm still learning the ropes of scripting.

I'm trying to create a LeveledCreature Marker which spawns monsters only at night time (eg. 8 PM - 6AM), and also a script (of a sort) that i'll use as the Marker Script. Here's what I have so far:

 

begin gamemode

if (Gamehour <= 20) && (Gamehour > 6)

enable

elseif (Gamehour >= 20) && (Gamehour < 6)

disable

endif

end

 

It's pretty simple and incomplete, so I need to know what else should I fill in.

Also, Should I use the Creature Template Instead?

I appreciate any help.

Link to comment
Share on other sites

begin gamemode
if (Gamehour <= 20) && (Gamehour > 6) 
         enable
    elseif (Gamehour >= 20) && (Gamehour < 6)
         disable
   endif
end

 

This is a neat idea. As far as the current script goes, I can see a couple of problems there:

1. You've got the < and > signs reversed, so the creature would spawn between the hours of 6:00 AM and 8:00 PM (during the day).

 

2. Even if you reverse the signs, the script still won't run right. The game would interpret the script to mean "If it's after 8PM and before 6AM, spawn this critter". The problem is that these conditions can never be met; the time can't be after 8PM and before 6AM at the same time. You'll need to use the "or" ( || ) script command to make this work.

 

3. Using a GameMode block is counterproductive here. You only need this script to run if/when the cell gets loaded, but GameMode blocks run no matter where you are. This means that every single spawn point using this script will get loaded into memory whether the Player is near them or not. Try this instead:

 

Begin OnLoad ;this block will only run when the cell loads

 If GameHour >= 20 || GameHour <= 6 ;if it is after 8PM or before 6AM

    If GetDisabled == 1 ;if the spawn point is currently disabled

       Enable

    Endif

 ElseIf GameHour < 20 || GameHour > 6 ;if it is before 8PM or after 6AM

    If GetDisabled == 0 ;if the spawn point is NOT currently disabled

       Disable

    Endif

 Endif

End

Link to comment
Share on other sites

I greatly appreciate your help.

I'm happy to say this script works perfectly and it has helped me learn something new about scripting (in a way).

 

My mod is far from done, though.

And before people ask, no, I got the idea for the script from an MMO called Requiem, NOT MINECRAFT.

Im off.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...