Enemy Spawn Script

Post » Wed Feb 16, 2011 11:06 am

Does anyone have a good idea of how I could create a quest script that would spawn several enemies at an X Marker every 10 seconds? I'm not so good with timer scripts so any help I get will be much appreciated.

Thanks
User avatar
ILy- Forver
 
Posts: 3459
Joined: Sun Feb 04, 2007 3:18 am

Post » Wed Feb 16, 2011 1:54 am

float Timerfloat fQuestDelayTimeBegin GameMode	set fQuestDelayTime to .001	If Timer < 10		set Timer to ( Timer + GetSecondsPassed )	Else		;spawn enemies		set Timer to 0	EndIfEnd


For ;spawn enemies, this is where you either use moveto on persistent refs to place your enemies, or use placeatme to spawn new ones. If this script will only be running for a short period of time, such as part of a battle or something, then you would be best off placing your enemies in a dummy cell, making them persistent, and then using moveto to move them to your xmarker. If you plan on letting this run a long time, it might be better to use placeatme, and use deletereference to clean up the unneeded refs later. Search the CS Wiki for more info on that.
User avatar
carrie roche
 
Posts: 3527
Joined: Mon Jul 17, 2006 7:18 pm

Post » Tue Feb 15, 2011 9:13 pm

Thank you very much. That was a huge help!!
User avatar
kyle pinchen
 
Posts: 3475
Joined: Thu May 17, 2007 9:01 pm

Post » Wed Feb 16, 2011 8:52 am

Quite welcome. Good luck with your project! :)
User avatar
Roy Harris
 
Posts: 3463
Joined: Tue Sep 11, 2007 8:58 pm

Post » Wed Feb 16, 2011 7:12 am

If the script is not going to do anything else inbetween the spawning, it could be simplified quite much. No need for a timer then, just set fQuestDelayTime to 10, and the script will only run once every 10 seconds.

float fQuestDelayTimeBegin GameMode	set fQuestDelayTime to 10	;spawn enemiesEnd

User avatar
Penny Flame
 
Posts: 3336
Joined: Sat Aug 12, 2006 1:53 am

Post » Wed Feb 16, 2011 4:09 am

Hey, I never thought of that. Will doing it this way still allow it to start and stop with any precise timing? :blush:
User avatar
Bloomer
 
Posts: 3435
Joined: Sun May 27, 2007 9:23 pm

Post » Wed Feb 16, 2011 3:22 am

float Timerfloat fQuestDelayTimeBegin GameMode	set fQuestDelayTime to .001	If Timer < 10		set Timer to ( Timer + GetSecondsPassed )	Else		;spawn enemies		set Timer to 0	EndIfEnd


For ;spawn enemies, this is where you either use moveto on persistent refs to place your enemies, or use placeatme to spawn new ones. If this script will only be running for a short period of time, such as part of a battle or something, then you would be best off placing your enemies in a dummy cell, making them persistent, and then using moveto to move them to your xmarker. If you plan on letting this run a long time, it might be better to use placeatme, and use deletereference to clean up the unneeded refs later. Search the CS Wiki for more info on that.


The wiki says that with deletereference the reference can not be an actor. Would createfullactorcopy with deletefullactorcopy not work?
User avatar
celebrity
 
Posts: 3522
Joined: Mon Jul 02, 2007 12:53 pm

Post » Wed Feb 16, 2011 12:20 am

The wiki says that with deletereference the reference can not be an actor. Would createfullactorcopy with deletefullactorcopy not work?


Yes. Though, deletereference will work fine on creatures, and using it on an actor from the console seems to work fine (at least, it did last week). But yes, either way, the above will work for sure.
User avatar
Siobhan Thompson
 
Posts: 3443
Joined: Sun Nov 12, 2006 10:40 am

Post » Tue Feb 15, 2011 10:23 pm

Yes. Though, deletereference will work fine on creatures, and using it on an actor from the console seems to work fine (at least, it did last week). But yes, either way, the above will work for sure.


Well this is good to know. Does DeleteFullActorCopy take care of save game bloat the same way deletereference does?
User avatar
Laura Hicks
 
Posts: 3395
Joined: Wed Jun 06, 2007 9:21 am

Post » Wed Feb 16, 2011 9:48 am

Well this is good to know. Does DeleteFullActorCopy take care of save game bloat the same way deletereference does?


Aye.
User avatar
Fam Mughal
 
Posts: 3468
Joined: Sat May 26, 2007 3:18 am


Return to IV - Oblivion