portbash Posted April 6, 2012 Share Posted April 6, 2012 (edited) I'm just getting into papyrus scripting and it makes fun... somehow, but I still don't see the benefits of it compared to obl/fallout scripting. I got the feeling the efforts are doubled to do the easiest things, like calling messagebox or else. Aaanyway, let's get to the topic: So how do I let scripts communicate with each other? As example:So have this activator: On activation I want to call a message but I don't want it to handle the code. Instead I would like to have a "message-quest" doing all message related stuff and have it sending the player-button-choices back to the activator. In Fallout I would do it like this: Begin OnActivate Player if IamAfoodActivator == 1 set MessageQuest.FoodMenu to 1 elseif IamAweaponActivator == 1 set MessageQuest.WeaponMenu to 1 endif end Inside the Quest it would go like this: Begin GameMode If FoodMenu == 1 showMessage FoodMessage set FoodMenu to 2 elseif FoodMenu == 2 set Button to GetButtonPressed if Button == 1 set IamAfoodActivator.Choice to 1 ; activator would spawn a nuka cola set FoodMenu to 0 elseif Button == 2 set IamAfoodActivator.Choice to 2 ; activator would spawn a mutfruit set FoodMenu to 0 endif endif end Something I'm specifically looking for is how to set a reference: If Self == IamSuperMutant if ReferenceQuest.SuperMutantRef == 0 set ReferenceQuest.SuperMutant to IamSuperMutant endif endif So that's the story. I haven't understood yet how to enable "communications" between script/object. If anyone can point me to a tutorial or enlighten me here, my thanks would be endless :thumbsup: Edited April 6, 2012 by portbash Link to comment Share on other sites More sharing options...
fg109 Posted April 6, 2012 Share Posted April 6, 2012 (edited) Scriptname ExampleActivatorScript extends ObjectReference Quest property MessageQuest auto Activator property FoodActivator auto Activator property WeaponActivator auto Event OnActivate(ObjectReference akActionRef) if (akActionRef == Game.GetPlayer()) if (GetBaseObject == FoodActivator) (MessageQuest as MessageQuestScript).FoodMenu() elseif (GetBaseObject == WeaponActivator) (MessageQuest as MessageQuestScript).WeaponMenu() endif endif EndEvent Scriptname MessageQuestScript extends Quest Message property FoodMessage auto Message property WeaponMessage auto Function FoodMenu() int choice = FoodMessage.Show() if (choice == 0) ;do stuff elseif (choice == 1) ;dostuff else ;etc. endif EndFunction Function WeaponMenu() int choice = WeaponMessage.Show() if (choice == 0) ;do stuff elseif (choice == 1) ;dostuff else ;etc. endif EndFunction Remember to set your properties. Edited April 6, 2012 by fg109 Link to comment Share on other sites More sharing options...
portbash Posted April 6, 2012 Author Share Posted April 6, 2012 (edited) Alright it worked! :wub: And similar to this:I'm casting a spell and due the Actor definition in the event header, I got the spell target reference. Now, OnEffectFinish the spell calls a function and inside this function the spell target reference is unknown. How do I pass the spell target from the effect events to the following function?EDIT: woah this was such an easy thing Passing the reference to a quest?How do I pass the spell target reference to a quest and visa versa? (I really got confused with this one)EDIT: this was a tricky one And another one:A way to set a NPC's name as a variable into a messagebox. On NPC Ysolda the message would say: Ysolda shout eat more. EDIT: still messing with this one Edited April 7, 2012 by portbash Link to comment Share on other sites More sharing options...
portbash Posted April 7, 2012 Author Share Posted April 7, 2012 (edited) How do I pass the spell target reference to a quest and visa versa? edit:done! :thumbsup: thanks again for the initial reply fg109! :wub: Edited April 7, 2012 by portbash Link to comment Share on other sites More sharing options...
Recommended Posts