Hangman4358 Posted December 27, 2012 Author Share Posted December 27, 2012 I actually just thought of redoing the entire script and to have it use linkedRefs. Using the .GetNthLinkedRef() and the setting it up kind of like the puzzle pillar script where I can specify how many actors are linked to the trigger and then checking them all for death. Only problem is I have no clue how to go about having it set up check linked refs 1-n. I will probably look at the puzzle pillar script and try and figure it out from that when I have some time at home Link to comment Share on other sites More sharing options...
kromey Posted December 27, 2012 Share Posted December 27, 2012 Does this help you with your linkedRef approach? Cycle Through a List of Objects and Perform an Action on Each Object(Linked Ref Chain) Link to comment Share on other sites More sharing options...
Hangman4358 Posted December 28, 2012 Author Share Posted December 28, 2012 (edited) Actually I looked through the way the puzzle pillar does it and I think that way is much more ingenious actually. When the pillar is in the correct position it increases an integer count in the script for the lever. If the integer count of the number of solves pillars is the same as the defined count of pillars total in the puzzle the lever will open. So I am taking that concept and having an OnDeath or OnDying increase the death count by one and then try and activate the LinkActivator. when all are dead and the counts match the gate will open. This way I can set it to use 1 actor or 50 actors EDIT: Ok so I went about trying to set this up but now I have a compiling problem. Here are my two scripts This one is on the trigger itself Scriptname OAQ01Valuungrann03GuardianTrigSCRIPT extends ObjectReference int property numDead auto hidden int property deadCount auto {Number of Actors to Kill} Function TryActivate() If numDead == deadCount activate(Game.GetPlayer()) GoToState("COMPLETED") EndIf EndFunction STATE COMPLETED ;DoNothing ENDSTATE This one is on the actor Scriptname OAQ01GuardianExplosionSCRIPT extends Actor {Creates explosion on the death of a Guardian and passes on a death if linked correctly} Spell Property OAQ01GuardianExplosionSpell Auto Hidden ObjectReference Property deathTrapLinker Auto {trigger to use on having actor killed} Event OnDying(Actor akKiller) utility.Wait(0.75) OAQ01GuardianExplosionSpell.Cast(Self) deathTrapLinker.numDead = deathTrapLinker.numDead + 1 self.disable() EndEvent But not it is giving me this errorC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\OAQ01GuardianExplosionSCRIPT.psc(10,17): numDead is not a property on script objectreference or one of its parentsC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\OAQ01GuardianExplosionSCRIPT.psc(10,43): numDead is not a property on script objectreference or one of its parentsC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\OAQ01GuardianExplosionSCRIPT.psc(10,51): cannot add a none to a int (cast missing or types unrelated) I just have no clue how to get the two scripts to talk to one another Edited December 28, 2012 by Hangman4358 Link to comment Share on other sites More sharing options...
kromey Posted December 28, 2012 Share Posted December 28, 2012 Try something like this (untested, as being at work I don't have the CK in front of me): On your trigger, add this function: Function incrementNumDead() numDead = numDead + 1 EndFunction Then change your onDying event on your actors to: Event OnDying(Actor akKiller) utility.Wait(0.75) OAQ01GuardianExplosionSpell.Cast(Self) deathTrapLinker.incrementNumDead() self.disable() EndEvent This being said, though, I think the linkedRef chain is actually the better solution; this approach will break if the player kills one guardian but then has to flee, and when they eventually return the first guardian has respawned -- at that point killing one guardian will open the door, but the second guardian is still standing! You can have as many guardians as you like in the linkedRef chain, and adding and removing guardians is as easy as re-pointing those linked refs. Link to comment Share on other sites More sharing options...
Hangman4358 Posted December 28, 2012 Author Share Posted December 28, 2012 the problem with the linkedRef chain is that actors seem to be only able to be linkrefed to one thing. Since they are already Linked to the furniture I can't link them to something else. Also this dungeon does not respawn so the respawning is not really a problem. Link to comment Share on other sites More sharing options...
kromey Posted December 28, 2012 Share Posted December 28, 2012 Ah, yeah, that would be an issue, I hadn't thought of that. I still think checking the isDead() method on each actor is better than using the dead count, but if you've set your dungeon to not respawn then there probably won't be an issue -- it's just the programmer in me thinking about race conditions and disjoint dependent states. Using the incrementing function from my previous post should fix your issue and allow you to use the counter successfully, I think -- as I said, I'm unable to test it, and I've never tried to use an approach like this before. Link to comment Share on other sites More sharing options...
steve40 Posted December 29, 2012 Share Posted December 29, 2012 But not it is giving me this errorC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\OAQ01GuardianExplosionSCRIPT.psc(10,17): numDead is not a property on script objectreference or one of its parentsC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\OAQ01GuardianExplosionSCRIPT.psc(10,43): numDead is not a property on script objectreference or one of its parentsC:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\OAQ01GuardianExplosionSCRIPT.psc(10,51): cannot add a none to a int (cast missing or types unrelated) I just have no clue how to get the two scripts to talk to one another You need to cast "deathTrapLinker" as the script that is attached to it: (deathTrapLinker as OAQ01Valuungrann03GuardianTrigSCRIPT). numDead += 1 Link to comment Share on other sites More sharing options...
steve40 Posted December 29, 2012 Share Posted December 29, 2012 (edited) Then change your onDying event on your actors to:Event OnDying(Actor akKiller) utility.Wait(0.75) OAQ01GuardianExplosionSpell.Cast(Self) deathTrapLinker.incrementNumDead() self.disable() EndEvent A small correction: Event OnDying(Actor akKiller) utility.Wait(0.75) OAQ01GuardianExplosionSpell.Cast(Self) (deathTrapLinker as OAQ01Valuungrann03GuardianTrigSCRIPT).incrementNumDead() self.disable() EndEvent Edited December 29, 2012 by steve40 Link to comment Share on other sites More sharing options...
Hangman4358 Posted December 29, 2012 Author Share Posted December 29, 2012 I actually also tried setting it up with a while loop that would go through and check each linkedRef for .isDead() but apparently you can also only set one actor to a linkedRef of something or something because I could never set more than one actor to a linkedRef. Hey thanks guys for all the help again. That worked perfectly Steve. Just learned something new :) Link to comment Share on other sites More sharing options...
Recommended Posts