[REQ] Giving NPCS Missions

Post » Sun Jan 30, 2011 10:45 pm

Hello everyone, my idea is very simple. I want to be able to tell npcs, through dialogue, to fetch me items. I imagine it working like this; an NPC is given an order to fetch a soul gem and they are disabled. Their odds of success are calculated based on their attributes/money. If it's a hard item to get, it takes more time, if it's easy it takes less. They can either successfully retrieve your item, or fail and sometimes die trying. I'd prefer if they walk to the nearest load door before vanishing.

If anybody can create this for me, or tell me what I need to do to create it, or walk me through it, I'd be very greatful. I have very limited scripting knowledge, and I know nothing about creating dialogue in oblivion. Any help would be very welcome.

Thanks for your time!


Edit: I just thought about something... maybe it would be better to use a target spell to open a menu and from there you'd be able to select what you want them to do. that way people who use mods that let them summon creatures can also use the mod. Would this be harder or easier?
User avatar
Danny Warner
 
Posts: 3400
Joined: Fri Jun 01, 2007 3:26 am

Post » Sun Jan 30, 2011 8:45 pm

You may want to check Dunbarrow Cove, if you have it-- the Pirates there can be sent off to Plunder, and in DeepScorn, your Minion can be sent to murder people. It may give you some clues as to how Beth. did it :)
User avatar
Dawn Porter
 
Posts: 3449
Joined: Sun Jun 18, 2006 11:17 am

Post » Sun Jan 30, 2011 6:11 pm

Thank you for your reply I really appreciate it. The information you gave me sounds extremely useful and I'll definitely check them out.

From what I've read so far on those mods it seems Bethesda used dialogue.
In the past when I've used spells to try and trigger messageboxes, the messageboxes never seem to function properly, actually, nothing seems to function properly. especially in the scripteffectupdate section of the spell. How long do spells run on a target for? do you have to define that or is it defined by how many seconds the spell lasts? Regardless, no matter what choice I click on a messagebox, the effect of clicking on it is ignored and the messageboxe always closed.
User avatar
Craig Martin
 
Posts: 3395
Joined: Wed Jun 06, 2007 4:25 pm

Post » Sun Jan 30, 2011 2:29 pm

You should not use MessageBoxes with Spell Effects, because of how they work-- you are better off having the Spell Effect trigger a Quest script.

For example:

ScriptName MyQuestShort Part Short ButtonFloat fQuestDelayTimeBegin GameMode   Set fQuestDelayTime to 0.000001   If ( Part == 1 )      MessageBox" My Text "   ....   ....   EndIfEndScriptName MySpellScriptBegin ScriptEffectStart    Set MyQuest.Part to 1End


Obviously you can make it more advanced than that (for example doing checks on the NPC, before setting the variable), but that is probably the best way.

Float fQuestDelayTime <-- This is REALLY useful : it tells Oblivion how fast to run the Script. By default, this is 5, which means it runs once every 5 seconds. Making it faster will make it respond, and make your MessageBoxes smoother :)
User avatar
ImmaTakeYour
 
Posts: 3383
Joined: Mon Sep 03, 2007 12:45 pm

Post » Sun Jan 30, 2011 5:31 pm

Geeze, that makes so much more sense...no wonder I was having problems with the scripts before. Questscripts work like regular scripts attached to objects don't they? I'd need to make a quest thing then wouldn't I? Although disabling the NPC Should be a breeze, how would I enable them after a certain period of time? Would I make another script to keep track of that sort of thing or would the same script keep running? That's one thing I never understood about scripting.

For instance, when I made creatures to be summoned there was only 1 npc creature that was summonable, and when you summoned another both would follow the orders that were issued to the other...which never made sense to me. I thought each in game reference was unique? If they aren't unique then how would I go about disabling and enabling multiple actors? Is there a way to store the references for each one or something?
User avatar
Carys
 
Posts: 3369
Joined: Wed Aug 23, 2006 11:15 pm

Post » Sun Jan 30, 2011 10:07 am

It all comes down to how you do it. For example, in a Quest you have multiple Variables (the Shorts/Floats/Refs, et cetera)-- these can only hold one Value, so if you over-write them, you risk loosing the original NPC. You can easily factor this in, however, by adding a check to see if there is already an NPC doing the task. Overall, I'm not great at explaining these things-- so I'll leave that to someone else, I think; but what you want is definitely possible-- you may want to check the CS wiki, if you get chance-- these links might be useful:

