jucoking Posted December 31, 2018 Share Posted December 31, 2018 I have been trying for days to get this to work using a "defaultactivateLinkOnce" triggerbox with no luck. What I'm trying to accomplish is getting a retractable staircase to activate via the triggerbox ONLY if the player has a specific item. The whole scenario works perfectly other than the fact I am unsure how to tack on the requirement of the item in question. I've been decent at getting my scripts to do what I want thus far, but I'm still a beginner. Please help! Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 31, 2018 Share Posted December 31, 2018 You will probably need to use a custom script rather than a stock script. You could use a stock script as a starting point, however. You need to use GetItemCount to check the player's inventory for your item prior to telling the linked ref to activate. Link to comment Share on other sites More sharing options...
jucoking Posted January 1, 2019 Author Share Posted January 1, 2019 You will probably need to use a custom script rather than a stock script. You could use a stock script as a starting point, however. You need to use GetItemCount to check the player's inventory for your item prior to telling the linked ref to activate.That's the whole problem...I'm not sure what script will activate a linked ref. I did get as far as the GetItemCount part, but the way the default trigger scripts activate linked refs is complicated and I can't understand it as of yet. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 1, 2019 Share Posted January 1, 2019 Hmm okay. Post the default script you are currently using and we can go from there. Link to comment Share on other sites More sharing options...
jucoking Posted January 1, 2019 Author Share Posted January 1, 2019 Eureka. I just added an "If" condition to the existing default script. Here is what it looks like: {Default script intended for triggers. When hit, they'll activate their linked reference} import game import debug objectReference property OnlyActor auto {Set this property if you want to only allow activation from a specific actor, such as the player} bool property doOnce auto {by default, this trigger fires once only.} Actor Property PlayerRef Auto Key Property CV2_WhiteCrystalKey Auto function ActivateNow(objectReference trigRef) If PlayerRef.GetItemCount(CV2_WhiteCrystalKey) == 1 ; Debug.Trace("Activating: " + self + " " + myLink) objectReference myLink = getLinkedRef() self.activate(self, true) if MyLink != NONE myLink.activate(self as objectReference) endif if doOnce == true gotoState("allDone") endif EndIf endFunction auto STATE waiting EVENT onTriggerEnter(objectReference actronaut) ; Debug.Trace("Trigger Enter: " + actronaut) if !onlyActor activateNow(actronaut) endif if onlyActor == actronaut activateNow(actronaut) endif endEVENT endSTATE STATE allDone ;do nothing endSTATE So glad this is out of the way now. Thanks for all your help, Ishara, especially the intention to go further. It is much appreciated. Link to comment Share on other sites More sharing options...
Feralkyn Posted January 1, 2019 Share Posted January 1, 2019 (edited) --never mind, you beat me to it!! Nice. Edited January 1, 2019 by Feralkyn Link to comment Share on other sites More sharing options...
jucoking Posted January 1, 2019 Author Share Posted January 1, 2019 Thanks anyway! It goes without saying that I did not modify the vanilla script, just copied and pasted it into a new custom trigger box with a new script. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 1, 2019 Share Posted January 1, 2019 I trust you gave the script a new name and re-assigned the new script to your object. If not, all instances of that default script in the game will not work as intended. Link to comment Share on other sites More sharing options...
jucoking Posted January 1, 2019 Author Share Posted January 1, 2019 Of course ;) Link to comment Share on other sites More sharing options...
Recommended Posts