Unusual script

Post » Wed Dec 23, 2009 4:23 pm

I can't give too many details on this due to it being a secret, so I'll be as generic as possible while still explaining what I need help with.

There is a container in an empty room. When the player clicks on that container, a message box appears and an NPC appears next to the container. If the player ever opens that container again, it behaves normally and just shows its inventory, without doing anything special.

How would I script this situation?
User avatar
JESSE
 
Posts: 3404
Joined: Mon Jul 16, 2007 4:55 am

Post » Wed Dec 23, 2009 2:04 pm

I feel like I might be missing something here, but my scripting is getting rusty.

BeginShort DoOnceif ( DoOnce == 1 )	Activateendifelse if ( OnActivate )  if ( DoOnce == 0 )     "NPCs ID"->Enable     MessageBox, "Insert message here."     Set DoOnce to 1     return  endifendifend

User avatar
Jennifer Munroe
 
Posts: 3411
Joined: Sun Aug 26, 2007 12:57 am

Post » Wed Dec 23, 2009 10:49 pm

Here is the script as I have it now:

begin script

short doOnce

if ( OnActivate == 1 )

if ( doOnce == 0 )
MessageBox, "secret message."
PlaceAtMe, "npc_object", 1, 0, 0
set doOnce to 1
endif

if ( doOnce > 0 )
Activate
endif

endif

end

It is currently spamming the NPC object to create a clone army. Where is the mistake in the code?
User avatar
Stu Clarke
 
Posts: 3326
Joined: Fri Jun 22, 2007 1:45 pm

Post » Thu Dec 24, 2009 3:29 am

This implies that the NPC was disabled to begin with, which would need to be handled by another script.

OR

You could put a script on that NPC that made it enable when a journal is updated.

The NPC script would be something like the scripts on the artifacts in the Museum. Disables them when a journal is below a number, and enables when above.

Think that would work easier than knocking up some starter script that initially disbled the NPC when the mod was loaded..

:celebration:

Edit: err yes this was in response to Pluto's post. Mordigants idea seems to be better then my suggestion. forgot about the placeatme command :facepalm: You would need to remove that

"if ( doOnce > 0 )
Activate
endif"

part
User avatar
Hot
 
Posts: 3433
Joined: Sat Dec 01, 2007 6:22 pm

Post » Wed Dec 23, 2009 9:18 pm

Think puttting the Activate command in below the "PlaceAtMe, "npc_object", 1, 0, 0" line and removing the:

if ( doOnce > 0 )
Activate
endif

part, would do it.
User avatar
Rach B
 
Posts: 3419
Joined: Thu Mar 08, 2007 11:30 am

Post » Wed Dec 23, 2009 10:30 pm

Got it going. Please ignore this thread.
User avatar
FirDaus LOVe farhana
 
Posts: 3369
Joined: Thu Sep 13, 2007 3:42 am

Post » Thu Dec 24, 2009 12:21 am

Got it going. Please ignore this thread.


Err no worries then, <_<

On behalf of Pluto and myself..
User avatar
WYatt REed
 
Posts: 3409
Joined: Mon Jun 18, 2007 3:06 pm

Post » Thu Dec 24, 2009 4:21 am

Err no worries then, <_<

On behalf of Pluto and myself..

I am sure he apprciates your help, but it sounds like he got it working by himself ;) - these things happen, dont take it the wrong way :)
User avatar
Rebecca Dosch
 
Posts: 3453
Joined: Thu Jan 18, 2007 6:39 pm

Post » Thu Dec 24, 2009 3:45 am

Of course, I can't tell you what it's for without giving too much away! It's for a secret feature!
User avatar
Scared humanity
 
Posts: 3470
Joined: Tue Oct 16, 2007 3:41 am


Return to III - Morrowind