Disable - http://cs.elderscrolls.com/constwiki/index.php/Disable
Enable - http://cs.elderscrolls.com/constwiki/index.php/Enable
Non-Referenced Scripts - http://cs.elderscrolls.com/constwiki/index.php/Non-reference_scripts
Quest Scripts - http://cs.elderscrolls.com/constwiki/index.php/Quest_scripts
Scripting, General - http://cs.elderscrolls.com/constwiki/index.php/Scripting
Scripting Tutorial, My First Script - http://cs.elderscrolls.com/constwiki/index.php/Scripting_Tutorial:_My_First_Script

By the sounds of it, some might be a bit basic for you (you seem to know a good chunk of it already :) ), but it may have some useful links/tips you can use.
User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Sun Jan 30, 2011 4:44 pm

Thank's a lot CDM, I really appreciate the help, especially the links! I'm going to get started working on this shortly. I've done minor scripting here and there so I understand some stuff, I just can't ever seem to grasp quite how it should be implemented.

On that note, I had one other mod I wanted to work on...it was a really easy mod actually. Basically when cast it changed the persons aggression and faction relation and such. It was basically a mind control spell, so you could break those bandits and force them to serve you haha. The only problem was when cast on a generic NPC it changed all instances of the NPC, so by taming one bandit all the other ones became docile as well.

Why would that happen? was it the functions I chose to use? same thing happened when you told them to follow you. All bandits would follow you >.<
User avatar
Chloe Mayo
 
Posts: 3404
Joined: Wed Jun 21, 2006 11:59 pm

Post » Sun Jan 30, 2011 8:12 pm

I just thought about something...if I use the quest script for the message box functions...how can I tell what NPC the player is targeting? That would be easy with a spell but since this is a seperate script wont the quest script need to figure it out somehow?
User avatar
Rebecca Dosch
 
Posts: 3453
Joined: Thu Jan 18, 2007 6:39 pm

Post » Sun Jan 30, 2011 11:40 am

Here is some of my code. I know it's a little sloppy, sorry - I haven't done this in awhile.

The idea of this code is to get familiar with messageboxes and quest scripts and to make sure I know how everything functions. What I've done is make a spell that starts a questscript that summons a messagebox. There are two options, one will spawn an NPC and the other will close the messagebox and reset the functions so I can use the spell again.

If everything works out properly I should be able to cast the spell as many times as I want and summon as many NPCS as I want but so far nothing is happening beyond a messagebox being displayed.

The goal later is to create a messagebox that I can navigate around, displaying multiple choices, and a next page button to select more options, as well as a back button for previous options.....I'm pretty far from the goal if I can't even get this to work right.

Could you explain the error in my logic here?

Also, i'd like for a few days to pass before the NPC actually shows up where the player is, but for right now I'll just settle for getting these basic functions to work haha.




This is the spell that triggers the script.

SCN ArbPsychicCallEffectShort Runningbegin scripteffectstartif getquestrunning ArbNPCMission > 0	Set Running to 1	Endif		If Running == 1	Message "Stage Is greater."			return					elseif running == 0	StartQuest ArbNPCMission					endifend scripteffectstart




This is the quest itself.

The spell seems to trigger the script fine, but what ends up happening is the questscript skips all the first messageboxes and displays "Quest Not Running."

Nothing above that line of code goes into effect.








SCN ArbPsychicQuestScriptShort CheckStageShort ButtonBegin GamemodeSetStage ArbNPCMission 1Set CheckStage to GetStage ArbNPCMissionIf Checkstage == 1Messagebox "Mission set."Set Checkstage to 0If CheckStage == 0Messagebox "Reset Checkstage."EndifEndifSet Button to GetButtonPressed	Messagebox "What would you like to do?", "Search for a mind.", "Nothing."if Button == 0 playerref.placeatme ArbMainFollower 1,1,1Messagebox "NPC Being added."SetStage ArbNPCMission 0Set Checkstage to Getstage ArbNPCMissionEndifIf checkstage == 0Messagebox "Stage is 0."Stopquest ArbNPCMissionEndifif getquestrunning ArbNPCMission == 0Messagebox "Quest not running."returnEndifElseif Button == 1SetStage ArbNPCMission 0Stopquest ArbNPCMissionendifend

User avatar
Brιonα Renae
 
Posts: 3430
Joined: Mon Oct 22, 2007 3:10 am

Post » Sun Jan 30, 2011 11:55 pm

Sorry, It wont let me edit my post.....I can't seem to get fQuestDelayTime to work either... It says it doesn't recognize what I'm trying to do.



Edit:

Okay...I got the fQuestDelayTime to work properly...I reread stuff about quest scripts and took out the redundent code above that made no sense. >.< Now, the problem I'm trying to address is that messageboxs don't seem to close properly and will constantly reopen. Hopefully this is just another one of my brainless mistakes and is easily rectified.


Ok...I fixed that problem and have encountered another.

If button == 0 what I want to happen produces results..

