Jump to content
  • 0
NekoNova

Invoking an NPC

Question

Hello,

 

I'm currently looking for an elegant solution to the following problem:

 

Take any NPC on the server. You want to "upgrade" that NPC by giving him a special dialog during a quest, but retain all his other functionality.

At the moment we duplicate the NPC's source script into our custom folder and make all changes there, then disable the original one and load ours.

 

I was wondering, is it possible to make a new NPC, and invoke the code from another NPC?

I know you have doevent etc, but that only invokes a specific label, I want to be able for example to invoke the complete logic from the refine NPC in a if-else statement based on whether the user is on the quest or not.

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Hello!

 

I'm sorry to say it isn't possible as of now since server just reads and parses the contents on the .txt file, no more.

 

It could be possible with some server-side modifications.

Share this post


Link to post
Share on other sites
  • 0

Make a function , example named "xyz", put the codes there, (pass 1 var with func so that func. Can identify which npc invoked it) and let it do the work, you only need to put callfunc on every script.

limitation:

* It cannot delete any message or functions

*cannot edit messages by npc

* cannot remove original functionality.

Share this post


Link to post
Share on other sites
  • 0

@datsjir

how bout resseting npc ? or variablenpc ? 

 

 

cuz im having a little problem with the script i found back from 2011 it doesnt reset the whole script example in BG it reset all npcvariable.
on 2011script it doesnt and u need to reloadscript just to work again with that npc  :P

Share this post


Link to post
Share on other sites
  • 0

If the condition depends on whether or not the invoking player is on a quest, why not structure your script logic around checks for a permanent character or account variable?

Share this post


Link to post
Share on other sites
  • 0

This might be kinda sloppy because I'm on mobile, but here's an example:

 

switch (quest_variable) {    case 1:        // first stage        break;    case 2:        // second stage        break;    case 3:        // third stage        break;    default:        // not on quest        break;}

sorryfordoubleposting(:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.