Jump to content

[Help] IsDead does not exist?


GomuGomu64

Recommended Posts

I've been working on a script that spawns an NPC (Which NPC depends on a number that is generated when the cell loads) when an NPC is dead (In this case, Jenassa in the Drunken Huntsman).

Problem is, the way I'm trying to tell if Jenassa is dead or not, is by using Actor.IsDead(). When I put this in my script, however, I get the following error:

 

AAAMercenarySpawnScriptDRUNKENhuntsman.psc(18,38): IsDead is not a function or does not exist

 

Which is weird. Because it does exist. What am I doing wrong? Is there another way to tell if an Actor is dead or not?

 

Here's my script if it makes any difference :

 

Scriptname AAAMercenarySpawnScriptDRUNKENhuntsman extends ObjectReference

ObjectReference Property MercenarySpawner  Auto

ObjectReference Property Jenassa  Auto    

ObjectReference Property Merc1  Auto 

ObjectReference Property Merc2  Auto 

ObjectReference Property Merc3  Auto 

ObjectReference Property Merc4  Auto 

ObjectReference Property Merc5  Auto   

Event OnCellLoad()
bool JenassaIsDeadMercSpawn = Jenassa.IsDead()
if JenassaIsDeadMercSpawn == True
	int random = Utility.RandomInt(1, 5)
		if random == 1
			MercenarySpawner.PlaceAtMe(Merc1)
		elseif random == 2
			MercenarySpawner.PlaceAtMe(Merc2)
		elseif random == 3
			MercenarySpawner.PlaceAtMe(Merc3)
		elseif random == 4
			MercenarySpawner.PlaceAtMe(Merc4)
		elseif random == 5
			MercenarySpawner.PlaceAtMe(Merc5)
	endif
endif
endEvent

 

I've got the properties sorted out and stuff. The script is attached to an XMarker in the drunken huntsman.

Link to comment
Share on other sites

GetDead? I'm not at an editor but I remember the console condition is GetDead not IsDead.

 

Found one of my scripts...Your problem is that you're using Jenassa as an ObjectReference. IsDead is a function on the Actor script. Cast?

 

-MM

Edited by MofoMojo
Link to comment
Share on other sites

GetDead? I'm not at an editor but I remember the console condition is GetDead not IsDead.

 

Found one of my scripts...Your problem is that you're using Jenassa as an ObjectReference. IsDead is a function on the Actor script. Cast?

 

-MM

 

Then I got this :

 

GetDead is not a property on script objectreference or one of its parents

 

I think GetDead only works in the console.

 

Edit: Funky. Never knew the Reply Editor updated in real time 0_o

 

Seems to have worked when I changed :

 

ObjectReference Property Jenassa  Auto  

To

Actor Property Jenassa  Auto      

 

I'll give it a shot in-game. Thanks mate.

Edited by GomuGomu64
Link to comment
Share on other sites

GetDead? I'm not at an editor but I remember the console condition is GetDead not IsDead.

 

Found one of my scripts...Your problem is that you're using Jenassa as an ObjectReference. IsDead is a function on the Actor script. Cast?

 

-MM

 

Then I got this :

 

GetDead is not a property on script objectreference or one of its parents

 

I think GetDead only works in the console.

 

Yup. See my edit. :) You need to call IsDead from the Actor. You have Jenassa defined as an ObjectReference, not an Actor.

 

-MM

Link to comment
Share on other sites

Wicked, it compiles. Thanks for that.

 

Buuuut now that I can play with my mod activated, my script doesn't spawn any NPCs. I tried changing the ObjectReference for the Merc1, Merc2 (Etc) to Actor references, no difference.

 

Going to add a few debug message boxes in the script to see where it's crapping out.

 

Edit: Weird. The script is fine. I put messages all over the script, namely to after an NPC is spawned. Its as if it "Spawns" the NPC, but it doesn't appear. Not even in wireframe mode.

 

I've got the NPCs I'm tying to spawn copies of in a cell, inside a box. The script is referenced correctly so it should be accessing the BaseID of the NPC I made.

 

Humm. Perhaps I'm doing something wrong?

Edited by GomuGomu64
Link to comment
Share on other sites

Wicked, it compiles. Thanks for that.

 

Buuuut now that I can play with my mod activated, my script doesn't spawn any NPCs. I tried changing the ObjectReference for the Merc1, Merc2 (Etc) to Actor references, no difference.

 

Going to add a few debug message boxes in the script to see where it's crapping out.

 

Edit: Weird. The script is fine. I put messages all over the script, namely to after an NPC is spawned. Its as if it "Spawns" the NPC, but it doesn't appear. Not even in wireframe mode.

 

I've got the NPCs I'm tying to spawn copies of in a cell, inside a box. The script is referenced correctly so it should be accessing the BaseID of the NPC I made.

 

Humm. Perhaps I'm doing something wrong?

 

If this is a one-time event you might just want to do a MoveTo and move them from that cell to this cell, otherwise (and perhaps best) you might want to create a quest and have these as aliases that can be filled by the quest script and have the quest place the appropriate NPCs at a marker location. You could probably get a lot of this done without scripting actually if you used a quest and aliases because you can conditionalize which NPCs should have their aliases filled in the quest. I'm no quest expert, so I'll stop there.

 

-MM

Link to comment
Share on other sites

Your right 'bout the quest thing, 'Tis just I haven't delved in quests, so I'm unfamiliar with 'em.

 

Eh. Time to learn how to use 'em.

 

Thanks for your help.

 

 

Edit : Eugh. The quest interface is awful. I am going to disagree on your belief that a Quest is best for this thing :P

 

Anyone have an idea on why my NPCs are not spawning? The script says they are, but they don't appear.

 

2nd Edit : AHA! Got it!

 

When your going to spawn an NPC, get the property you'll be using, make it an actor, go into your script, and change the property from "Actor" to "Actorbase", go back to your property list, edit the spawning NPC's property to which NPC your going to spawn.

 

You can take a look at the changes here :

 

Scriptname AAAMercenarySpawnScriptDRUNKENhuntsman extends ObjectReference

ObjectReference Property MercenarySpawner  Auto

Actor Property Jenassa  Auto    

Actorbase Property Merc1  Auto 

Actorbase Property Merc2  Auto 

Actorbase Property Merc3  Auto 

Actorbase Property Merc4  Auto 

Actorbase Property Merc5  Auto   

Event OnCellLoad()
bool JenassaIsDeadMercSpawn = Jenassa.IsDead()
if JenassaIsDeadMercSpawn == True
	Debug.MessageBox("Jenassa is dead")
	int random = Utility.RandomInt(1, 5)
	Debug.MessageBox("Random int generated ")
		if random == 1
			MercenarySpawner.PlaceActorAtMe(Merc1)
			Debug.MessageBox("Merc1 Spawned")
		elseif random == 2
			MercenarySpawner.PlaceActorAtMe(Merc2)
			Debug.MessageBox("Merc2 Spawned")
		elseif random == 3
			MercenarySpawner.PlaceActorAtMe(Merc3)
			Debug.MessageBox("Merc3 Spawned")
		elseif random == 4
			MercenarySpawner.PlaceActorAtMe(Merc4)
			Debug.MessageBox("Merc4 Spawned")
		elseif random == 5
			MercenarySpawner.PlaceActorAtMe(Merc5)
			Debug.MessageBox("Merc5 Spawned")
	endif
endif
endEvent

Edited by GomuGomu64
Link to comment
Share on other sites

  • Recently Browsing   0 members

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