Jump to content

Recommended Posts

Posted (edited)

Hello, I have fun just messing around with scripts on skyrim's creation kit and apply certain aspects to my own mods

sometimes. But I was delving into some Skyrim exploits and wondered how I can do the following script

 

A script where Actor 1 is alive and well, but if actor 2 begins using an object, after a select amount of time

actor 1 will die. However, is actor 2 stops using the object, actor 1 will be fine as the script would cancel itself out.

 

So I guess the simplest way to ask would be:

How would I make a script that kills an actor

after a select time when in use? And when

its no longer in use- the script cancels.

Edited by Kurzusseus
Posted

You'd have to tell me what object is being activated. If it's like a door, then I'm not sure how to do it since it only takes a second (or far, far less) to activate the door. However, if it's something with a trigger around it like a pressure plate, then I can show you a script.

Posted (edited)

Okay. Let's say it's a chair. Here's the script:

Scriptname MyKillActor1Script Extends Actor
{Attach this to Actor2}

Actor Property Actor1 Auto; be sure to fill this
ObjectReference Property MyChair Auto; be sure to fill this

Event OnSit(ObjectReference akFurniture)

     If akFurniture == MyChair

          Utility.Wait(5.0); replace 5.0 with your number of choice
          
          If Self.GetSitState() == 3||4; if actor2 is still sitting

               Actor1.Kill()

          EndIf

     EndIf

EndEvent

If that doesn't work, you could try the following, though it's a bit convoluted:

Scriptname MyKillActor1Script Extends Actor
{Attach this to Actor2}

Actor Property Actor1 Auto; be sure to fill this
ObjectReference Property MyChair Auto; be sure to fill this
Int SitTime = 0

Event OnSit(ObjectReference akFurniture)

     If akFurniture == MyChair

          While SitTime < 5 && Self.GetSitState() == 3||4; replace 5 with how long actor          ;2 must be sitting before actor1s death

             Utility.Wait(1.0)
             SitTime += 1

          EndWhile

          If SitTime == 5; replace 5 with the number you used above

             Actor1.Kill();kill actor1

          EndIf

          If Self.GetSitState() != 3||4; if actor2 is no longer sitting

             SitTime = 0; restart the SitTimer

          EndIf

     EndIf

EndEvent
Edited by Matthiaswagg
Posted

The first script kills him, but when the actor2 is no longer on the chair- he still dies anyway.

I tried messing around with it myself adding a bool completed = false and completed stage

but It just made him die the second the chair was activated.

 

Script 2 doesn't work at all.

Posted

OK. This one should work. Also, the script I gave you earlier (Script 1) - I'm surprised it even worked. I made a stupid mistake leaving out an EndIf.

Scriptname MyKillActor1Script Extends Actor
{Attach this to Actor2}

Actor Property Actor1 Auto; fill this property
ObjectReference Property MyChair Auto; fill this property
Int SitTime = 0

Event OnSit(ObjectReference akFurniture)

	If akFurniture == MyChair

		While SitTime < 5 && Self.GetSitState() == 3||4; replace 5 with number of choice
			
			Utility.Wait(1.0)
			SitTime += 1
				
		EndWhile
			
		If SitTime = 5
			
			Actor1.Kill()
			SitTime += 1
				
		EndIf
			
	EndIf
		
EndEvent

Event OnGetUp(ObjectReference akFurniture)

	If akFurniture == MyChair && SitTime < 5
	
		SitTime = 0
		
	EndIf
	
EndEvent
Posted

ok finally got around to testing it. Now he wont die, plus I had to fix the time variable output. You had it set as

SitTime = 5 not SitTime == 5. I have to say I thought this would be much more simpler lol

 

I'll continue to mess around with the script and see if I can get it to work, unless you want to give it

another go. Thanks for helping.

Posted

ok finally got around to testing it. Now he wont die, plus I had to fix the time variable output. You had it set as

SitTime = 5 not SitTime == 5. I have to say I thought this would be much more simpler lol

 

I'll continue to mess around with the script and see if I can get it to work, unless you want to give it

another go. Thanks for helping.

 

Try adding a Debug.Notification in between If SitTime == 5 and Actor1.Kill() to check if that is ever being received.

Posted

Ok, back again to help. Me and my faulty scripts. This one should work though, and I mean it this time.

 

Scriptname MyKillAct1Script Extends Actor
{Poor Actor 1}

Actor Property Actor1 Auto
ObjectReference Property MyChair Auto
Int SitTime = 0

Event OnSit(ObjectReference AkFurniture)

     If AkFurniture == MyChair

          RegisterForUpdate(1.0)

     EndIf

EndEvent

Event OnUpdate()

     While SitTime < 5;replace 5 with number of choice

          SitTime += 1
          RegisterForSingleUpdate(1.0)

     EndWhile

     If SitTime >= 5;replace 5 with your numbers

          UnregisterForUpdate()
          Actor1.Kill()

     EndIf

EndEvent

Event OnGetUp(ObjectReference AkFurniture)

     If AkFurniture == MyChair

          If SitTime < 5

               UnregisterForUpdate()
               SitTime = 0

         EndIf

     EndIf

EndEvent
I haven't tested it yet but it should work. Get back to me once you've tested it.
  • Recently Browsing   0 members

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