Wanting to spawn NPC's after a certian ammount of time passe

Post » Sun Nov 18, 2012 2:35 pm

Ive tried allot to get this to work. Thus fa,r nothings worked. I was told by a fine gentlemen in the quick questions, quick answers thread, to use an OnUpdate, along with a RegisterForSingleUpdateGameTime. however, being pretty new (And rusty form what i do know) to all of this, I couldn't figure out what to write down, where to attach it, etc, etc. Basically, as my title say,s i want to make it so that after my quest hits stage 20, after some in-game minutes, spawns some NPC's a little ways off. The NPC's are frenzied, and Will attack the camp. That's pretty much what I've got. I WOULD show you guys the code I'm using, but i forgot to save it. >.> And looking through the visual papyrus reference is only so good for finding words, not how they work together or even what they do. (I do click them, but half the time the code examples don't really help)

Any help would be deeply appreciated.
User avatar
Jesus Lopez
 
Posts: 3508
Joined: Thu Aug 16, 2007 10:16 pm

Post » Sun Nov 18, 2012 5:13 am

Ok, first thing to do is place your NPC's where you want them to spawn. Then place an xmarker somewhere near them. Double click on it and check the box called "initially disabled". Now for each of your NPC's, double click them, navigate to the enable parent tab and then refer it to the xmarker (if you have a lot of NPC's then the http://www.creationkit.com/Batch_Assignment is a godsend). That should be all you need to do in the render window

Now open up your quest and navigate to the stage 20. In the papyrus fragment area type a ";" and then compile it. Now hit ok until you have exited your quest window (this step might seem annoying, but it's necessary so that the ck can create the script file thereby allowing us to alter properties). Now go back into the quest and navigate to stage 20 again. Click on the properties button near the papyrus fragment. Make a new ObjectReference property called "SpawnMarker" (or whatever you want to call it) and then fill its value with the xmarker reference you added earlier. Click ok. Now paste the following into the fragment and then compile:

RegisterForSingleUpdate(60)Event OnUpdate()   SpawnMarker.Enable()EndEvent

The above is set up for a 60 second delay. Just change the number in the registerforsingleupdate brackets for how ever long you want to wait (in seconds). If you want it to be for in-game hours instead just use RegisterForSingleUpdateGametime() with whatever number you type in the brackets being hours. Anything else you want to add (eg setstage(30), etc) should be added within the OnUpdate event

Hopefully that should work. I'm at work at the moment so it's all from the top of my head so there is a slight possibility of mistakes. Let us know how it goes

- Hypno
User avatar
Daniel Brown
 
Posts: 3463
Joined: Fri May 04, 2007 11:21 am

Post » Sun Nov 18, 2012 5:52 am

Ok, ill let you know with an edit to this post.

EDIT: Well ,i got an error.


Starting 1 compile threads for 1 files...
Compiling "QF_ELDRquest01_01000D63"...
d:\pc gaming folder\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_ELDRquest01_01000D63.psc(18,0): mismatched input 'Event' expecting ENDFUNCTION
d:\pc gaming folder\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_ELDRquest01_01000D63.psc(22,0): missing EOF at 'EndFunction'
No output generated for QF_ELDRquest01_01000D63, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on QF_ELDRquest01_01000D63


Here is a pic of the code i used.

http://img846.imageshack.us/img846/8104/errorkmi.png

And just the code in general, in case the pic doesn't load.

SetObjectiveCompleted(10)SetObjectiveDisplayed(10)RegisterForSingleUpdate(60)Event OnUpdate()   SpawnMarker.Enable()EndEvent
User avatar
Adam Kriner
 
Posts: 3448
Joined: Mon Aug 06, 2007 2:30 am

Post » Sun Nov 18, 2012 3:34 am

Ok maybe fragments can't have events? Sorry for the little detour :P

Instead, leave the register in the fragment, but take the rest and paste it in a new script in the scripts tab of the quest window

- Hypno

User avatar
Eddie Howe
 
Posts: 3448
Joined: Sat Jun 30, 2007 6:06 am

Post » Sat Nov 17, 2012 10:38 pm

Do you mean make a new script in the script tab/window, or edit the script that's already there?

EDIT: oops, missed what you said. lol.

EDIT 2: I'm getting more compilation errors.

Starting 1 compile threads for 1 files...
Compiling "enemySpawnScript"...
d:\pc gaming folder\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\enemySpawnScript.psc(4,3): variable SpawnMarker is undefined
d:\pc gaming folder\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\enemySpawnScript.psc(4,15): none is not a known user-defined type
No output generated for enemySpawnScript, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on enemySpawnScript


I put This code in a new script in the script stab on my quest.

Scriptname enemySpawnScript extends Quest  Event OnUpdate()   SpawnMarker.Enable()EndEvent

This is the code in the papyrus fragment on stage 20

SetObjectiveCompleted(10)SetObjectiveDisplayed(10)RegisterForSingleUpdate(300)

The papyrus fragment loads fine.
User avatar
sally R
 
Posts: 3503
Joined: Mon Sep 25, 2006 10:34 pm

Post » Sun Nov 18, 2012 10:12 am

You needed to do the property step. Here is the same code with half of it done. Once it compiles, exit the papyrus script then click on the properties button. Select the newly made SpawnMarker property, then set its value to your xmarker reference

Scriptname enemySpawnScript extends Quest  ObjectReference Property SpawnMarker  AutoEvent OnUpdate()   SpawnMarker.Enable()EndEvent

- Hypno

EDIT: also, it's a good idea to delete the property i mistakenly told you to make earlier: go back to the stage 20 fragment, click the properties button and clear the value of the unused SpawnMarker property and then click ok. Now head back to the scripts tab, locate the script for your quest fragment (it will start with QF), right click and choose "edit source". Locate the line "ObjectReference Property SpawnMarker auto" and delete it. Ctrl+s and then it's done. I know it's a lot of back and forth, but IIRC it's important to do it in that order.
User avatar
Tyrel
 
Posts: 3304
Joined: Tue Oct 30, 2007 4:52 am

Post » Sun Nov 18, 2012 12:16 am

Ok, it compiled fine. Anytihng else i need to do? (testing now. will add an edit when i'm done)
User avatar
Roddy
 
Posts: 3564
Joined: Fri Jun 15, 2007 11:50 pm

Post » Sun Nov 18, 2012 11:02 am

As long as you've hooked up the property to the xmarker, it "should" work (I think :P)

- Hypno
User avatar
Romy Welsch
 
Posts: 3329
Joined: Wed Apr 25, 2007 10:36 pm

Post » Sun Nov 18, 2012 8:50 am

Ok then. Because i tested, and no bandits were seen.
User avatar
JAY
 
Posts: 3433
Joined: Fri Sep 14, 2007 6:17 am

Post » Sun Nov 18, 2012 4:50 am

Ok now I don't know why lol

This is where testing with message boxes comes into play.

debug.messagebox("started stage 0")

Put that line in each of your quest stages and one inside the seperate script, within the onupdate() block (don't forget to change the text within the brackets accordingly). That should help pin point roughly where things are going wrong. To tell you the truth I'm pretty stumped, but if I was telling you wrong information, usually somebody else would've posted pointing it out :shrug:

- Hypno
User avatar
Calum Campbell
 
Posts: 3574
Joined: Tue Jul 10, 2007 7:55 am

Post » Sun Nov 18, 2012 9:46 am

Hey guys sorry to jump in, but I myself have had issues enabling objects the usual way in a quest script. I've since always used aliases and never had an issue.

So maybe try that. Make the market a quest alias, specific reference, and select your marker in the reference window. Then in the fragment instead of the standard enable script use:

Alias_Marker.GetReference().Enable()

Make Marker the name you gave to your marker in the alias tab.
User avatar
Marine Arrègle
 
Posts: 3423
Joined: Sat Mar 24, 2007 5:19 am

Post » Sun Nov 18, 2012 3:21 am

BBD, no need to apologise mate, I was hoping somebody was going to jump in! In my head all of what I've suggested "should" work. But I'm stumped now. When I get home tonight after work I might try making a test.esp to try and get to the bottom of this.

Worth a try making a quest alias, cheers for the suggestion

Just to clarify:
Go to the quest alias tab. Right click and select new referenceAlias. In the window that pops up, give it a unique name (eg "SpawnMarker"), then tick the specific reference and then fill it with your xmarker (if the window is too big for your monitor and you cannot see the "ok" button, click on the name box, then while holding shift hit tab twice, then press enter)

You can leave the stage 20 fragment as it is, then change your spawn script to the following:

Scriptname enemySpawnScript extends Quest  ReferenceAlias Property Alias_SpawnMarker  AutoEvent OnUpdate()   Alias_SpawnMarker.Enable()EndEvent

Dont forget to set the Alias_SpawnMarker property to point to your new alias via the properties button.


I am not sure why my previous suggestion did not work. I'm pretty sure I've enabled and disabled xmarker's through script before without the need to put them in alias's :shrug:

- Hypno
User avatar
quinnnn
 
Posts: 3503
Joined: Sat Mar 03, 2007 1:11 pm

Post » Sat Nov 17, 2012 11:44 pm

Yea it's just another way of doing it :) I'm not as good at scripting as you mate, but do deal a lot with enabling and disabling lots of things for my hunting quests.
User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am

Post » Sun Nov 18, 2012 11:39 am

I wouldn't consider myself "good at scripting", I've still got a whole lot to learn. I feel comfortable with the basics. Through reading the threads in this forum, I find I'm starting to understand and actually retain more and more. This place is brillient for absorbing other peoples hard-earned knowledge :P

Cheers for the compliment anyhow :)

- Hypno
User avatar
Fiori Pra
 
Posts: 3446
Joined: Thu Mar 15, 2007 12:30 pm

Post » Sat Nov 17, 2012 11:24 pm

Wow, i missed something. Anyways, i just had it to much longer then really was reasonable. I had it at 300 seconds. Now its 70 second.s works just fine.
User avatar
Roberta Obrien
 
Posts: 3499
Joined: Tue Oct 23, 2007 1:43 pm

Post » Sun Nov 18, 2012 2:15 pm

I wouldn't consider myself "good at scripting", I've still got a whole lot to learn. I feel comfortable with the basics. Through reading the threads in this forum, I find I'm starting to understand and actually retain more and more. This place is brillient for absorbing other peoples hard-earned knowledge :P

Cheers for the compliment anyhow :)

- Hypno

Exactly the same for me mate, I find myself browsing issues for scripts that I may need at some point :P
User avatar
Alexxxxxx
 
Posts: 3417
Joined: Mon Jul 31, 2006 10:55 am

Post » Sun Nov 18, 2012 9:05 am

Wow, i missed something. Anyways, i just had it to much longer then really was reasonable. I had it at 300 seconds. Now its 70 second.s works just fine.

Nice one! Glad it worked out. Sorry to take you on a bit of a detour, but consider it a good learning experience :P

- Hypno
User avatar
Hope Greenhaw
 
Posts: 3368
Joined: Fri Aug 17, 2007 8:44 pm

Post » Sun Nov 18, 2012 2:33 am

Nice one! Glad it worked out. Sorry to take you on a bit of a detour, but consider it a good learning experience :tongue:

- Hypno

It is a good learning experience. Now to summon a Re-textured black dragon who speaks to the player atop a glowing crystal at midnight after the fight... And have a custom sound effect play... and kill everyone there while the players asleep... .darn man, I'm starting to realize just how far in over my head i am. :ermm:
User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm

Post » Sat Nov 17, 2012 11:48 pm

Some people learn better by being thrown in the deep end. Just take it in small milestones mate. Remember the Creation Kit Wiki is your friend. Plus don't hesitate to post a problem in here. As long as you show you've already had a try first, then 9 times out of 10 somebody will post some help. Good luck!

- Hypno
User avatar
A Boy called Marilyn
 
Posts: 3391
Joined: Sat May 26, 2007 7:17 am

Post » Sun Nov 18, 2012 12:02 pm

Ok. Thanks for the help, my good sir. ^^
User avatar
Penny Flame
 
Posts: 3336
Joined: Sat Aug 12, 2006 1:53 am


Return to V - Skyrim