Need a hand on a " cuff tying " mod

Post » Tue Jun 19, 2012 7:52 pm

I started working on a possibility for players to " cuff " NPC's, like the ones you can see on a dark brotherhood quest.

I managed to do a simple script :


Scriptname drkBound extends ObjectReference  Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)				If akOldContainer == Game.GetPlayer()				Debug.SendAnimationEvent(akNewContainer, "IdleBoundKneesStart")				EndIfEndEvent 

It works as intended, if the player " gives " to a NPC ( using pickpocket ) a new item called leather cuffs, the NPC will got in a bound animation. Sadly my skills are limited and i got some issues :

■ If the player starts attacking the cuffed NPC's, the animation will " break " and the NPC will attack the player. I've no idea how to fix this.
■ If the player have more than one cuff in his inventory, the script will not trigger. He must have no leather cuffs left in his inventory after giving a leather cuff to a NPC for the script to play, again no idea how to fix this.

:thanks:
User avatar
OnlyDumazzapplyhere
 
Posts: 3445
Joined: Wed Jan 24, 2007 12:43 am

Post » Tue Jun 19, 2012 9:40 pm

How about making the cuffs automatically equip themselves to the NPC (Give them an OnUpdate(1) so they're constantly checking to see if they're on an NPC, and if so, autoequip), and put the script on the OnEquipped event? Then it won't matter if the player has any or not.

You'll probably need to put the vicitms in a "CaptivesFaction" and set that faction to ignore attacks from the player.
User avatar
Elizabeth Davis
 
Posts: 3406
Joined: Sat Aug 18, 2007 10:30 am

Post » Tue Jun 19, 2012 10:41 pm

Hmmm, i'm still a newcomer will all this :blush: , i guess i understand some part of your suggestion, but not the entire thing.

Can you give me an exemple about your onupdate suggestion ?

I think a mod like this can bring a lot about interaction with NPC's and immersion in general. Non lethal options.
User avatar
Gracie Dugdale
 
Posts: 3397
Joined: Wed Jun 14, 2006 11:02 pm

Post » Wed Jun 20, 2012 2:20 am

OK, what it needs to do is keep track of where it is.


Scriptname drkBound extends ObjectReference  ObjectReference SavedContainerEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)	 If akOldContainer == Game.GetPlayer()		StoredContainer = akNewContainer		if StoredContainer ; If it actually went into a container	 	   RegisterForUpdate(5)		endif	 else		UnRegisterForUpdate()	 endifEndEventEvent OnUpdate()	if StoredContainer && StoredContainer != Game.GetPlayer()	   StoredContainer.EquipItem(Self,True) ; Makes him equip it, and prevents him from taking it off.	endifEndEventEvent OnEquip		 Debug.SendAnimationEvent(akNewContainer, "IdleBoundKneesStart")EndEventEvent OnCombatStateChanged(Actor akTarget, int aeCombatState)  if (akTarget == Game.GetPlayer())	if (aeCombatState == 0)	  Debug.Trace("We have left combat with the player!")	elseif (aeCombatState == 1)	  Debug.Trace("We have entered combat with the player!")	  Debug.SendAnimationEvent(akNewContainer, "IdleBoundKneesStart") ; reassert control, hopefully	elseif (aeCombatState == 2)	  Debug.Trace("We are searching for the player...")	endIf  endIfendEvent
User avatar
Ebou Suso
 
Posts: 3604
Joined: Thu May 03, 2007 5:28 am

Post » Wed Jun 20, 2012 4:53 am

Would the OnCombatStateChanged() actually run on the NPC if it's scripted to the cuffs? Why not just call SetRestrained() on the NPC when the cuffs are equipped?
User avatar
JD bernal
 
Posts: 3450
Joined: Sun Sep 02, 2007 8:10 am

Post » Tue Jun 19, 2012 8:40 pm

OK, what it needs to do is keep track of where it is.


Scriptname drkBound extends ObjectReference  ObjectReference SavedContainerEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)	 If akOldContainer == Game.GetPlayer()		StoredContainer = akNewContainer		if StoredContainer ; If it actually went into a container	 	   RegisterForUpdate(5)		endif	 else		UnRegisterForUpdate()	 endifEndEventEvent OnUpdate()	if StoredContainer && StoredContainer != Game.GetPlayer()	   StoredContainer.EquipItem(Self,True) ; Makes him equip it, and prevents him from taking it off.	endifEndEventEvent OnEquip		 Debug.SendAnimationEvent(akNewContainer, "IdleBoundKneesStart")EndEventEvent OnCombatStateChanged(Actor akTarget, int aeCombatState)  if (akTarget == Game.GetPlayer())	if (aeCombatState == 0)	  Debug.Trace("We have left combat with the player!")	elseif (aeCombatState == 1)	  Debug.Trace("We have entered combat with the player!")	  Debug.SendAnimationEvent(akNewContainer, "IdleBoundKneesStart") ; reassert control, hopefully	elseif (aeCombatState == 2)	  Debug.Trace("We are searching for the player...")	endIf  endIfendEvent

When trying to compile :

mismatched input '\\r\\n' expecting LPARENerror while attempting to read script drkBound reference of object is not finished
User avatar
ZANEY82
 
Posts: 3314
Joined: Mon Dec 18, 2006 3:10 am

Post » Wed Jun 20, 2012 1:05 am

