Jump to content

How do I run kill command all variants of zombies in a script?


PapaLegaBooboo

Recommended Posts

You need to scan the surroundings for creatures, then check if it is a zombie by checking its ID or checking the mesh, which might be fastest I guess. Do you want to use a spell or a quest script? Maybe I should rather ask: What exactly is it you wanna do? Why do you wanna get all zombies killed with a single script? Then it will get easier to form the script.

 

When it comes to meshes, only one is used as far as I can see but it is used by approx 50 ID's in vanilla Oblivion.esm so I think it is best to check for the mesh: creatures\zombie\skeleton.nif as it seems to be used by all types of zombies.

Link to comment
Share on other sites

You need to scan the surroundings for creatures, then check if it is a zombie by checking its ID or checking the mesh, which might be fastest I guess. Do you want to use a spell or a quest script? Maybe I should rather ask: What exactly is it you wanna do? Why do you wanna get all zombies killed with a single script? Then it will get easier to form the script.

 

When it comes to meshes, only one is used as far as I can see but it is used by approx 50 ID's in vanilla Oblivion.esm so I think it is best to check for the mesh: creatures\zombie\skeleton.nif as it seems to be used by all types of zombies.

 

I'm just trying to figure out how to run something on a certain demographic of creatures without having to write out their formID's or whatever you call it. So I presume that I can't use an object script?

 

EDIT: Also, what is an ActorID? I keep seeing this on the wiki, but all I'm familiar with is the formId & the editorID.

Edited by PapaLegaBooboo
Link to comment
Share on other sites

The formID is an unique ID that hold the base of an object and it is those you see on the left side in CS and it is called Base ID.

 

What you see on the right side, inside the Render WIndow or in game is references and what a reference is, well it is a place holder for the Object, with coordinates and some other properties and you can have an infinite number of references that points to a single FormID. The FormID do not have coordinates and the properties that the reference has so see the reference as a box that holds a copy of the FormID or editorID.

 

An object script must be attached to an object which a spell or a quest script does not need to be but all 3 types of scripts must be attached to something and cannot run free.

  • Object Scripts must be attached to an object
  • Magic Effects must be attached to a spell and gets activated when the spell is launched and stops after the timer for the spell runs out
  • Quest scripts must be attached to a quest

Quest scripts have many advantages as they can be run anywhere, any time and you decide how many times they run each second or maybe 1 time every 10 second? Standard is that they run every 5th second but can be set to run every frame as well as it all depends on the purpose with the script and it can do anything really that an object script can. I made several quest scripts that do stuff in the background, like checking my home made jaggy companion or whatever.

 

What type of demographic? A cell? You mean zombies? Well they all share the same skeleton, so that is what we can check but I need more info first of what exact you wanna do before I type any code or even guess what it is exactly you want to do.

Edited by Pellape
Link to comment
Share on other sites

The formID is an unique ID that hold the base of an object and it is those you see on the left side in CS and it is called Base ID.

 

What you see on the right side, inside the Render WIndow or in game is references and what a reference is, well it is a place holder for the Object, with coordinates and some other properties and you can have an infinite number of references that points to a single FormID. The FormID do not have coordinates and the properties that the reference has so see the reference as a box that holds a copy of the FormID or editorID.

 

An object script must be attached to an object which a spell or a quest script does not need to be but all 3 types of scripts must be attached to something and cannot run free.

  • Object Scripts must be attached to an object
  • Magic Effects must be attached to a spell and gets activated when the spell is launched and stops after the timer for the spell runs out
  • Quest scripts must be attached to a quest

Quest scripts have many advantages as they can be run anywhere, any time and you decide how many times they run each second or maybe 1 time every 10 second? Standard is that they run every 5th second but can be set to run every frame as well as it all depends on the purpose with the script and it can do anything really that an object script can. I made several quest scripts that do stuff in the background, like checking my home made jaggy companion or whatever.

 

What type of demographic? A cell? You mean zombies? Well they all share the same skeleton, so that is what we can check but I need more info first of what exact you wanna do before I type any code or even guess what it is exactly you want to do.

 

Thanks for clarifying what each type of script does. Never knew that.

 

Scratch the kill command, lets display a message saying 'hello' after a zombie dies. it could be any type of zombie including mod added ones.

Edited by PapaLegaBooboo
Link to comment
Share on other sites

Well how do you wanna have them killed then? Just per auto or do you wanna fire a spell that is what I wanna know now?

 

It sounds like you wanna have them killed per auto so then we need a quest. Make one, call it PLBKillAllZOmbiesQST so the name gets unique. PLB as in the initials in your name and end it with QST so we know it is the quest. The questscript that we later attach to the quest should be called PLBKillAllZOmbiesQSTSCR so it is clear that it is a Quest Script. I think a 2 second timer should be enough to search for them. I cannot claim this will work to 100% but we try and see where we end up.

Link to comment
Share on other sites

Well a spell is easier to use as you will always have access to it, if you do not plan to always use that sword but you must decide, spell or a sword? The script I had in mind would kill every zombie in the whole cell you are in as that is what you wanna do right?

 

Do you wanna be able to loot the bodies or shall we make the bodies to disappearn after they died?

 

Start to make a spell in CS and call it PLBKillAllZombiesSPL

Link to comment
Share on other sites

Now we need to attach a script, called PLBKillAllZombiesSPLSCR

 

Comments of what each line does, is added after the ;

scn PLBKillAllZombiesSPLSCR

string_var Path
string_var CompPatch

Ref TargetREF

Begin ScriptEffectStart

        Let CompPatch := "Creatures\Zombie\Skeleton.nif"                ;set the mesh path to the zombies to start with

	Set TargetREF to GetFirstRef 36 1 				;Scans for the first creature in the current cell
	
	While ( TargetREF )  						;as long as there are creatures available
		Let Path := GetModelPath  TargetREF 		        ;Set the mesh path of the current creature
		
		If eval ( Path == CompPatch ) 				;Check if the target is a Zombie
				If ( TargetREF.GetDead == 0 ) 		;Check if target is alive
					Kill TargetREF			;Kill the Zombie
				EndIf
			EndIf
		EndIf
		
		Set TargetREF to GetNextRef				;Get the next creature
	Loop
	
	sv_Destruct Path						;Prevent Save Bloats
	sv_Destruct CompPath						;Prevent Save Bloats
	
End


Begin ScriptEffectFinish

	Dispel PLBKillAllZombiesSPL					;Dispel the spell

End

It is very important to destroy the strings after they are used, or they will bloat the obse save file, which is a bug in the ConSave command.

 

Do you know where to add the script in the spell you made?

 

Set Spelltimer to 1s as otherwise the spell will not work at all. 1s is the smallest time a spell can have but they have 0s as default. Set the spell to self, as you do not need a target and give it a destruction effect and make it Destruction Novice or whatever your current Destrruction is at. :wink:

Edited by Pellape
Link to comment
Share on other sites

  • Recently Browsing   0 members

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