How do I insert a "disabled" object

Post » Fri May 27, 2011 7:35 am

Good evening.

I may have just thought of another way to do this, but is there a way to place an object into the game that starts disabled? I plan to enable it later through dialogue. I can easily do it the other way around, disabling an object reference, but how do I start with the reference disabled?

I already found out that the "blocked" settings are NOT what I want.

Rochndil, hoping to do this the easy way...
User avatar
Yung Prince
 
Posts: 3373
Joined: Thu Oct 11, 2007 10:45 pm

Post » Fri May 27, 2011 6:06 am

You could put a script on it that disables it first thing.

begin thing_that_starts_disabledshort doOnceif ( doOnce == 0 )	Disable	set doOnce to 1endifend


(Or something like that)
Edit: I guess checking for disabled isn't really necessary.
User avatar
Julie Ann
 
Posts: 3383
Joined: Thu Aug 23, 2007 5:17 am

Post » Thu May 26, 2011 8:47 pm

Thanks for the idea!

You could put a script on it that disables it first thing.

begin thing_that_starts_disabledshort doOnceif ( doOnce == 0 )	Disable	set doOnce to 1endifend


(Or something like that)
Edit: I guess checking for disabled isn't really necessary.


Can you have the script that disables the item ATTACHED to the item? That seems likely to bug to me. I know you can't have a topic disable itself, that caused a lovely CTD.

Rochndil, who may try it anyway...
User avatar
Andrew Tarango
 
Posts: 3454
Joined: Wed Oct 17, 2007 10:07 am

Post » Thu May 26, 2011 7:42 pm

Can you have the script that disables the item ATTACHED to the item?


Yes, that's what I meant by "put a script on it". Like you can put a script on an NPC or ACTI or MISC item or such by selecting the script from the drop down menu for that item when you have its edit window open. So one script would work for many items, in case you wanted a bunch to start disabled. And you could even use a flag in the script to later enable the item and just set that flag from dialogue, if you wanted to get fancy.
User avatar
Shannon Lockwood
 
Posts: 3373
Joined: Wed Aug 08, 2007 12:38 pm

Post » Fri May 27, 2011 3:39 am

Not too clear what you are trying to do - however as regards disabling a topic you can do that with a little bit of thought - if you check Cosades dialogue you'll see he mentions each of the blades - they have a filter for a journal entry which doesn't yet exist and is set to < 1 in the results box it sets that Journal entry to 1 thus making the condition for that topic now impossible to meet - so it disappears from his dialogue list. It's a neat trick when used well.
User avatar
Sarah Knight
 
Posts: 3416
Joined: Mon Jun 19, 2006 5:02 am

Post » Fri May 27, 2011 8:08 am

Illuminiel, he's trying to disable something through dialogue, not disabling the dialogue itself. But what you said works.

As far as efficiency goes, you can stop the script after you've disabled it if you're going to be enabling it through dialogue and not through the script. Just to keep down on your scripts running.
User avatar
Amber Ably
 
Posts: 3372
Joined: Wed Aug 29, 2007 4:39 pm

Post » Fri May 27, 2011 3:30 am

It is safe to have items disabled by their own script, it is done for the stronghold items. However, certain script commands won't work properly on a disabled item. The only one I know of is getdistance, which causes some odd issues.
User avatar
Charles Weber
 
Posts: 3447
Joined: Wed Aug 08, 2007 5:14 pm

Post » Fri May 27, 2011 10:40 am

Thank you all for your replies.

Illumniel: I'll definitely investigate that dialogue trick you mentioned. Having an example to work from will be very helpful. I may or may not add that to the mod I'm currently working on, because I'm getting tired of twiddling with the dialogue and want to get it RELEASED already. :)

Trunksbomb: Agreed, anything to keep the script load down is a good thing. This effect may be added to the main item script, which should only run briefly until the reference is removed from the game by dialogue.

Narfblat: Good, I was worried that a script (effectively) terminating a reference that CONTAINED that script could cause a logic bomb that would destroy the world as we know it...or at least a CTD. All that should happen to the reference WHILE disabled is being enabled through a dialogue action. I've already set the object to "references persist," though I'll test to see if that's strictly necessary.

With a little luck I'll get this knocked out and tested, and then can finally post the whole thing for everyone else to throw bricks at and see what breaks. Ah, the joys of mod development! :)

Rochndil, first-time modder...
User avatar
daniel royle
 
Posts: 3439
Joined: Thu May 17, 2007 8:44 am

Post » Fri May 27, 2011 2:25 am

References Persists should be checked so that you can reference it from out-of-cell or if the player has not yet encountered it. From Morrowind Scripting For Dummies, v9

The object windows in the TESCS have a checkbox named "References persist". Ticking this
checkbox ensures that a reference (an instance of the object in the game world) is always
available to be referenced by script, even if the player is in a different cell, or has not yet
encountered the object.
If a script uses a specific reference to an object such as
RefObject->Enable
Then "RefObject" should have References persist checked.

User avatar
Josh Trembly
 
Posts: 3381
Joined: Fri Nov 02, 2007 9:25 am

Post » Thu May 26, 2011 11:11 pm

Thanks!

References Persists should be checked so that you can reference it from out-of-cell or if the player has not yet encountered it. From Morrowind Scripting For Dummies, v9


I THOUGHT that was the case, but I'm glad to have it confirmed. I haven't read MWSFD yet, because I really didn't intend to get into scripting. I went just far enough to create the effect I wanted, which turned out to be a lot farther than I thought in the first place, but so it goes.

Rochndil, who is a writer, not a programmer...
User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm


Return to III - Morrowind