Dead Actor Script

Post » Fri May 27, 2011 3:31 pm

Hi,

I'm currently working on a mod for Morrowind which adds a new quest to the game. But i'm totally new to scripting and i've got a question.

I have created the NPC rd_nochilus_agona. He is part of my quest, but the goal of the quest is to kill him. So when i kill him my journal has to be updated to index #40. But i've got totally no idea how to script it. Can somebody help me? :(
User avatar
AnDres MeZa
 
Posts: 3349
Joined: Thu Aug 16, 2007 1:39 pm

Post » Fri May 27, 2011 4:12 pm

Hi,

I'm currently working on a mod for Morrowind which adds a new quest to the game. But i'm totally new to scripting and i've got a question.

I have created the NPC rd_nochilus_agona. He is part of my quest, but the goal of the quest is to kill him. So when i kill him my journal has to be updated to index #40. But i've got totally no idea how to script it. Can somebody help me? :(


download scripting for dummies http://www.filefront.com/9147272/Morrowind-Scripting-for-Dummies-v9/

You will find this invaluable as you progress in modding.

This would be a generic "death notice" as a local attached to the actor;

Begin DeathScriptShort DoneIf (Done == 1)   returnendifif (MenuMode == 1)   returnendifif (OnDeath == 1)    Journal, My_Journal_Index 40    set done to 1endifend


There are many more options for this script, but this is just a basic.
User avatar
Kayla Keizer
 
Posts: 3357
Joined: Tue Dec 12, 2006 4:31 pm

Post » Fri May 27, 2011 1:39 pm

download scripting for dummies http://www.filefront.com/9147272/Morrowind-Scripting-for-Dummies-v9/

You will find this invaluable as you progress in modding.

This would be a generic "death notice" as a local attached to the actor;

Begin DeathScriptShort DoneIf (Done == 1)   returnendifif (MenuMode == 1)   returnendifif (OnDeath == 1)    Journal, My_Journal_Index 40    set done to 1endifend


There are many more options for this script, but this is just a basic.


Thanks! This will help me for sure.

I also followed some other tutorials and used a script from the tutorial to check if i got a specific item. I used this:
begin rd_lost_bookshort doneif ( done == 1 )     returnendifif (GetItemCount rd_destruction = 1)     Journal rd_lostbook 20     set done to 1     activateendifend rd_lost_book


But it didn't work, someone know why?
User avatar
Katy Hogben
 
Posts: 3457
Joined: Mon Oct 30, 2006 12:20 am

Post » Fri May 27, 2011 9:54 am

Thanks! This will help me for sure.

I also followed some other tutorials and used a script from the tutorial to check if i got a specific item. I used this:
begin rd_lost_bookshort doneif ( done == 1 )     returnendifif (GetItemCount rd_destruction = 1)     Journal rd_lostbook 20     set done to 1     activateendifend rd_lost_book


But it didn't work, someone know why?


I see two issues with that script, but I'm tired... if anyone else comes along I'm sure they can do a better job.

Both of them are tied to the same line. Instead of "if (GetItemCount rd_destruction = 1)", try the following line:

if ( Player -> GetItemCount "rd_destruction" == 1 )



Post back whether it works or not. The two issues my changed line should resolve are that you need a double equals sign for equivalence comparisons, and that (presumably) you are trying to check how many of rd_destruction the player has, not the book the script is attached to. When you don't specify a fix (the ID to the left of the ->), the scripting language assumes you are using the operation upon the object the script attaches to -- in this case I assume it is a book based on your labels. By specifying the player, you check the player's inventory for rd_destruction instead.

And welcome to the wonderful world of scripting; Morrowind's scripting engine is sometimes frustratingly limited, and wasn't meant to be taken to the extremes that some people use it for, but once you get the hang of it scripting can feel very rewarding.
User avatar
kristy dunn
 
Posts: 3410
Joined: Thu Mar 01, 2007 2:08 am

Post » Fri May 27, 2011 4:20 pm

I see two issues with that script, but I'm tired... if anyone else comes along I'm sure they can do a better job.

Both of them are tied to the same line. Instead of "if (GetItemCount rd_destruction = 1)", try the following line:

if ( Player -> GetItemCount "rd_destruction" == 1 )



Post back whether it works or not. The two issues my changed line should resolve are that you need a double equals sign for equivalence comparisons, and that (presumably) you are trying to check how many of rd_destruction the player has, not the book the script is attached to. When you don't specify a fix (the ID to the left of the ->), the scripting language assumes you are using the operation upon the object the script attaches to -- in this case I assume it is a book based on your labels. By specifying the player, you check the player's inventory for rd_destruction instead.

And welcome to the wonderful world of scripting; Morrowind's scripting engine is sometimes frustratingly limited, and wasn't meant to be taken to the extremes that some people use it for, but once you get the hang of it scripting can feel very rewarding.


Thanks, it worked. But when I pick up the book I get like 3 text boxes with ''journal updated''. In my journal itself there's one update message.
User avatar
pinar
 
Posts: 3453
Joined: Thu Apr 19, 2007 1:35 pm


Return to III - Morrowind