A little scripting help needed

Post » Thu Apr 29, 2010 6:39 pm

Hello!

Currently I'm working on a mod that involves the player killing certain people.
Now, I made a camp in the hills of Cheydinhal (sp?), in this camp there are seven traders.
I would need a script to advance a quest if all seven of those traders are killed by the player.
I've tried copying parts of the mages guild quest (the kill zombie quest, skingrad rec.) but without any luck.
I've also tried the cs wiki, but I'm not good enough in script to understand it all.
Any help would really be appreciated!
Thanks in advance,

-Star
User avatar
Laura Shipley
 
Posts: 3564
Joined: Thu Oct 26, 2006 4:47 am

Post » Thu Apr 29, 2010 4:16 pm

There are better scripters than me around here, but I'll give you a rough idea.

If the traders are unique NPC's that are not respawned, then you coudl use an On Death script that adds 1 to a variable. When that variable reaches the correct number (5 traders would result in a total of 5 for the variable after they are all dead) the quest can move on.

What I would do is reference the quest variable.

This script is added to each of the NPC's.
Begin OnDeath     set myQuest.traderDeath to myQuest.traderDeath + 1End


In your quest script create a variable for traderDeath and check for when it reaches the correct number with 'if traderDeath == 5' or however many traders there are.
User avatar
Sudah mati ini Keparat
 
Posts: 3605
Joined: Mon Jul 23, 2007 6:14 pm

Post » Thu Apr 29, 2010 1:05 pm

If you need an example to follow look at the three girls in the Siren Deception.quest - Faustina, Signy and Tsarrina - and the MS04 quest for how the results are handled.
User avatar
Victoria Vasileva
 
Posts: 3340
Joined: Sat Jul 29, 2006 5:42 pm

Post » Thu Apr 29, 2010 9:02 pm

*Sigh* no luck, I'm probably messing things up, so I'll show my script.

Scn StartraderdeadscriptShort traderDeathBegin OnDeath     set traderDeath to 1EndBegin OnDeath if traderDeath == 7setstage DarkStaralive 20endifend


the npcs I want dead are references startrader1 up to 7
the quest is named 'DarkStaralive'

I've tried Filly's example, but failed to make it work!
I then took a look at the above quests and this is what I came up with.
Any help please?

-Star
User avatar
Sabrina garzotto
 
Posts: 3384
Joined: Fri Dec 29, 2006 4:58 pm

Post » Fri Apr 30, 2010 3:09 am

Scn Startraderdeadscriptshort traderDeathBegin OnDeath     set DarkStaralive.traderDeath to DarkStaralive.traderDeath + 1  ;;;(Why use a variable in your quest script?  Because each NPC will start off with 0 for it's traderDeath variable, making it useless for what you want.  You need to access a variable in a quest script so it is saved and not lost.)     set traderDeath to DarkStaralive.traderDeath ;; (You can't use quest variables in an object script, they must be set to a variable you have in this object script.  So this sets the local variable the NEW value of the quest variable.     if traderDeath == 7          setstage DarkStaralive 20     endifEnd


Now you need a quest script. You can make a quest script by simply changing the top right drop down list in the script window to say Quest instead of Object. This quest only needs to hold the variable, no need for a Begin and End block, unless of course you want something else in there at a later date.

Don't forget to add the quest script to your quest or it won't be accessible by the object script that is calling DarkStaralive.traderDeath.

short traderDeath

User avatar
kasia
 
Posts: 3427
Joined: Sun Jun 18, 2006 10:46 pm

Post » Fri Apr 30, 2010 2:43 am

So basicly, if I use the script you provided it should work?
So sorry for being such a noob :D

-Star
User avatar
Mrs Pooh
 
Posts: 3340
Joined: Wed Oct 24, 2007 7:30 pm

Post » Thu Apr 29, 2010 11:24 pm

So basicly, if I use the script you provided it should work?
So sorry for being such a noob :D

-Star


Haha, being new to an area is nothing to apologize for, we've all been there!
User avatar
Floor Punch
 
Posts: 3568
Joined: Tue May 29, 2007 7:18 am

Post » Thu Apr 29, 2010 12:28 pm

Sorry, but I'm really confused :P. Basicly if I use that script it should work or...? Do I have to add anything to my quest or...?

-Star
User avatar
Chris Johnston
 
Posts: 3392
Joined: Fri Jul 07, 2006 12:40 pm

Post » Thu Apr 29, 2010 2:18 pm

The quest needs a script where the total killed count is kept. It doesn't have to contain anything but
Scriptname MyQuestScriptshort traderDeath

which you mark as a Quest script when you save it, and then select it as the script for the quest on the first tab.

In the sample code you already have you'll notice that "MyQuest" refers to the name of the Quest, not the name of the script. The script name is only used to connect it to the quest via the selection on the first tab of the quest dialog. However, it's a good practice to name the script as questnameScript, just so you always know what it is. The Construction Set doesn't like two things having the same name, even if they are different types, so most mod-makers put Script at the end of a Script name, and Ref at the end of a item reference, and so on, to make them different from the quest, or the base item. Consistent naming means you don't spend all your time looking in the lists to remember what you called it!
User avatar
Wane Peters
 
Posts: 3359
Joined: Tue Jul 31, 2007 9:34 pm


Return to IV - Oblivion