you have neglected to supply the line number information on the error. It should tel lyou what line it's having trouble with.
User avatar
Becky Cox
 
Posts: 3389
Joined: Thu Jun 22, 2006 8:38 am

Post » Wed Jun 20, 2012 2:04 am

Woops, sorry. For some reason i got french in the compiler output.


(22,13): mismatched input '\\r\\n' expecting LPAREN(0,0): error while attempting to read script drkBound error while attempting to read script drkBound: La r?f?rence d'objet n'est pas d?finie … une instance d'un objet.
User avatar
Mrs. Patton
 
Posts: 3418
Joined: Fri Jan 26, 2007 8:00 am

Post » Tue Jun 19, 2012 10:07 pm

I can't see a missing left parentheses anywhere... Noted that you forgot to change akNewContainer to SavedContainer in OnEquip and OnCombatStateChanged events.

EDIT: Missing parameters in the OnEquip event.
EDIT2: ObjectReference was declared as SavedContainer, but you're actually using StoredContainer in the script.
User avatar
Michelle davies
 
Posts: 3509
Joined: Wed Sep 27, 2006 3:59 am

Post » Wed Jun 20, 2012 2:09 am

Ah, and I misspelled it too...it should be OnEquipped (Actor Equipper) and then apply the emote to the Equipper.
User avatar
..xX Vin Xx..
 
Posts: 3531
Joined: Sun Jun 18, 2006 6:33 pm

Post » Wed Jun 20, 2012 5:00 am

Still got compilations error.

Scriptname drkBound extends ObjectReference  ObjectReference SavedContainerEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)		 If akOldContainer == Game.GetPlayer()				SavedContainer = akNewContainer				if StoredContainer ; If it actually went into a container				   RegisterForUpdate(5)				endif		 else				UnRegisterForUpdate()		 endifEndEventEvent OnUpdate()		if SavedContainer && SavedContainer != Game.GetPlayer()		   SavedContainer.EquipItem(Self,True) ; Makes him equip it, and prevents him from taking it off.		endifEndEventEvent OnEquipped				 Debug.SendAnimationEvent(akNewContainer, "IdleBoundKneesStart")EndEventEvent OnCombatStateChanged(Actor akTarget, int aeCombatState)  if (akTarget == Game.GetPlayer())		if (aeCombatState == 0)		  Debug.Trace("We have left combat with the player!")		elseif (aeCombatState == 1)		  Debug.Trace("We have entered combat with the player!")		  Debug.SendAnimationEvent(akNewContainer, "IdleBoundKneesStart") ; reassert control, hopefully		elseif (aeCombatState == 2)		  Debug.Trace("We are searching for the player...")		endIf  endIfendEvent

I don't even know what i'm doing. I'm trying to decode at the same time, but with my actual skills it's like trying to solve a rubiks cube in the fog.
User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am

Post » Wed Jun 20, 2012 4:39 am

So replacing the OnEquip thing with

Event OnEquipped(Actor Equipper)  Debug.SendAnimationEvent(Equipper,"IdleBoundKneesStart")EndEvent

still gives the same error?
User avatar
Chloe Yarnall
 
Posts: 3461
Joined: Sun Oct 08, 2006 3:26 am

Post » Wed Jun 20, 2012 4:53 am

Not anymore, different ones this time :

(18,26): EquipItem is not a function or does not exist(32,35): variable akNewContainer is undefined
User avatar
Tai Scott
 
Posts: 3446
Joined: Sat Jan 20, 2007 6:58 pm

Post » Tue Jun 19, 2012 10:25 pm

First one: replace StoredContainer with (StoredContainer as Actor)
Second one: replace akNewContainer with StoredContainer
User avatar
Rude Gurl
 
Posts: 3425
Joined: Wed Aug 08, 2007 9:17 am

Post » Wed Jun 20, 2012 12:09 pm

edit : Nevermind, it worked.

Gonna give it a try. Anway, thank you very much Redwood.
User avatar
Jaylene Brower
 
Posts: 3347
Joined: Tue Aug 15, 2006 12:24 pm

Post » Wed Jun 20, 2012 2:12 am

Ok so it does nothing when i add the cuffs to an NPC inventory ( pickpocket ).

But it does something when i try to activate them via my inventory ( clicking on it ).

What.
User avatar
Sweets Sweets
 
Posts: 3339
Joined: Tue Jun 13, 2006 3:26 am

Post » Wed Jun 20, 2012 3:08 am

Oh...yah...you might want to make it so the player isn't affected by the force equip part...sorry...

There are threads around on how to have an item do things when they're put on...I haven't done much like this, but you could try having it force the emote, and then wait a second and hit the wearer with a paralyze spell effect...
User avatar
Kira! :)))
 
Posts: 3496
Joined: Fri Mar 02, 2007 1:07 pm

Post » Wed Jun 20, 2012 10:54 am

No problems. Thanks again.

Will give a try at all this tomorrow.

But i'm still thinking this scripting business is far too complicated for " smalls " mods like that.
User avatar
BlackaneseB
 
Posts: 3431
Joined: Sat Sep 23, 2006 1:21 am

Post » Tue Jun 19, 2012 10:39 pm

When you find a script that works, be sure to let us know! This has a lot of relevance to a future Idea I have! :)
User avatar
Deon Knight
 
Posts: 3363
Joined: Thu Sep 13, 2007 1:44 am


Return to V - Skyrim