Jump to content

Simple script help


MasterMuhaha

Recommended Posts

Attach the script below to the npc, then click the Properties button in the CK and "auto-fill" it. You can manually enter different times for the EnableTime and DisableTime properies, but I have already assigned the default values 6 and 24. I've designed this script to be very idiot proof. EnableTime and DisableTime should be a number between 0 and 24, it doesn't matter which order they are in.

 

 

  Reveal hidden contents

 

 

Edit: I fixed a few typos. The script compiles.

Edited by steve40
Link to comment
Share on other sites

The script below is a modified version of a script i've found on the CKwiki to turn on/off lights depending on the game time. I don't have the opportunity to test it too, sorry.

 

 

  Reveal hidden contents

 

 

You can put this script on the NPC it self, or put it on a marker and set it as the "Enable Parent" of the NPC. So switching the marker will switch the NPC too.

 

Source: http://www.creationkit.com/Light_Switch

Edited by gasti89
Link to comment
Share on other sites

That script would get confused if, say, the npc "on" time was 22:00 and the "off" time was 06:00. Say it was currently 21:00, the OnInit in the Wiki's script would incorrectly enable the npc. Also it would be weird if the actor died and his corpse kept enabling and disabling at 6:00 and 24:00. My script won't make those errors 8) Edited by steve40
Link to comment
Share on other sites

  On 6/18/2012 at 8:08 AM, steve40 said:

That script would get confused if, say, the npc "on" time was 22:00 and the "off" time was 06:00. Say it was currently 21:00, the OnInit in Bethesda's script would incorrectly enable the npc. Also it would be weird if the actor died and his corpse kept enabling and disabling at 6:00 and 24:00. Mine wouldn't make those errors 8)

 

man, why can´t this be as simple as in the previous script language used for morrowind, oblivion and fallout. why did they change it anyway? the other one was pretty simple and completely sufficient. but thanks :)

Link to comment
Share on other sites

Oh, and you probably should be aware of this little problem which I was careful to avoid in my script.

 

From the Creation Kit wiki:

 

"Using this function (RegisterForSingleUpdateGameTime) could cause your game to freeze under any of the following conditions:

afInterval is less than some number between 0.0244 and 0.0238."

 

Random freezes anyone? :devil:

Edited by steve40
Link to comment
Share on other sites

guys, an other problem. i need the npc to be disabled at 24 o'clock and to be enabled and COMPLETELY RESET at 6 o´clock.

 

the purpose of all this is that i have a randomized-character-npc which should generate/output an npc from the leveled list it is based on. but it appears to be, that once an npc from the leveled list has been generated, it stays there. what i mean is, i want to have an other npc from the leveled list to spawn after an enable-disable-sequence, but there is always the same npc from the list spawning.

 

i thought, that it might work, if i simply do not ENABLE the leveled-list-npc at 6 o´clock, but make it spawn an other one of its kind with a placeatme-command and delete the original with markfordelete. now, since i have problems with programming in papyrus, i ask for your help. :)

Link to comment
Share on other sites

  On 6/17/2012 at 10:53 PM, MasterMuhaha said:

hey guys. i need a little help with a mod. i need a script for an npc, that disables the npc at 0 o´clock and enables it at 6 o´clock. thank you in advance. :)

 

You got what you asked for. We're shooting at moving targets here. Sorry >:( .

Edited by steve40
Link to comment
Share on other sites

  • Recently Browsing   0 members

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