Need Help Creating Scripts For NPCs

Post » Wed Jun 20, 2012 1:06 pm

I need some help creating a few scripts that are made for NPCs.

First Script is a General script where I can easily set it so any NPC can have this script. All I want to do is make it so when that NPC, or Creature, dies then it will be disabled (Like Summons).

The 2nd Script is basicly like the above one but when it dies, the script will spawn some more enemies via PlaceAtMe on invisible markers then it gets disabled (Like Summons.)

The 3rd Script, once again, same like above but when it dies, the script will add an item to the player's inventory then it gets disabled.

That is all, can anyone help me out? Like give me a few tips on what the commands will be like?
User avatar
Timara White
 
Posts: 3464
Joined: Mon Aug 27, 2007 7:39 am

Post » Wed Jun 20, 2012 2:13 am

First script:

Scriptname NPCScript01 extends ActorEvent OnDying(Actor akKiller)    Utility.Wait(15)    ;wait 15 seconds to give player a slim chance to loot    Disable()EndEvent

Second script:

Scriptname NPCScript02 extends ActorActorBase property Monster01 autoActorBase property Monster02 autoActorBase property Monster03 auto;etc.ObjectReference property M1 autoObjectReference property M2 autoObjectReference property M3 auto;etcEvent OnDying(Actor akKiller)    Utility.Wait(15)    ;wait 15 seconds to give player a slim chance to loot    Disable()    M1.PlaceAtMe(Monster01, 1)    M1.PlaceAtMe(Monster02, 1)    M1.PlaceAtMe(Monster03, 1)    M2.PlaceAtMe(Monster01, 1)    M2.PlaceAtMe(Monster02, 1)    M2.PlaceAtMe(Monster03, 1)    M3.PlaceAtMe(Monster01, 1)    M3.PlaceAtMe(Monster02, 1)    M3.PlaceAtMe(Monster03, 1)    ;etc... or however you want to do itEndEvent

Third script:

Scriptname NPCScript03 extends ActorMiscObject property MyMiscObject autoEvent OnDying(Actor akKiller)    Game.GetPlayer().AddItem(MyMiscObject, 1)    Utility.Wait(15)    ;wait 15 seconds to give player a slim chance to loot    Disable()EndEvent

Those are basically what the scripts should look like. Of course, you will need to adjust them so that they are compatible with what you need.
User avatar
Lady Shocka
 
Posts: 3452
Joined: Mon Aug 21, 2006 10:59 pm

Post » Wed Jun 20, 2012 1:12 am

Alright. Thx. But I wont use the wait thing because you are fighting Spiritual forms of this enemies and looting from a spirit doesn't make sense, if you ask me.

~Edit~

This will take awhile since the 2nd script will have to made over like 400 times. (It is 48-49 per set)
User avatar
stevie trent
 
Posts: 3460
Joined: Thu Oct 11, 2007 3:33 pm

Post » Wed Jun 20, 2012 1:52 am

I just thought of something!

Should I need a DoOnce thing so it doesn't constantly spawn Monsters because one is dead or not?
User avatar
Jessie Rae Brouillette
 
Posts: 3469
Joined: Mon Dec 11, 2006 9:50 am

Post » Tue Jun 19, 2012 11:49 pm

The events only fire once for each time that the event occurs. It is unlikely that one of the monsters will die twice unless you use resurrect and enable on them from the console. As for recreating the second script 400 times... :dead:

Maybe you should take a look at formlists or arrays.
User avatar
Rach B
 
Posts: 3419
Joined: Thu Mar 08, 2007 11:30 am

Post » Wed Jun 20, 2012 5:31 am

The events only fire once for each time that the event occurs. It is unlikely that one of the monsters will die twice unless you use resurrect and enable on them from the console. As for recreating the second script 400 times... :dead:

Maybe you should take a look at formlists or arrays.

I'm fine with making the scripts. Once I create the first set, all I need to do is copy that and the other sets will be easy. Just plus or minus a few lines and change IDs.

~Edit~
And the Mod will be made in a way so you can redo a set so yes, the monster may respawn just by clicking on the stone again.
User avatar
Syaza Ramali
 
Posts: 3466
Joined: Wed Jan 24, 2007 10:46 am

Post » Wed Jun 20, 2012 3:13 pm

You can change IDs from the properties, you don't need to create a whole new script. Just because the property is name M1 doesn't mean it has to point towards your first marker. Similarly, just because an actorbase property is named Draugr, it doesn't have to be filled by a Draugr.
User avatar
Sanctum
 
Posts: 3524
Joined: Sun Aug 20, 2006 8:29 am

Post » Wed Jun 20, 2012 5:28 am

You can change IDs from the properties, you don't need to create a whole new script. Just because the property is name M1 doesn't mean it has to point towards your first marker. Similarly, just because an actorbase property is named Draugr, it doesn't have to be filled by a Draugr.

I prefer to do it how I am doing it so I have each script for each Draugr from each wave to have so they can spawn the next wave correctly. I prefer doing this way over something new to me that I may mess up. I already made 15 scripts for the Draugr Set and only takes like a few seconds to make each one.
User avatar
Dalia
 
Posts: 3488
Joined: Mon Oct 23, 2006 12:29 pm

Post » Wed Jun 20, 2012 2:32 pm

Done with the Draugr Set. Btw, would this line work fine if it was A scroll?

"Scroll property SDPS auto"

And for Ingredient?

"Ingredient property 0003ad5b auto"
User avatar
Mashystar
 
Posts: 3460
Joined: Mon Jul 16, 2007 6:35 am

Post » Wed Jun 20, 2012 6:05 am

Yes that's right, but I'm not sure you should use form IDs for the names on the properties.
User avatar
RAww DInsaww
 
Posts: 3439
Joined: Sun Feb 25, 2007 5:47 pm

Post » Wed Jun 20, 2012 12:44 am

Yes that's right, but I'm not sure you should use form IDs for the names on the properties.

All I know they are IDs. Back in Morrowind, items only has one ID. So I guess Skyrim's items has two IDs?
User avatar
An Lor
 
Posts: 3439
Joined: Sun Feb 18, 2007 8:46 pm

Post » Wed Jun 20, 2012 4:05 am

No, they still only have one ID. But using form IDs in the script doesn't work anymore, you need to use properties. And I don't know how the compiler handles hexadecimal strings.
User avatar
Arrogant SId
 
Posts: 3366
Joined: Sat May 19, 2007 11:39 am

Post » Wed Jun 20, 2012 1:54 am

No, they still only have one ID. But using form IDs in the script doesn't work anymore, you need to use properties. And I don't know how the compiler handles hexadecimal strings.

Instead of "00061cd6", it would be "ArmorDragonPriestMaskUltraHelmet"?

Also, I'm almost done with my scripts and there is two lines I think I should know. For rings and Necklaces, should I do
"Jewelry property IDHERE auto"?

And how would GetHealth work when I use it to replace "Event OnDying(Actor akKiller)"?
User avatar
Craig Martin
 
Posts: 3395
Joined: Wed Jun 06, 2007 4:25 pm

Post » Wed Jun 20, 2012 8:27 am

The guide I am reading is saying that "0002c66f", "0003ada3", etc are the IDs of those objects.
User avatar
Michael Russ
 
Posts: 3380
Joined: Thu Jul 05, 2007 3:33 am


Return to V - Skyrim