FishBiter Posted January 12, 2014 Share Posted January 12, 2014 (edited) I need to make a script count the number of actors in the current cell the player is in, and I am wondering if there is a command available for that. It would be really helpful if it could actually count the number of one specific type of actor. Basically something like this Set NumActors to (this is where the command would go) If NumActors < 6 Do thisElseIf NumActorse <= 6 Do NothingEndIf So basically the script would do one thing if there are more than 6 actors in the current cell, and something else if there's less. Again, it would be really helpful if it could count a specific type of actor (for example, radroaches). Edited January 12, 2014 by FishBiter Link to comment Share on other sites More sharing options...
rickerhk Posted January 12, 2014 Share Posted January 12, 2014 You can use http://fose.silverlock.org/fose_command_doc.html#GetNumRefs with a ref type of 200. Or you can use a touch spell for actors if you aren't using FOSE Link to comment Share on other sites More sharing options...
FishBiter Posted January 12, 2014 Author Share Posted January 12, 2014 So then GetNumRefs is what I need, but trying to use it I'm getting nothing. If GetNumRefs 43 >= 3Set SpawnIt to 0ElseSet SpawnIt to 1EndIf So I thought that that bit right there would set SpawnIt to 0 if there were 3 or more creatures in the current cell. That didn't happen though. Basically I'm trying to change the Zombie Apocalypse script so that it doesn't keep spawning zombies if there is a certain number of them in the current cell already. Link to comment Share on other sites More sharing options...
rickerhk Posted January 13, 2014 Share Posted January 13, 2014 Then I would use a quest script and a REFWalk for what you want to do. If there is more than one zombie type, put them in a form list. Otherwise you can just use GetIsID scn MyZombieControlQuestScript short iZombieCount ref rActorREF short iEnableSpawn ;Quest delay 1-3 seconds, start game enabled BEGIN GameMode Label 10 set iZombieCount to 0 set rActorREF to GetFirstREF 200 1 ;Actors, and if outside - current cell plus 8 surrounding cells Label 20 if (rActorREF) if (rActorREF.IsInList MyZombieActorFormList) ;Or just use rActorREF.GetIsID ZombieBaseEditorID if there is only one zombie type set iZombieCount to iZombieCount + 1 endif set rActorREF to Pencil01 set rActorREF to GetNextREF Goto 20 endif if (iZombieCount >= 50) set iEnableSpawn to 0 else set iEnableSpawn to 1 endif Goto 10 END Link to comment Share on other sites More sharing options...
FishBiter Posted January 13, 2014 Author Share Posted January 13, 2014 (edited) All right, so I implemented that script. Made the quest, the form list, and copy pasted your script right in. The only thing I changed was the last part, making iEnableSpawn into a Global so that I could call it in the other script that spawns the zombies. Now whenever I try to go into an exterior where there would be zombies, the game freezes. Edited January 13, 2014 by FishBiter Link to comment Share on other sites More sharing options...
rickerhk Posted January 13, 2014 Share Posted January 13, 2014 oops :facepalm:Get rid of the Label 10 and Goto 10 lines. Link to comment Share on other sites More sharing options...
Recommended Posts