Help with a script

Old and generally outdated discussions, with the rare hidden gem. Enter at your own risk.

Moderators: Haplo, Lead Developers

Locked
User avatar
Meritocrat
Member
Posts: 25
Joined: Mon Aug 17, 2009 12:31 am

Help with a script

Post by Meritocrat »

I guess this is technically related to TR as it is for my showcase, but I decided to post it here anyway. I'm relatively new to modding, and I need some help with making a script that makes something attack you in your sleep a la Dark Brotherhood from tribunal, and preferably only while out in the wilderness and maybe even only at night. I've looked at the script for the Dark Brotherhood assassin but me no understand. Anyone who can help me?
Nanu
Developer Emeritus
Posts: 2032
Joined: Thu Feb 16, 2006 12:27 am
Location: Virginia

Post by Nanu »

Moved from OTD to here.

You might get more views this way. In terms of your question, how much do you understand about the scripting language? If you don't get much, I can recommend looking up GhanBuriGhan's Morrowind Scripting for Dummies. It's how I learned, and it's a great resource.
"You can remove spells from your list in Morrowind. I think it was shift-click, don't quote me on that though." - Cathartis
|[url=http://tinyurl.com/mnbsqv]Forum Rules[/url]
|[url=http://tinyurl.com/mj594z]Moratorium[/url]
| [url=http://tinyurl.com/6msxag]Writing for TR[/url]
User avatar
Bloodthirsty Crustacean
Developer Emeritus
Posts: 3869
Joined: Fri Feb 02, 2007 7:30 pm
Location: Elsewhere

Post by Bloodthirsty Crustacean »

I don't know the full script, and am a bit busy to write it all out exactly for you right here, but what you'd want to do is along these lines:

Code: Select all

If ( PCSleeping == 1 )
     If ( GetCell "Balmora" == 0 )
          If ( GetCell "every other city" == 0 )
               ...
                    If ( GameHour >= 8 )
                        PlaceAtPC "scary monster" 1 0 20 0
                    Elseif ( GameHour < 6 )
                        PlaceAtPC "scary monster" 1 0 20 0
                    Endif
               ...
           Endif
     Endif
Endif

The bit about cities makes it practically undesirable. I'm not sure if it would accept region names, but you might be able to save a few lines by going for "Bitter Coast Region" == 1 instead.


This would need to be on a StartScript (global script). So create your script, then go to Gameplay->Start Scripts, and add you script there.
a man builds a city
with
Banks and Cathedrals
a man melts the sand so he
can see the world outside


"They destroyed Morrowind? Fiddlesticks! Now we're going to have to rebuild it again!"
User avatar
Meritocrat
Member
Posts: 25
Joined: Mon Aug 17, 2009 12:31 am

Post by Meritocrat »

Is it any way to make it only work in exteriors? Since you generally can't sleep outdoors in cities that would make it impossible to trigger it while in a city. That would make all other interiors like ruins and caves safe zones too though...
Nanu
Developer Emeritus
Posts: 2032
Joined: Thu Feb 16, 2006 12:27 am
Location: Virginia

Post by Nanu »

I believe Morrowind had the If (GetInterior == 0) or If (IsInterior == 0) command. Try that.
"You can remove spells from your list in Morrowind. I think it was shift-click, don't quote me on that though." - Cathartis
|[url=http://tinyurl.com/mnbsqv]Forum Rules[/url]
|[url=http://tinyurl.com/mj594z]Moratorium[/url]
| [url=http://tinyurl.com/6msxag]Writing for TR[/url]
Evil Eye
Developer
Posts: 64
Joined: Sun May 03, 2009 7:27 pm

Post by Evil Eye »

Nanu wrote:I believe Morrowind had the If (GetInterior == 0) or If (IsInterior == 0) command. Try that.
Yes it did:

Code: Select all

Begin mylittleboohooscriptthatannoystheplayer

short doOnce

if ( GetPCSleeping == 1 )
	if ( doOnce == 0 )
		if ( Random100 <= 25 ) ;you don't want it all the time do you?
			set doOnce to 1 ;attack!!!
		else
			set doOnce to 2
		endif
	endif
	if ( GetInterior == 0 )
		if ( Gamehour >= 20 )
			if ( Gamehour <= 6 )
				if ( doOnce == 1 )
					PlaceAtPC "scary monster" 1 1 128 0
					WakeUpPC
				endif
			endif
		endif
	endif
else
	if ( doOnce != 1 )
		set doOnce to 0
	endif
endif

end
User avatar
Bloodthirsty Crustacean
Developer Emeritus
Posts: 3869
Joined: Fri Feb 02, 2007 7:30 pm
Location: Elsewhere

Post by Bloodthirsty Crustacean »

That script won't work because GameHour can never be both >= 20 and < 6. You need to use an ElseIf.
a man builds a city
with
Banks and Cathedrals
a man melts the sand so he
can see the world outside


"They destroyed Morrowind? Fiddlesticks! Now we're going to have to rebuild it again!"
Evil Eye
Developer
Posts: 64
Joined: Sun May 03, 2009 7:27 pm

Post by Evil Eye »

Bloodthirsty Crustacean wrote:That script won't work because GameHour can never be both >= 20 and < 6. You need to use an ElseIf.
*facepalms* I knew there was something with hours. I'm only human :P
User avatar
Meritocrat
Member
Posts: 25
Joined: Mon Aug 17, 2009 12:31 am

Post by Meritocrat »

Thanks a lot guys, I'll try that. While I'm here, is there any way to make NPCs ignore that you are a werewolf?
Locked