//NOption(strnumber,node,intelligence);
//Reply(strnumber);


/*
Madness-strings: make a number of "Quinn is mad" nodes. A function is called whenever the PC say something to determine whether a 
"Madness" string is to be called. Random, depending on speech, luck and a modifier.

When a madness string is called, the PC will "know" that the captain is mad. A variable is set, which must be true for the PC to be able to heal him with DJ.

GVAR_COTC_QN_Quinn_mad  (0)
   0 = PC doesn't know that Quinn is "mad"
   1 = PC knows that Quinn is "mad" (required for the PC to heal Quinn)

GVAR_COTC_QN_Beast      (0)
   0 = PC haven't found the deathclaw
   1 = PC have found the deathclaw, but not killed it
   2 = PC have killed the deathclaw

LVAR_Beast              (0)
   0 = PC doesn't know about Quinn's Nemesis
   1 = PC knows that Quinn is searching for the Deathclaw (the beast) that killed his wife Polly



A branch where Quinn talks about the beast killing his wife. PC can question the existance of the beast.

A branch where the PC claims to have killed the beast (always available, even if the PC didn't kill it).

IDEA: Make an addition to obj_dude, where a global is set to true if the PC has been close to a deathclaw. A reminder to set the global to true also if somebody mentions the word "deathclaw".

A doctor path where the PC is trying to make sense out of Quinn's medical condition. May require some research. 

A branch where Quinn talks about his job.

A branch where Quinn talks about the town. history lesson, yay!

A branch where the PC talks Quinn into taking the DJ -> Quinn's trippy map -> Quinn is healed

A thank-you branch where Quinn expresses his gratitude / Quinn recognizes that he feels much better than before





Ideas for madness strings:

1. Voices in head: shutup! shutup I tells ye!
2. Quinn mistakes the PC for being somebody else - the beast? -polly?
3. Quinn sees the monster.
4. Quinn becomes pale, believing he killed polly...
5. Quinn suddenly becomes extremely "busy". Doesn't remember the PC at all.


*/



//Quinn is mad. Hence, his responses will not always be what they "should". All branches will have
//fairly "normal" answers, but sometimes (most of the times) there will be a probability that Quinn
//"goes mad", and the dialogue path you were on is lost for something else, something incoherent.
//For example, the Quinn and the PC might be talking about the history of Fisherman's Rest, when 
//suddenly, in the middle of a sentence perhaps, Quinn starts to ramble about a monster. 

//Rather than integrating this randomness into the dialogue branch itself, it is handled automatically
//by a random generator. The PC's speech skill and Luck attribute will lower the probability of Quinn going
//"mental", as per the formulae in the following procedure. All the PC's responses in Quinn's dialogue
//will call the below function, rather than the usual NOption. The two will be identical, except
//in this function, there is a random chance of the destination node becoming one of Quinn's 
//"Madness nodes", as opposed to the usual destination node. The Option procedure is used
//in the same way as NOption, but with one added parameter, which will modify the chance of
//Quinn going mental. If the last parameter is set to 100, Option and NOption will be 
//virtually identical.

//text == number of the msg file reference corresponding to the PC's response
//node == destination node
//int == the required intelligence to see this option
//modifier == integer between -100 and 100 modifying the probability of going to a "Madness-branch". 100 means it's impossible to get a madness branch, -100 means the PC will get a madness branch no matter what.
procedure Option(variable text, variable node, variable int, variable modifier) begin
   variable Intelligence := get_critter_stat(dude_obj,STAT_iq);
   variable Luck := get_critter_stat(dude_obj,STAT_lu);
   variable Speech := has_skill(dude_obj,SKILL_CONVERSANT);
   variable dice;
   variable probability; //the probability to "pass" and not go to a madness branch.
   variable madness_string;
   
   dice := Random(1,100);
   
   //calculating this number will yield your probability (in per cent) to pass the roll of the dice.
   probability := speech/6 + Luck*5 + modifier;
   
   if(dice > probability) then begin
      //Regardless of what <text> is, Quinn will go to one of the Madness nodes. Which one is randomly selected here.
      madness_string := Random(0,4);
      if(madness_string == 0) then begin
         NOption(text,Madness_0,int);
      end else if(madness_string == 1) then begin
         NOption(text,Madness_1,int);
      end else if(madness_string == 2) then begin
         NOption(text,Madness_2,int);
      end else if(madness_string == 3) then begin
         NOption(text,Madness_3,int);
      end else if(madness_string == 4) then begin
         NOption(text,Madness_4,int);
      end
   end else begin
      //In this case, the PC "passed" the luck and speech rolls, and as a result, he will get the "expected" answers from Quinn.
      NOption(text,node,int);
   end
end