Jump to content

Script Help


senterpat

Recommended Posts

Hello, I'm making resurrecting ghouls for my mod, inspired by mmm. Meaning they limbs can get blown off and they "resurrect" ie place a armless model and disable the original. I would like to be able to transfer the items and scale (as the scales are semi randomized) of the ghoul to the resurrected version. I can do all that , but I don't know how to set up the newly spawned ghoul as the script reference. Any ideas?

Link to comment
Share on other sites

Maybe I'm not reading it correctly, but essentially you just want to change the implied ref (a script on a critter) to a new reference (the spawned ghoul) right? You could just use a ref var (targetREF) instead of the implied reference (use getSelf to fill it), then when your ready to switch it over to the spawned ghoul use set (set targetREF to mySpawnedGhoulREF). But why not just use a second script on the spawned ghoul instead of changing references. Or am I misunderstanding the question?

Link to comment
Share on other sites

Well I have about 80 variants of ghouls, clothed, female, texture variants, etc, and when they die they can be respawned with 1 of 4 possibilities, depending on if they have anything dismembered, there is the basic 2 armed ones, then a no left or right version, and a no arm version, so if you killed them by shooting off an arm, they can still get back up. But I want the inventory and size to remain the same.

 

Honestly, I'm not sure if I'm going about the script in the best possible way.

SCN SUPERGhoulRaiseDeadScript

short pDead ;use to track whether or not to raise
short pScale ;use to save size
ref sRef ; use to target new ghoul
ref itemType
int ammountOfItems
ref itemType2
int ammountOfItems2
ref itemType3
int ammountOfItems3

begin onDeath

if getDead == 0 && pdead == 0
	if islimbgone 7 == 0 && islimbgone 10 == 0 && islimbgone 1 == 0 ;check if they have head and legs still
		set pScale to GetScale
		set itemType to player.GetInventoryObject 1 ; Copy any items that haven't been looted.
		set ammountOfItems to GetItemCount itemType
		set itemType2 to player.GetInventoryObject 2
		set ammountOfItems2 to GetItemCount itemType2
		set itemType3 to player.GetInventoryObject 3
		set ammountOfItems3 to GetItemCount itemType3
					if player.getLOS me == 0 ; make sure player doesn't see the ghoul pop in
							if islimbgone 3 == 0 && islimbgone 5 == 0  ;still has arms
								placeatme MyGhoul; The new ghoul I want to set as the ref
								set sRef to GhoulSpawnRef ; this command is just filler right now
								sRef.additem itemtype amountofitems
								sRef.additem itemtype2 amountofitems2
								sRef.additem itemtype3 amountofitems3
								sRef.setScale pScale
							elseif islimbgone 3== 1 && islimbgone 5 == 0 ; no left arm
								placeatme MyGhoulNL; The new ghoul I want to set as the ref
								set sRef to GhoulSpawnRef ; this command is just filler right now
								sRef.additem itemtype amountofitems
								sRef.additem itemtype2 amountofitems2
								sRef.additem itemtype3 amountofitems3
								sRef.setScale pScale
							elseif islimbgone 3== 0 && islimbgone 5 == 1 ; no right arm
								placeatme MyGhoulNR ; The new ghoul I want to set as the ref
								set sRef to GhoulSpawnRef ; this command is just filler right now
								sRef.additem itemtype amountofitems
								sRef.additem itemtype2 amountofitems2
								sRef.additem itemtype3 amountofitems3
								sRef.setScale pScale
							elseif islimbgone 3== 1 && islimbgone 5 == 1 ; no arms
								placeatme MyGhoulNA ; The new ghoul I want to set as the ref
								set sRef to GhoulSpawnRef ; this command is just filler right now
								sRef.additem itemtype amountofitems
								sRef.additem itemtype2 amountofitems2
								sRef.additem itemtype3 amountofitems3
								sRef.setScale pScale
							endif
					endif 
			
		
	else
		set pDead to 1
	endif
endif

end
Link to comment
Share on other sites

  • Recently Browsing   0 members

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