Jump to content

trouble spawning npcs.


vlad550077

Recommended Posts

Hi,

 

I've built a world space, basically there is an enemy camp and a player camp. I've put as many npcs in the enemy camp as I think there should be. But I want groups of enemy npcs to run from the enemy camp to the player camp. Easy enough, but my problem is I need lots npcs and I don't want them to be hanging around waiting to go on patrol.

 

I need a script to spawn them, but I know nothing about scripts, sorry.

 

I need something along the lines of, at a given time on certain day xx amount of YY npc will spawn. Hopefully they will then follow their ai package and patrol to the player camp.

 

Its not a complex script I don't think, but I havn't a clue. This is the last part of this mod, and I really want it to be done and dusted so I can work on other projects.

 

Thanks very much for reading!

Link to comment
Share on other sites

What trigger do you currently use for the attack to start? Or does this attack occur repeatedly every week?

 

You could hand-place all of the actors in the enemy camp and initially disable them. Your script could enable them at the proper time.

Edited by David Brasher
Link to comment
Share on other sites

Thank you for your reply.

 

I don't have a script or even a trigger. At present all the NPCs that I want to patrol sit in a different world and leave through an autoload door. I had groups of NPCs with the same patrol AI package leaving at a given time on a given day. I had moved part of the load door away effectively making the 'NPC world' inaccessible to the player.

Crude, very very crude I know. But it worked, well while it was an esp.

 

I could make a trigger, but as I understand it, I need a script attatched to it, to actually make something happen?

 

I haven't a clue how to do a script, but my feeling is that the script I need would in fact be very simple?

 

Thanks again.

Link to comment
Share on other sites

So it sounds like you are saying this is a repeated thing and you want the enemies to attack every single week at the same day and time.

 

I really wish we had Oblivion Begin Gamemode blocks. That is what about half of the scripting in Oblivion was based on.

 

I am no great scripter. The trigger would require some thought and experimentation, but the code to be executed would be easy.

 

Code like this would reside in a script:

AAEnemy1.enable()		
AAEnemy2.enable()
AAEnemy3.enable()

 

This code for setting properties would also reside in the same script:

Actor Property AAEnemy1  Auto 
Actor Property AAEnemy2  Auto 
Actor Property AAEnemy3  Auto 

 

You would also have to go to the box and set the properties to these three things so that they pointed to the three hand-placed initially disabled actors.

 

But it sounds like you don't want all these enemies hanging around the camp all the time after they respawn. So you would also need to have code like this executing at the appropriate time of the week:

[code]AAEnemy1.disable()

 

Is there some event that happens before the attack does? Like is a certain quest set to a certain stage?

 

The ideal would be to have it be like Oblivion where the trigger would be the clock striking a certain hour on a certain day of the week. But this would require a Begin GameMode block. I am not sure what sort of trigger in Skyrim could be used to do a similar thing. I don't even think there is anything like Begin MenuMode which could be used to detect if you are not in GameMode. (Players tending to open their menus multiple times per day.)

 

Here is something that might be worth investigating: Event OnUpdateGameTime.

Maybe something could be rigged with Event OnPackageStart.

Edited by David Brasher
Link to comment
Share on other sites

Thanks again for the reply,

 

I think your assertions are pretty much correct. But just to outline a little more background information that may be helpful:

 

I've created a world space of Thermopylae, based on the movie, 300. At one end is Hell's gate and a Spartan and Arcadian camp. At about 6am every morning 8 Spartans and 8 Arcadians patrol from their camps to Hells gate. They arrive roughly at 6.30am, where they are then attacked by about 50 Persians.(50 felt like a decent number and I had intended to do a version for lower spec computers with half the amount of spawns)

 

The persians would maybe last an hour or two in game before they were all killed, which is why I had another patrol of persians sent from their camp to Hell's gate to attack the spartans and arcadians. I had about 7 patrols consisting of 50 persians each, running from their camp to Hell's gate about every hour or so.

 

This bombardment of persian NPCs along with the occasional general would last 3 days. I also had a night attack by Immortals and their Uber Immortal. On the forth day, Xerxes AI package would kick in, he leaves his throne accompanied by 50 immortals. There was also a sneak attack of 100 persians that went along a mountain path to take the Spartan and Arcadian camp from behind.

 

Sounds like a lot of NPC's but I did have it working well, partial due to the fact combat was spread out over a large area. I need to convert the esp to an esm to avoid the grey face bug from the ck. Which is where my problem started, my old crude method of running npcs in from an empty world stopped working.

 

I need a better approach. The patrols were an idea I had to make this achievable for myself, but that solution no longer seems to work for me.

 

Since I need so many NPCs perhaps there is a way to write a script such that, for a certain duration there are always X amount of YY NPC in an given area?

 

Maybe I need someone to do the scripting for me? As I have no experience in them.

*this is only my second mod, my first was a simple follower mod*

 

Again thank you for your help.

Link to comment
Share on other sites

The scripting isn't that hard, though it would really depend on exactly how you want it. If you want them to behave like during the civil war battles, you can just put a script on the actors like this:

 

Scriptname Example extends Actor

Event OnDeath(Actor akKiller)
Utility.Wait(10)
Reset()
EndEvent

 

That would make it so that the actors will respawn themselves 10 seconds after their death.

Link to comment
Share on other sites

Hey,

 

Thanks for the replies guys, and sorry for my late one - been busy the past few days.

 

The script from the civil war sounds like a good one to use. But rather than having the enemies perpetually respawn is there a way to condition in the tme of day? So they only do the respawn loop between 6am and 6pm?

 

Again thanks for the replies!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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