Jump to content

Creating a quest


Garfield

Recommended Posts

Hy

 

I'm modding a pair of NPC, and I would like them to have a personnal quest: basically, two or three encounters, then a batlle, all that in a little time, let say something like a week in game.

 

So, here are my questions:

-How trigger the first encounter randomly, and then, how to set timers for the next encounters?

-And finally, in which fileto code it? The Dialog file?

 

Thanks in advance

 

Garf

Link to comment

A quest like that will be a combination of cre files (your new actors that attack or interact with your party), baf/bcs files (that direct the actions) and d/dlg files that have the dialogues.

 

To start the encounter you can either go from area file script (if you want the encounter to be connected to a certain area in the game) or from the NPC in question Override Script. I prefer Override script because it is easier to test - no need to re-enter the new area.

 

I am not sure if the encounter can be made entirely random, but you can sort of do it in such a way, by setting a timer after a certain event (for example, after the party entered area X, or talked to character N, or done a quest F, or NPC spent that long in the party).

 

Setting timers is explained very well in the IESDP. You can set a timer either in BCS script file (if no previous dialogue was held), or in DLG file via DO function if there was a dialogue).

 

Basically what I will do (and I am not the best quest coder out there) would be the following:

 

1) Set a Timer for the quest to kick in, in the NPC override script (say 3 hours after the NPC joined the party). Again, in the NPC override script add the block that summons the Quest Giver CRE after the timer expired and the party is not in one of the forbidden locations to either 'drop' onto the party (CreateCreature on Player1) or CreateCreature off Screen and move it to the party.

 

2) In the Quest Giver BCS script made it initiate the dialogue. Add her dialogue to a separate D file that will contain all quest related dialogue - a few DLG could result from one D (don't forget to do the BEGIN NNNN for every new CRE you are adding on that file.

 

In that Dialogue File set a Timer for the second encounter.

 

3) Repeat the procedure till all the encounters ran its course and the quest is coded in.

Link to comment

I have now another problem with quest-coding.

 

I'm trying to have a non-joinable NPC talk to Nalia at the first meeting with the party. Here is how I coded it:

 

BEGIN ~R!HEA~

 

