Kinda recreating atronach forge script

Post » Sun Sep 13, 2015 7:18 am

Well... Um. I'm kinda doing a mod where you can place items in a chest, then activate another object to spawn an NPC (similar to the atronach forge ordeal) but don't necessary know where to start... I've already took note that scripting in Skyrim is a lot different in Morrowind (I manage to do this in Morrowind just fine).

Basically, I need the script, upon activation, to check items in the chest. If they are in the chest, then it will spawn NPC(s) accordingly within the same cell that the player is in.

Also, what's the generic "despawn" script? (Removes an NPC from the world upon death ordeal. Kinda like how summons are removed upon death).

User avatar
Joey Avelar
 
Posts: 3370
Joined: Sat Aug 11, 2007 11:11 am

Post » Sat Sep 12, 2015 6:05 pm

I'd look through some basic papyrus tutorials to get started. With papyrus, everything is controlled through events. So for example, you can do something like this for the activation object/chest script.

Scriptname _test_testscript extends ObjectReferenceObjectReference Property kMarker Auto ;XMarker for spawning new NPCsObjectReference Property kChest Auto ;points to the chest;alternatively you can probably link ObjectReferences together in the CK and use GetLinkedRef()MiscObject Property kObject AutoActorBase Property kEvilActor AutoEvent OnActivate(ObjectReference akActionRef)    if kChest.GetItemCount(kObject)        kChest.RemoveItem(kObject)        kMarker.PlaceActorAtMe(kEvilActor)    endIfendEvent

This code needs more work though. If the player mashes on the lever, the OnActivate event will fire each time. States are a good way to prevent this from happening. I would check some other lever scripts, as I believe they do stuff to make sure the animation syncs with script states.

The despawn script is probably simpler. The OnInit() event is the go to event for running code right away. When attached to an actor/object, it will fire when it gets loaded for the first time (and the script is initialized). Something like this may suit your needs, or close to it depending on exactly what you want.

Scriptname _test_testscript extends ActorEvent OnInit()    ;play some cool visual and sound effects if you want    RegisterForSingleUpdate(60.0) ;triggers the OnUpdate event in 60 secondsendEventEvent OnUpdate()    KillMe()endEventEvent OnDeath(Actor akKiller)    KillMe()endEventFunction KillMe()    GoToState("") ;go to the "DeadState" state to ignore other potential KillMe()    ;play some cool visual and sound effects if you want    Disable()    Delete() ;make sure you clean up with deleteendFunctionState DeadState    Function KillMe()        ;do nothing    endFunctionendState
User avatar
suzan
 
Posts: 3329
Joined: Mon Jul 17, 2006 5:32 pm

Post » Sun Sep 13, 2015 3:24 am

Thanks for the reply and I'm gonna have to look into this stuff. However, I did finally opened up the Atronach Forge's script and it was kinda simpler than expected... Most of the spawning, for example, is controlled by lists (which are easy to make), not by the scripts themselve. It even have proper despawning.

Problem is, the script itself references everything differently and I have no idea how to properly change the script to make it suit for my needs. I also don't necessary know everything I need to connect together. For example, I got the lever itself working and connected to the chest but hadn't figured out how to connect the lists to the lever. (I've noticed if you go to the main two lists for the Atronach Forge, they only have one usage in-game and it is tied to the lever/button).

So... I need to figured out how to properly edit the script for my needs, and figured out how to connect the dots, so to say, then I finally will have a good start. (Mind you, would need to expand the script a bit for moments when I'm spawning more than one target at a time or wanting specific targets spawning at specific spots... Or even allowed multi-spawning).

User avatar
Stephanie I
 
Posts: 3357
Joined: Thu Apr 05, 2007 3:28 pm

Post » Sat Sep 12, 2015 5:12 pm

The properties point to the lists:

formlist property RecipeList auto{Master list of valid recipes. Most Complex should be first}formlist property ResultList auto{Master list of recipe results.  Indices of Rewards MUST MATCH those of the recipe list}formlist property SigilRecipeList auto{Recipes that are only available when sigil stone is installed}formlist property SigilResultList auto{Items attainable only with sigil stone installed}

When you add your script to the object in the CK, there is an Properties button. Here you tell the CK what you want these properties to point to. With papyrus, the name of the properties does not have to match the Editor ID.

User avatar
lucile
 
Posts: 3371
Joined: Thu Mar 22, 2007 4:37 pm

Post » Sat Sep 12, 2015 10:06 pm

Awesome! I'll be looking into this now.

User avatar
Chase McAbee
 
Posts: 3315
Joined: Sat Sep 08, 2007 5:59 am

Post » Sun Sep 13, 2015 6:31 am

Hm... It keeps failing to compile my script. Think ye' can provide some light on maybe why?

User avatar
louise fortin
 
Posts: 3327
Joined: Wed Apr 04, 2007 4:51 am

Post » Sat Sep 12, 2015 10:32 pm

Post the compile error :)

User avatar
cheryl wright
 
Posts: 3382
Joined: Sat Nov 25, 2006 4:43 am

Post » Sat Sep 12, 2015 2:48 pm

That's the thing. There's no error popping up... Unless I have to go read a log for it.

User avatar
Latino HeaT
 
Posts: 3402
Joined: Thu Nov 08, 2007 6:21 pm

Post » Sun Sep 13, 2015 12:18 am

Then how do you know it fails?

User avatar
Mandy Muir
 
Posts: 3307
Joined: Wed Jan 24, 2007 4:38 pm

Post » Sun Sep 13, 2015 4:24 am

It'll say "Failed" on the side instead of "Compiling..."

User avatar
Cat
 
Posts: 3451
Joined: Mon Dec 18, 2006 5:10 am

Post » Sun Sep 13, 2015 4:19 am


Click on the "failed" line and it will show you the compiler output in the bottom half of the window.
User avatar
Genevieve
 
Posts: 3424
Joined: Sun Aug 13, 2006 4:22 pm

Post » Sun Sep 13, 2015 7:10 am

Okay. Well. I've figured out the problem... So to say. It's because I have SKSE installed apparently or something like that. Something is screwing up a lot of the original scripts that were "missing" or unknown so ye'h...

Someone else could http://www.mediafire.com/download/tdn65u8sz4fn19t/JuseyLeverPull.zip for me and see what's up. The script itself should work just fine in-game, at leazt I'm assuming... (This is why I prefer to stick to level creation and the other stuff. That stuff is much more fun and easier to do. Scripting is a pain).

User avatar
Claire
 
Posts: 3329
Joined: Tue Oct 24, 2006 4:01 pm


Return to V - Skyrim