Delzaron Posted October 20, 2016 Posted October 20, 2016 Hi I use that script for play animations on player (for example, player in milkpump) event OnSit(ObjectReference akFurniture) if akFurniture.HasKeyword(zbfFurnitureMilkOMatic) PlayerRef.SetExpressionOverride(9) PlayerRef.EquipItem(ZaZMoMSuctionCups01,true) Debug.SendAnimationEvent(PlayerRef,"ZaZMOMBoundFurn_13") endifendeventevent OnGetup(ObjectReference akFurniture) if akFurniture.HasKeyword(zbfFurnitureMilkOMatic) PlayerRef.ClearExpressionOverride() PlayerRef.UnEquipItem(ZaZMoMSuctionCups01) PlayerRef.removeItem(ZaZMoMSuctionCups01) endifendeventKeyword property zbfFurnitureMilkOMatic autoArmor property ZaZMoMSuctionCups01 autoactor property playerref auto But I wish to adapt this script for non specific NPCs... How I can do that ? Thanks in advance.
Hæretic Posted October 20, 2016 Posted October 20, 2016 I would use the OnActivate event in a script attached to the furniture itself. The actor who activates the furniture will be passed to the event.
Delzaron Posted October 20, 2016 Author Posted October 20, 2016 I would use the OnActivate event in a script attached to the furniture itself. The actor who activates the furniture will be passed to the event. Yes, but hiow to write something like "actor.SetExpressionOverride(9)" and blablabla ?
Guest Posted October 20, 2016 Posted October 20, 2016 Clean way: Add a ReferenceAlias, and attach your scripts to the refalias. Then add a script to the furniture, and catch the OnActivate event. You will get the actor as parameter, and you can force the alias to the actor when the OnActivate is done. And then, inside the alias, the OnGetUp will fire too, and you can remove the actor from the alias.
Hæretic Posted October 20, 2016 Posted October 20, 2016 Event OnActivate(ObjectReference akActivator) Actor akActor = akActivator As Actor If akActor akActor.SetExpressionOverride(9) EndIf EndEvent Clean way: Add a ReferenceAlias, and attach your scripts to the refalias. Then add a script to the furniture, and catch the OnActivate event. You will get the actor as parameter, and you can force the alias to the actor when the OnActivate is done. And then, inside the alias, the OnGetUp will fire too, and you can remove the actor from the alias. Using an alias requires a quest. Doesn't that mean it can only be used as long as the alias is not used by another furniture with the same script?
Guest Posted October 20, 2016 Posted October 20, 2016 Using an alias requires a quest. Doesn't that mean it can only be used as long as the alias is not used by another furniture with the same script? Yes and no. If the OnActivate event is attached to specific ObjectReferences, then you can have the Alias as Property of the script of the ObjectReference, so the map between ObjRefs and Alias will be one to one. Or, in case you attach the script to the base object (usually I don't like doing that, but is a possibility), then you may want to create (inside a Quest) a controller function, an array of aliases and an array of "used aliases", then the controller function you will grab the first not used alias and set it to the actor. And you will release the alias with another function in the quest script.
Delzaron Posted October 20, 2016 Author Posted October 20, 2016 I will test heretic option. The script was compiled with suceed. I will implement also that in TID (Inn basement milk pumps)
Hæretic Posted October 20, 2016 Posted October 20, 2016 Cpu is right about that the clean way is to store the actor as a reference alias to remove the effects by leaving the furniture. Maybe this could also be achieved with storing the actor inside the script and letting it go with the next activation while blocking other actors from entering. Using reference aliases might be a bit clunky just to release an actor but it also might be the safest way.
Delzaron Posted October 20, 2016 Author Posted October 20, 2016 Yes... I tested your solution, and it doesn't work. I guess the script dont suceed to recognize and attribute the effet to the NPCs. event OnSit(ObjectReference akFurniture, actor akActivator) Actor akActor = akActivator As Actor if akFurniture.HasKeyword(zbfFurnitureMilkOMatic) akActivator.SetExpressionOverride(9) akActivator.EquipItem(ZaZMoMSuctionCups01,true) Debug.SendAnimationEvent(akActor,"ZaZMOMBoundFurn_13") endifendeventevent OnGetup(ObjectReference akFurniture, actor akActivator) Actor akActor = akActivator As Actor if akFurniture.HasKeyword(zbfFurnitureMilkOMatic) akActivator.ClearExpressionOverride() akActivator.UnEquipItem(ZaZMoMSuctionCups01) akActivator.removeItem(ZaZMoMSuctionCups01) endifendeventKeyword property zbfFurnitureMilkOMatic autoArmor property ZaZMoMSuctionCups01 autoactor property playerref auto
Guest Posted October 20, 2016 Posted October 20, 2016 ...and it doesn't work... Hello Delzaron, I am not aware of available events called: event OnSit(ObjectReference akFurniture, actor akActivator) and event OnGetup(ObjectReference akFurniture, actor akActivator) They are not in ObjectReference, nor in Actor. So, they may not be called just because nobody is expected to call them. If the script is attached to an Actor, then the events are: Event OnSit(ObjectReference akFurniture) and Event OnGetUp(ObjectReference akFurniture) If the script is attached to an ObjectReference, then the only possible event is: Event OnActivate(ObjectReference akActionRef) Where akActionRef can be cast to the actor using the furniture.
Delzaron Posted October 21, 2016 Author Posted October 21, 2016 I made a new script : Event OnSit(ObjectReference akActionRef); if akFurniture.HasKeyword(zbfFurnitureMilkOMatic) If akActionRef == playerref playerref.SetExpressionOverride(9) playerref.EquipItem(ZaZMoMSuctionCups01,true) Debug.SendAnimationEvent(playerref,"ZaZMOMBoundFurn_13") ElseIf akActionRef != playerref akactionref == milkedactor milkedactor.SetExpressionOverride(9) milkedactor.EquipItem(ZaZMoMSuctionCups01,true) Debug.SendAnimationEvent(milkedactor,"ZaZMOMBoundFurn_13") endifendeventevent OnGetup(ObjectReference akActionRef); if akFurniture.HasKeyword(zbfFurnitureMilkOMatic) If akActionRef == playerref playerref.ClearExpressionOverride() playerref.UnEquipItem(ZaZMoMSuctionCups01) playerref.removeItem(ZaZMoMSuctionCups01) ElseIf akActionRef != playerref akactionref == milkedactor milkedactor.ClearExpressionOverride() milkedactor.UnEquipItem(ZaZMoMSuctionCups01) milkedactor.removeItem(ZaZMoMSuctionCups01) endifendeventKeyword property zbfFurnitureMilkOMatic autoArmor property ZaZMoMSuctionCups01 autoactor property playerref autoactor milkedactor I will see if it's working...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.