Aller au contenu

Photo

Random encounter on inventory


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
Who said that I

Who said that I
  • Members
  • 492 messages
Hello everyone!

I wondered if this is possible to have a script written for an item that does the following:

- checks if the time is day or night
-if night then makes a random roll for an encounter to attack pc that holds the item in his inventory.

So far my own attempts have failed, well failed at the start.

So if anyone knows how to do this than that yay! (And also help me with this script :P)

So thanks in advance!

#2
Proleric

Proleric
  • Members
  • 2 354 messages
in brief:

If this can happen anywhere, you'd put it in the module heartbeat script.

GetIsNight will tell you when it's nightfall. If you want some random time during the night, GetTimeHour is better.

Loop through PCs (or instances of the item, if there aren't many) to find PCs who have the item.

CreateObject at the location of the PC is a simple way to spawn an encounter, using switch/case to choose a random monster resref.

Set a variable on the PC to stop further encounters for this night.

GetIsDay will tell you when to delete that variable, so that encounters can happen on night #2.