but if it's if button == 0

what I want to happen here then it doesn't work. Nothing below that functions properly...WHY?! *rips hair out*
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Sun Jan 30, 2011 2:48 pm

SCN ArbPsychicQuestScript Short Part  Short Button Float fQuestDelayTime  Begin GameMode 	Set Button to GetButtonPressed   Set fQuestDelayTime to 0.000001    If ( Part == 1 ) 	      MessageBox"What do you wana do?", "Summon Npc.", "Lol close." 	;Nothing works passed this point. Why?if button == 0player.placeatme ArbMainFollower 1,1,1  message "placed."set part to 0Elseif Button == 1Messagebox "Very Well."Set Part to 0Endif    EndIf End  



I changed the code to exactly whay you gave me after my own failed, but yours still has the same problem. What am I doing wrong?
User avatar
Bloomer
 
Posts: 3435
Joined: Sun May 27, 2007 9:23 pm

Post » Sun Jan 30, 2011 5:05 pm

OK, I'll try and help :)

One: You're not defining Button properly-- usually, what I do is something like this :

If ( Part == 1 )    MessageBox" Some Text", "option one", "option Two"   Set Part to 2ElseIf ( Part == 2 )  Set Button to ( GetButtonPressed + 1 ); <-- This Returns the Button; I add a +1, as the first button is "0", so this just makes it easier if you're running through it quickly :)  If ( Button == 1 )    ;Do something  Elseif ( Button == 2 )    ; Do Something Else  EndIfEndIf


And so on.
What this does is the following:
1. First Run, hits Part 1, and presents a message box. Finishes the Script, doing nothing else.
2. Second Run, hits Part 2, and checks the Button Variable, and reacts to it, doing nothing else.
3. Third Run, hits Part 3, and does what it must
4. and so on

GetButtonPressed returns the LAST button pressed in a Menu, for ONE Time-- i.e., if you ran "GetButtonPressed" 100 times, the first would read a number between 0 - 9 (you can only have 10 buttons at a time), and the other 99 would be -1.


Defining the NPC is easy-- you can just use a Variable, again :)

In your spell, use something like :

Set BaseTarget to GetSelfSet MyQuest.NPCTarget to BaseTarget


On Actors-- be careful editing them: a lot of effects edit the BASE Record, rather than the Instance of the Record, meaning all versions will spawn the same (such as if you add an Ability to an NPC)
User avatar
Joey Avelar
 
Posts: 3370
Joined: Sat Aug 11, 2007 11:11 am

Post » Sun Jan 30, 2011 10:03 pm

Everytime you respond things start to make massive amounts of sense. Without you I'd certainly be nowhere....haha this is great - thank you!. Everything is working as it should be at the moment.

Now that the NPC can be summoned the only thing left to do is put it on a delay, perhaps after a day the NPC would show up.

I'm going to try and work on that, but if you read this before I manage to make any progress could you explain the easiest way to do it?

What I dont understand is why it simply wouldn't process what I saying after part 1, but I guess it makes sense though because other wise the messagebox would be processed as well, and this way here the spell always sets the part to 1.
User avatar
Taylor Thompson
 
Posts: 3350
Joined: Fri Nov 16, 2007 5:19 am

Post » Sun Jan 30, 2011 12:24 pm

This new addition to the code I wrote seems to work perfectly! Thank you so much for your help! Will you look it over and see if I've done everything correctly? or if there are any small improvements that can be made? Now that this is functioning is there a way to summon a different reference of an NPC each time so they don't follow the same commands? Do I need to create each reference that is summoned or can they game do this for me? Also, is there any way to get them to look differently as well? Facial features wise if I have generic NPCS that are being summoned?


SCN ArbPsychicQuestScript Short Part  Short Button Float fQuestDelayTime Short StartDayBegin GameMode Set fQuestDelayTime to 0.000001    If ( Part == 1 ) 	      MessageBox" You focus your mind and you...", "Do Nothing.", "Call the weak minded." 	 Set Part to 2		Elseif ( part == 2 )		Set Button to ( GetButtonPressed + 1 )			If ( button == 1 )			Messagebox "Very Well."			Set part to 0									Elseif ( Button == 2 )						Set Part to 3EndifEndif													If ( Part == 3 )				Set StartDay to GameDaysPassed				message "You search for a willing mind. It won't be long now"				Set Part to 4							Elseif ( Part == 4 )  && GameDaysPassed > StartDay	Messagebox "A willing mind answers the call."	Player.placeatme ArbMainFollower 0,10,1 	Set Part to 5 EndifEnd

User avatar
R.I.p MOmmy
 
Posts: 3463
Joined: Wed Sep 06, 2006 8:40 pm


Return to IV - Oblivion