icecreamassassin Posted May 25, 2014 Share Posted May 25, 2014 Ok, so I have a corpse with an area trigger around it which uses this code: Scriptname DBM_Guardian04ScriptA extends ObjectReference Actor Property PlayerRef Auto Message Property NOTICE Auto Int Property DOONCE Auto Event OnTrigger(ObjectReference akActionRef) if DOONCE == 0 if akactionref == PlayerRef NOTICE.Show() Disable(self) DOONCE = 1 endif endif EndEvent And it works just fine, a messge box pops up once and says you seem something glowing, etc etc. Then the body I have this script: Scriptname DBM_Guardian04Script extends ObjectReference Int Property HITONCE auto Message Property NOTICE auto Actor Property PlayerRef Auto MiscObject Property SHARD auto Quest Property MyQuest auto Objectreference Property KILLTRIG Auto Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \ bool abBashAttack, bool abHitBlocked) if KILLTRIG.isdisabled() if HITONCE == 0 NOTICE.show() PlayerRef.Additem(SHARD,1) MyQuest.Setstage(60) HITONCE = 1 endif endif endevent and it does nothing. Now it USED to work find before I had the IF check to see if the other trigger was disabled, because I didn't want the player to inadvertently hit the corpse before seeing the message generated by the area trigger. Basically you walk up, the gem fragment you have glows and the one in his stomach glows, which gives you the idea to cut into his gut and get another shard. So why would the IsDisabled() check cause the second script to not work correctly? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 25, 2014 Share Posted May 25, 2014 (edited) No idea why. Try this instead, check the DOONCE variable that you have on the trigger box.Modified "body script" Scriptname DBM_Guardian04Script extends ObjectReference Int Property HITONCE auto Message Property NOTICE auto Actor Property PlayerRef Auto MiscObject Property SHARD auto Quest Property MyQuest auto DBM_Guardian04ScriptA Property MyTriggerScript Auto {point this to the form holding the trigger box script} Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \ bool abBashAttack, bool abHitBlocked) if MyTriggerScript.DOONCE == 1 if HITONCE == 0 NOTICE.show() PlayerRef.Additem(SHARD,1) MyQuest.Setstage(60) HITONCE = 1 endif endif endevent Edited May 26, 2014 by IsharaMeradin Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 25, 2014 Author Share Posted May 25, 2014 This doesn't seem to work. I just get this when I try and compile that: cannot compare a dbm_guardian04scripta to a int (cast missing or types unrelated) Link to comment Share on other sites More sharing options...
fantasy19 Posted May 25, 2014 Share Posted May 25, 2014 (edited) @your 1st script instead of Disable(self) try: self.Disable() and use your original second script again. Edited May 26, 2014 by fantasy19 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 26, 2014 Share Posted May 26, 2014 This doesn't seem to work. I just get this when I try and compile that: cannot compare a dbm_guardian04scripta to a int (cast missing or types unrelated)Yeah, I encountered that too on some scripts I was working on. Seems that I got lucky on my initial tests. Anyway, if you use a generic variable to represent the script and call that before the desired property variable or function it works. Edited the code in the previous post to reflect that. Feel free to test it to be sure that it works and inform of the results. If it works, we can leave the code up as an option for anyone else who stumbles across wanting to do something similar. As far as what fantasy19 said, I should have caught that. Guess I got caught with a word problem (always hated those). I assumed the first script worked since it was stated that it did so. At any rate, at the end of the day, go with fantasy19's suggestion. Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 26, 2014 Author Share Posted May 26, 2014 I did try the reversed phrasing on the self disable, but it didn't do anything either, it's very odd to me... I'll try your method again and see if it does anything different. Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 26, 2014 Author Share Posted May 26, 2014 ok, so I tried the revised code and again, it did nothing. It did compile ok, and I did not set any property as it is a stand in for an objectreference and thus I can't define the script in the properties tab, so I left it blank, is there a step I'm missing there? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted May 26, 2014 Share Posted May 26, 2014 ok, so I tried the revised code and again, it did nothing. It did compile ok, and I did not set any property as it is a stand in for an objectreference and thus I can't define the script in the properties tab, so I left it blank, is there a step I'm missing there?Even if it is a stand in object, you need to define it. If you don't it won't work for sure. You can always change the definition later when you place the correct object. Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 26, 2014 Author Share Posted May 26, 2014 oh wait! it's supposed to point at the triggerbox lol I was thinking it needed to point directly at the script somehow... I'll try that Link to comment Share on other sites More sharing options...
icecreamassassin Posted May 26, 2014 Author Share Posted May 26, 2014 ok sweet, that worked, thanks :) Link to comment Share on other sites More sharing options...
Recommended Posts