Linky1 Posted December 23, 2011 Share Posted December 23, 2011 (edited) Hey all! Just need a little help with my second script. I have made a chest with some powerful items in it, and have written this script for the chest when you open it: scn LincolnsAllomancyChestScript Begin OnActivate Messagebox "You open the chest and feel a Strong surge of Power flow through you." "Ok" End You have probably spotted the problem already, but for the people who haven't, I click the chest and it comes up with the message. When I click ok it doesn't open, and if I click the chest again it repeats. Any help is appreciated,Thanks Linky1 Edited December 23, 2011 by Linky1 Link to comment Share on other sites More sharing options...
WarRatsG Posted December 23, 2011 Share Posted December 23, 2011 If an object has an OnActivate block, then it will not activate normally. For a chest, this means it will not open. This is to allow scripters to specifically avoid the object being activated under certain circumstances. Whenever you do want the object to be activated, use the command: Activate It's worth noting that "Activate" should be used as late as possible. It seems that sometimes it halts a script prematurely; although no-one is sure where, when, how or why this is. Link to comment Share on other sites More sharing options...
Septfox Posted December 23, 2011 Share Posted December 23, 2011 (edited) Try this:scn LincolnsAllomancyChestScript ref mySelf ;reference that stores the name of the chest Begin OnActivate set mySelf to GetSelf ;stores the name of the chest so it can activate itself Messagebox "You open the chest and feel a Strong surge of Power flow through you." "Ok" mySelf.Activate Player ;the chest opens itself End Or assuming you only want the message to appear once, scn LincolnsAllomancyChestScript ref mySelf ;reference that stores the name of the chest short doonce Begin OnActivate set mySelf to GetSelf ;stores the name of the chest so it can activate itself if ( doonce == 0 ) Messagebox "You open the chest and feel a Strong surge of Power flow through you." "Ok" mySelf.Activate Player ;the chest opens itself set doonce to 1 endif End Container activation method shamelessly ripped from here, since I've never actually had to do it before :whistling: Edit: Derp. In the doonce version, mySelf.Activate Player should be AFTER endif, since you want it to always open but not always display the message. Yup, dumb mistake on my part. Edited December 23, 2011 by Septfox Link to comment Share on other sites More sharing options...
Linky1 Posted December 24, 2011 Author Share Posted December 24, 2011 I have tried both of your solutions but there is now another problem that pops up with both of your solutions. It opens the chest, and displayes the message behind it. I have to click ok on the message but the inventory blocks it.This makes the chest open, but thn you cant loot anything and you can see a bit of the message in the background. fix? Thanks BTW :) Linky1 Link to comment Share on other sites More sharing options...
Septfox Posted December 24, 2011 Share Posted December 24, 2011 And now you've been witness to Septy's Dumb Mistake #2: assuming that the messagebox is always forced to the top layer. Anyway, fixing is easy, just switch the order of the commands so the chest activates first:scn LincolnsAllomancyChestScript ref mySelf ;reference that stores the name of the chest short doonce Begin OnActivate set mySelf to GetSelf ;stores the name of the chest so it can activate itself mySelf.Activate Player ;the chest opens itself if ( doonce == 0 ) Messagebox "You open the chest and feel a Strong surge of Power flow through you." "Ok" set doonce to 1 endif End I just tested this, appears to work perfectly. Link to comment Share on other sites More sharing options...
Linky1 Posted December 25, 2011 Author Share Posted December 25, 2011 And now you've been witness to Septy's Dumb Mistake #2: assuming that the messagebox is always forced to the top layer. Anyway, fixing is easy, just switch the order of the commands so the chest activates first:scn LincolnsAllomancyChestScript ref mySelf ;reference that stores the name of the chest short doonce Begin OnActivate set mySelf to GetSelf ;stores the name of the chest so it can activate itself mySelf.Activate Player ;the chest opens itself if ( doonce == 0 ) Messagebox "You open the chest and feel a Strong surge of Power flow through you." "Ok" set doonce to 1 endif End I just tested this, appears to work perfectly. Thanks, Kudos :) Link to comment Share on other sites More sharing options...
Recommended Posts