tonycubed2 Posted February 28, 2012 Share Posted February 28, 2012 First, the variable is not part of a quest script, and thus the CK wiki does not work for it. So maybe it has to be a quest script for a variable to be passed between two scripts? I doubt it though. In any case, the following script succesfully summons a ghoul when a potion is picked up the floor. Uses a local counter to only summon the ghoul one time even if picked up again. Works fine. But I need to let a second script elsewhere know that the potion was picked up. That is where I used the "Int Property TookPotion Auto" line. My script elsewhere needs to query TookPotion and if it is "5" perform stuff. But I cannot get it to do it. I tried using GetLinkedRef() but it confuses me and complained about mismatched types. I tried to "cast" the type using "PotionTaken = GetLinkedRef() as SpawnGhostPotion" and compiled but that does not allow me to query the Int "TookPotion". Help! I spent hours and hours on this. Scriptname SpawnGhostPotion extends ObjectReference Import Game ActorBase Property UndeadGhost Auto ObjectReference Property bornpoint Auto Int Property PotionCurse Auto Int Property TookPotion Auto Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if PotionCurse==0 if akNewContainer == Game.GetPlayer() bornpoint.PlaceAtMe (UndeadGhost, 2) Debug.Notification("Undead!!") PotionCurse=PotionCurse+1 TookPotion=5 EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
tunaisafish Posted February 28, 2012 Share Posted February 28, 2012 You don't show the other script, or describe what objects and how many of each type you have.I'll assume you have several potions with the above script, and 1 object where SpawnGhostControllerScript is attached.If I've got it backwards then you should be able to figure it out from this... Scriptname SpawnGhostControllerScript extends ObjectReference {I live on the controller object} Int Property PotionTakenInteger Auto ; My potion slaves may dump values here Function PotionTakenHandler(ObjectReference slaveRef, Int TookPotionArg) ; My potion slaves may also contact me here Debug.Notification("SlaveRef=" + slaveRef as string + " TookPotionArg=" + TookPotionArg + " PotionTakenInteger=" + PotionTakenInteger) ;do stuff EndFunction ============== NEW FILE ================ Scriptname SpawnGhostPotion extends ObjectReference {I live on a potion} ActorBase Property UndeadGhost Auto ObjectReference Property bornpoint Auto ObjectReference Property ControllerObject Auto ; Remember to point this where you controller script lives Int Property TookPotion Auto ; Set this to the value we will pass to the controller. eg. 5 for this potion type. Int PotionCurse = 0 Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if !PotionCurse if akNewContainer == Game.GetPlayer() bornpoint.PlaceAtMe (UndeadGhost, 2) Debug.Notification("Undead!!") PotionCurse = 1 ;You probably only need the function call to the controller (ControllerObject As SpawnGhostControllerScript).PotionTakenInteger = TookPotion ; Set a property value in the controller (ControllerObject As SpawnGhostControllerScript).PotionTakenHandler(self, TookPotion) ; run a function on the controller. EndIf EndIf EndEvent I didn't try to compile those, so there may be some syntax bugs Link to comment Share on other sites More sharing options...
tonycubed2 Posted February 28, 2012 Author Share Posted February 28, 2012 Thank you so very much! Wether it compiles or not at least I will be going in the right direction!!! Looking at your work, I would not have figured it out. Thanks again! :-) Link to comment Share on other sites More sharing options...
Recommended Posts