Author Topic: New Builder. NEED HELP WITH SCRIPTS  (Read 296 times)

Legacy_Nitroblight

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
New Builder. NEED HELP WITH SCRIPTS
« on: October 01, 2014, 02:46:45 am »


               

I used to play this game all the time a couple of years ago, but I recently found it again and decided to give it a go.


 


I was just curious if anyone could help me with just some minor scripts real quick? I tried looking through the forums but couldn't really find anything that helps :/


 


The first script I would like is one to have the player "respawn" or "resurrect" at a certain waypoint or place after they die. Right now all that happens is that when they die, the player just clicks the respawn button and appears right where they died, so there is no penalty.


 


The second script that I need some help with deals with conversations. Once I have the player talk to an NPC for the first time, how do I set it up to where the next time they talk to that NPC it has a different conversation. Right now I have an NPC that updates the journal and gives experience, but if the player keeps talking to them it keeps the same conversation as before and keeps updating the journal and giving experience.


 


I don't know if anyone could help me, or if the way I explained these confuses anyone, but I hope someone is able to help me out!


 


Thank you for your time in reading this!



               
               

               
            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
New Builder. NEED HELP WITH SCRIPTS
« Reply #1 on: October 02, 2014, 01:26:15 am »


               

Welcome back to the NWN rabbit hole.


 


Check out the Henchmen Always Bleed To Death (HABD) set of scripts.  If I'm not mistaken, in addition to the bleeding system, there's respawn funtionality.   This should have everything you need in one package.


 


For conversations, you're looking for a Starting Conditional script.  This is a script that is placed in the "Text Appears When" field of the conversation (as opposed to the "Actions Taken" field).  This starting conditional is a simple script that resolves to either TRUE or FALSE.  If it determines that a set of criteria has been met (such as the quest has already been given), then it can return TRUE and display the conversation option, rather than another conversation node that would give the new quest.


 


A simple journal conversation starting conditional script might look like:


 




int StartingConditional()
{
if (GetLocalInt(GetPCSpeaker(),"Quest"+GetLocalString(OBJECT_SELF,"Quest")) >= 2)
    {
    return TRUE;
    }
return FALSE;
}


 

The above looks to see if a number on the PC for a specific quest is >=2.  If it is, then the script is TRUE and the conversation option that this starting conditional is tied to, displays.  If the conditional resolves to FALSE, the PC never sees the conversation option.

 

Oh, and when building quest-based conversations, they're usually done in reverse, so that the 'final' quest completion conversation node is top (the starting conditional looks for the 'finished' value first and then subsequently to earlier stages in the quest process:

Node 1:  I'm completely finished with the quest

Node 2:  I've finished and am returning to speak to you about it

Node 3:  I haven't finished the quest, but I've been given it.

Node 4:  I have not yet been given the quest yet.

 

Hope that helps.


               
               

               
            

Legacy_Nitroblight

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
New Builder. NEED HELP WITH SCRIPTS
« Reply #2 on: October 02, 2014, 03:13:36 pm »


               

I will give those a try! thank you very much



               
               

               
            

Legacy_Nitroblight

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
New Builder. NEED HELP WITH SCRIPTS
« Reply #3 on: October 02, 2014, 03:39:05 pm »


               

I'll have to wait to try out the respawn later because... well, my laptop cannot properly open the files to read.


 


But for the quest, should I possibly replace quest with journal? Because it is sadly not working. Perhaps I put in in the wrong spot or something, I am not sure, but I am willing to give anything a try.



               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
New Builder. NEED HELP WITH SCRIPTS
« Reply #4 on: October 02, 2014, 08:58:59 pm »


               


I'll have to wait to try out the respawn later because... well, my laptop cannot properly open the files to read.




 


How are you trying to open the files? You should be importing the .erf files into a module using the toolset, not opening them directly. .mod files should be placed into your NWN install's /modules directory.


 


If you don't have the toolset installed on your laptop, you can use NWN Explorer to view and extract the .erf or .mod contents.