Problem with spawning Script

Post » Thu Sep 30, 2010 11:19 am

So for my mod I want the enemy to constantly keep spawning as long as they are in the trigger. Here's what I got so far:

begin onTriggerEnter

if GetDeadCount CrFeralGhoul1A > 10
PlaceAtMe CrFeralGhoul1A 15, 10, 1

Endif

if GetDeadCount CrFeralGhoul2A > 10
PlaceAtMe CrFeralGhoul2A 12, 10, 1

Endif


End


Long story short its not working.They are supposed to spawn 12 for every 10 killed but when in-game its not working
User avatar
James Wilson
 
Posts: 3457
Joined: Mon Nov 12, 2007 12:51 pm

Post » Thu Sep 30, 2010 3:32 pm

Well, for starters, that will only run once when the player 'enters' the trigger zone.
Second, the number of ghouls dead must 'already' be greater than 10 before '1' will be spawned of each type.
User avatar
Rhiannon Jones
 
Posts: 3423
Joined: Thu Sep 21, 2006 3:18 pm

Post » Fri Oct 01, 2010 2:06 am

Well, for starters, that will only run once when the player 'enters' the trigger zone.
Second, the number of ghouls dead must 'already' be greater than 10 before '1' will be spawned of each type.


I want it to start once I enter the trigger zone be keep running while in the trigger. Should I use onTrigger instead?
User avatar
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm

Post » Thu Sep 30, 2010 7:34 pm

Perhaps somethimg more like this. I did not test it and cannot claim it will work perfectly since I just scratched it out.
Your always welcome to come back with questions or issues.

And remember, the game can only control so many AI. If you get too many in the cell, eventually they will just 'stand' around not doing anything until an AI slot opens up for them.


scn mySpawnerScriptfloat timershort myD1Ashort myD1short myD2begin OnTriggerEnter	set myD1A to GetDeadCount CrFeralGhoul1Aendbegin OnTrigger	if IsActionRef player == 1		if timer >= 0			set timer to timer - GetSecondsPassed			return		else			set myD1 to GetDeadCount CrFeralGhoul1A			set myD2 to myD1A + 10			if myD1 > myD2				set timer to 10				PlaceAtMe CrFeralGhoul2A 12, 10, 1				set myD1A to GetDeadCount CrFeralGhoul1A			endif		endif	endifend

User avatar
Rachell Katherine
 
Posts: 3380
Joined: Wed Oct 11, 2006 5:21 pm

Post » Thu Sep 30, 2010 2:10 pm

Thanks im will give the script a try
right now i have begin onDeath

if GetDeadCount CrFeralGhoul1A == 1
Placeatme CrFeralGhoul1A 1
endif

end
but it is failing also
User avatar
Eve Booker
 
Posts: 3300
Joined: Thu Jul 20, 2006 7:53 pm

Post » Thu Sep 30, 2010 7:48 pm

Perhaps somethimg more like this. I did not test it and cannot claim it will work perfectly since I just scratched it out.
Your always welcome to come back with questions or issues.

And remember, the game can only control so many AI. If you get too many in the cell, eventually they will just 'stand' around not doing anything until an AI slot opens up for them.


scn mySpawnerScriptfloat timershort myD1Ashort myD1short myD2begin OnTriggerEnter	set myD1A to GetDeadCount CrFeralGhoul1Aendbegin OnTrigger	if IsActionRef player == 1		if timer >= 0			set timer to timer - GetSecondsPassed			return		else			set myD1 to GetDeadCount CrFeralGhoul1A			set myD2 to myD1A + 10			if myD1 > myD2				set timer to 10				PlaceAtMe CrFeralGhoul2A 12, 10, 1				set myD1A to GetDeadCount CrFeralGhoul1A			endif		endif	endifend


seems to not be working,but i make have a workaround based on ur script
User avatar
Claire Mclaughlin
 
Posts: 3361
Joined: Mon Jul 31, 2006 6:55 am

Post » Thu Sep 30, 2010 9:22 pm

if GetDeadCount CrFeralGhoul1A == 1
Placeatme CrFeralGhoul1A 1
endif

end
but it is failing also


It does not work because I highly doubt that you have only killed one CrFeralGhoul1A in the whole game.

As for my script above, what did you attach the script to and how did you place it in the world?
User avatar
james tait
 
Posts: 3385
Joined: Fri Jun 22, 2007 6:26 pm

Post » Thu Sep 30, 2010 12:07 pm

It does not work because I highly doubt that you have only killed one CrFeralGhoul1A in the whole game.

As for my script above, what did you attach the script to and how did you place it in the world?


I first attached the script to the trigger, then I modifed it to be attached to the ghoul using "on Death"(or something similar)
I actually started the game from the very beginning to test whether the ghouls that were added to the deadcount werent the ones i already killed.
goin to try to see if I can get a deadcount from a specific cell instead of a global deadcount
User avatar
Tyrone Haywood
 
Posts: 3472
Joined: Sun Apr 29, 2007 7:10 am

Post » Fri Oct 01, 2010 2:54 am

Is this a special area that can have special ghouls? If so you can make your own copy of the ghouls and attach a counter script to them.

Like so: Make a global variable called something like myGhoul01CounterGBL
scn myDeathScriptshort doOncebegin OnDeath   if doOnce == 0      set doOnce to 1      set myGhoul01CounterGBL to myGhoul01CounterGBL + 1   endifend


You can then use the global variable myGhoul01CounterGBL to keep track of how many have been killed. And since its a global variable, it can be used in any script or quest to check the count. It can even be displayed in messages.
User avatar
lillian luna
 
Posts: 3432
Joined: Thu Aug 31, 2006 9:43 pm


Return to Fallout 3