Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Scripted NPC


ell
 Share

Recommended Posts

I have scripted my own npc, i'm just learning the basics at the moment and I have encountered an error.

here is my scriptedNpc

```
' Executes whenever a scripted NPC does an action.
Sub ScriptedNPC(Index, Script)
Select Case Script
Case 0
Call PlayerMsg(Index, "This scripted NPC has no apparent use.", WHITE)
Exit Sub
Case 1
Call AdminMsg(Index, "Ghost: Those who stand by yonder tree,", YELLOW)
Call AdminMsg(Index, "Ghost: Safe from evil they will be,", YELLOW)
Call AdminMsg(Index "Ghost: I now must run, I have to go,", YELLOW)
Call AdminMsg(Index "Ghost: Take this cloak that I bestow", YELLOW)
'Call GiveItem(1, 1, 1)
Exit Sub
Case 2
Call AdminMsg("Welcome to my shope, please, have a look at my goods!", YELLOW)
Call GoShopping(Index, 1)
Exit Sub
Case Else
Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub
```
I have the npc's behavior set to scripted and the script to 1 but when I go up to it and press ctr nothing happens. and also is  '    comments?
thanks in advance ell
Link to comment
Share on other sites

Thanks, but nothing is working and about the adminmsg I am using that temporarily because I dont know how to use plkayermsg, if you could give me a pointer about that aswell, i would deeply apreciate it! thanks agen ell.
Link to comment
Share on other sites

Hi thanks again for all the help ubt i ant understand what index does, i know that its on a load of other things aswell but what does it do?

edit: also the npc is wokring now… for some reason  :confused:
Link to comment
Share on other sites

@ell:

> Hi thanks again for all the help ubt i ant understand what index does, i know that its on a load of other things aswell but what does it do?
>
> edit: also the npc is wokring now… for some reason  :confused:

grr!! I tried to let the player to make a choice to start a quest or not with player prompt, but no luck so i deleted what i had added but now the npc wont work again, what i wrong!!
Link to comment
Share on other sites

```
Sub ScriptedNPC(Index, Script)
Select Case Script
Case 0
Call PlayerMsg(Index, "This scripted NPC has no apparent use.", WHITE)
Exit Sub
Case 1
Call PlayerMsg(index, "Those who stand by yonder tree", MAGENTA)
Call PlayerMsg(index, "Safe from evil they will be", MAGENTA)
Call PlayerMsg(index, "I have to rush, now I must go", MAGENTA)
Call PlayerMsg(index, "So take this cloak, I now bestow", MAGENTA)
Call GiveItem(index, 1, 1)
Call DamageNPC(Index, 1, 99999)
Exit Sub
Case Else
Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub
```
well its working now, could someone close this topic? sorry for all the inconvinience i have caused!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...