Random Spawns

Post » Mon Nov 29, 2010 12:32 pm

How would I go about spawning NPC's at a certain object. Lets say a chair at random times and random amount of NPC's....?

It would be grat if someone could write me up a script for this. Im not to flash at it you see.

Cheers.
User avatar
Leticia Hernandez
 
Posts: 3426
Joined: Tue Oct 23, 2007 9:46 am

Post » Mon Nov 29, 2010 3:08 pm

Here is a related script. It may be a bit cryptic to understand, but basically, it spawns up to 12 total NPCs with no more than 5 on the map at a time. When one is killed, a new one will be spawned until the max of 12 has been reached. The script runs on a trigger and uses variables setup in a quest and the spawned NPCs have scripts that update the max number of spawns and the number that are on the map at any given time when they are killed.


scn UCACERunTrigger1ScriptShort StartupShort TaskShort MaxFloat TimerBegin OnTriggerEnter Player	If Startup == 0 && SergeantScrapsRef.ScrapsTask == 2		Set Startup to 1		Set UCMain.BaseSynths to 0	EndIfEndBegin GameMode	If (Startup)		If Timer > 0			Set Timer to Timer - GetSecondsPassed		ElseIf Max > 12			Set Task to 3		ElseIf Task == 0			UCACEScrapsXM.placeatme UCACESynthPKGGHF 1			Set UCMain.BaseSynths to UCMain.BaseSynths + 1			Set Max to Max + 1			Set Timer to 0.5			Set Task to 1		ElseIf Task == 1			UCACEScrapsXM.placeatme UCACESynthPKGGHM 1			Set UCMain.BaseSynths to UCMain.BaseSynths + 1			Set Max to Max + 1			Set Task to 2		ElseIf UCMain.BaseSynths < 5 && Task == 2			UCACEPKGGXM1.placeatme UCACESynthPKGGHF 1			UCACEPKGGXM2.placeatme UCACESynthPKGGHM 1			Set UCMain.BaseSynths to UCMain.BaseSynths + 2			Set Max to Max + 2			Set Timer to 2		ElseIf Task == 3			Set Startup to 2			RemoveMe		Endif	EndifEnd

User avatar
Annika Marziniak
 
Posts: 3416
Joined: Wed Apr 18, 2007 6:22 am


Return to Fallout 3