Jump to content

Random Rat Spawns


MaximumPain

Recommended Posts

I'm working on this Thieves Guild Overhaul mod. What I would like to do is have rats (small skeevers) spawn or not (say a 80% chance of not spawning) and randomly apear between 0 - 10 mins. In this way I can place rats around The Ragged Flagon that would randomly appear occasionally, not all at once. Hopefully someone will have some ideas how this can be achieved.

Edited by MaximumPain
Link to comment
Share on other sites

There are several things you will want:

 

Have some sort of random function RandomInt or RandomFloat (I lean on RandomFloat so you can use percentages like you describe, since 80% = 0.8, so you would be checking if it is above 80%, then spawn).

 

The skeever probably needs an Actor script attached to it (so it propagates to all Skeevers you insert into The Ragged Flaggon).

 

When you say 0-10 mins, are you talking about in-game time or in real time? If you want game time, you will want OnUpdateGameTime and RegisterForSingleUpdateGameTime, otherwise you will want OnUpdate and RegisterForSingleUpdate. Whichever method you choose, be sure to call the Register function both in the Update event and in the event you use to start the update.

 

When a rat is 'spawned'(enabled), I believe you don't want to Register for another update (funky behavior might happen).

 

An event you will want to attach to this script is OnDeath. Within the event you will want to Disable the rat, Resurrect the rat, and register for an update (based on how you are doing it)

 

Hope this helps you get on the right track.

Link to comment
Share on other sites

Thanks for your reply Arron.

Er on second thoughts I'll just throw some small Skeevers in The Ragged Flaggon. LOL

0-10 mins real time or what the equivalent of that is in game time.

I've not done any scripting before and so was hoping there would be some sort of standard script or something for random encounters with hostiles that I didn't know about, similar to adding critters. Anyway thanks again for your time and effort, I will be learning scripting and hopefully get to a stage where your information can be put to use.

Link to comment
Share on other sites

So an example I wrote out to show you the thought process (feel free to use the contents and experiment from there):

  Reveal hidden contents

 

Edited by Arron Dominion
Link to comment
Share on other sites

  • Recently Browsing   0 members

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