CHAIN IF

  ~NumTimesTalkedTo(0)

  InParty("NALIA")

  See("NALIA")

  !StateCheck("NALIA",STATE_SLEEPING)~ THEN R!HEA Firstmeeting

  ~Oh! What a pleasant surprise! Isn't it Ms De'Arnise ? I am delighted to see you, young lady.~

  ==BNALIA

  ~I am sorry, madam, but I do not think we have ever met.~

  ==R!HEA

  ~Ho no, dear, we haven't, but I hope we could have a few words together anyway. My name is Heather.~

  ==BNALIA

  ~Well... Nice to meet you, Lady Heather... But, what do you want to talk about?~

  ==R!HEA

  ~Well, dear! Do not feel ill-at-ease, I am about to make you an offer you cannot refuse.~

  ==BNALIA

  ~But, I hardly know who you are!~

  ==R!HEA

  ~Hush, little girl. Listen to me carefully.~

  =

  ~(Heather voice becomes lower, as she approaches Nalia's face and whispers in her ear)~

  =

  ~Go to the Shadow Thieves Guild, in the Docks. Talk to Violet there, she will tell you more about the Sorority.~

  ==BNALIA

  ~Well, all this is a little too mysterious for me, I'm afraid.~

  ==R!HEA

  ~(Heather speaks now in a regular tone) You may go now, child.~

END

 

And the mod won't install, telling me there is a syntax mistake here:

THEN R!HEA Firstmeeting
the mistake seems to be the "!" I use in the filename.

 

But I must admit I am not sure about how coding quest-dialogues.

Here is the bit of my TP2 concerned with the dialogues:

COMPILE ~R!Rose\Dialogues\R!HEA.d~

USING~~

 

Is that enough? Or should I the same thing as with an joinable NPC?

(APPEND ~pdialog.2da~

~File FileP FileJ FileD~

UNLESS ~FIle~

UNLESS ~25POST~)

 

Garf

Link to comment

I changed the END by an EXIT, but i still have the same error message:

 

[R!Rose\Dialogues\R!HEA.d] PARSE ERROR at line 7 column 46-46

Near Text: !

syntax error

 

[R!Rose\Dialogues\R!HEA.d] ERROR at line 7 column 46-46

Near Text: !

Parsing.Parse_error

ERROR: parsing [R!Rose\Dialogues\R!HEA.d]: Parsing.Parse_error

ERROR: compiling [R!Rose\Dialogues\R!HEA.d]!

Stopping installation because of error.

Link to comment

Hmm, weidu does indeed not like the "!" - I replaced all the R!HEA with RHEA in your code and weidu encountered no problems at all.

 

So, maybe it's best to change your prefix - and maybe The Bigg's post Jastey linked to should be updated.

 

EDIT: You typed your last post while I wrote mine. It seems the tildes will make weidu read R!HEA as a name and not as some meaningless code with a negation in it. Well, if you don't object to using tildes all the time, your prefix should be fine.

Link to comment

Silly question: may I use the command RealSetGlobalTimer in a dialogue, to start the timer after a certain banter, or do I really have to put it the NPC's script?

 

EDIT: btw, how can I spawn a creature a few meters away from the party, with no specific area restriction?

Link to comment
Silly question: may I use the command RealSetGlobalTimer in a dialogue, to start the timer after a certain banter, or do I really have to put it the NPC's script?

 

EDIT: btw, how can I spawn a creature a few meters away from the party, with no specific area restriction?

 

Yes, you can put RealSetGlobalTimer in a dialogue. As a rule of thumb you can put any scripting action in a DO ~~ part of a dialogue, however its not the best idea for some actions.

 

And as for your second question, CreateCreatureObject should do it or CreateCreatureObjectDoor if you want the dimension door graphic upon spawn.

Link to comment

Okay, I'm having a problem with timers.

 

Here is the joining dialogue of the NPC, were the timer stars (I put it at 900 seconds to make it easier to test)

IF ~~ THEN BEGIN Join
 SAY ~Why not, after all... I need some money, and some excercise...~
 ++ ~You have to know that I'm trying to save a friend, Imoen, who has been captured by the Cowled Wizards.~ + Imo
 ++ ~I'm searching for a mage, Irenicus... He owes me something..~ + Ire
 ++ ~Let's go then!~ + Go
END

IF ~~ THEN BEGIN Imo
 SAY ~Oh god, some heroic deed... Well, I should go with you anyway...~
 IF ~~THEN DO ~SetGlobal("RakJoined","GLOBAL",1)
 RealSetGlobalTimer("Rk#Questart","GLOBAL",900)
 JoinParty()~ EXIT
END

IF ~~ THEN BEGIN Ire
 SAY ~Ha! I like the sound of revenge!~
 IF ~~THEN DO ~SetGlobal("RakJoined","GLOBAL",1)
 RealSetGlobalTimer("Rk#Questart","GLOBAL",900)
 JoinParty()~ EXIT
 END

IF ~~ THEN BEGIN Go
 SAY ~Yes, let's go.~
 IF ~~ THEN DO ~SetGlobal("RakJoined","GLOBAL",1)
 RealSetGlobalTimer("Rk#Questart","GLOBAL",900)
 JoinParty()~ EXIT
END

 

Then the override cript of my NPC:

IF
 InParty("Rk#Ra")
 Global("Rk#BoyExists","GLOBAL",0)
 RealGlobalTimerExpired("Rk#Questart","GLOBAL")
 AreaType(CITY)
THEN
 RESPONSE #100
 SetGlobal("Rk#BoyExists","GLOBAL",1)
 CreateCreatureObject("Rk#Boy",Player1,0,0,0) 
END

 

But after 900 seconds, nothing happens... The creature does not spawn. I checked, Rk#Boy was the porper death variable of the creature I wanted to spawn.

It works fine wite the CreateCreature CLUA, but if I use the AdvanceRealTime(900) CLUA, nothing happens, that's why I think there is some problem with the timers...

 

If someone could help me.. ^^

Link to comment

I would recommend the coding technique of commenting down the code until it works and then restoring back i.e. comment out all but conditions except a trivial one, Global("Rk#BoyExists","GLOBAL",0) would probably be best. Reinstall and see if it works. Then add each line back one by one until you find the one that's causing the problem.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...