Page 2 of 3

Re: Moving NPC's v0.3 (incl source)

Posted: Mon Mar 11, 2013 11:23 pm
by mahric
A very nice update: NPC's are now clickable!

You can register two functions that you can use for interaction with the npc, once for clicking on the NPC and one when you give stuff to the npc.
This way you can start a dialog, or script what happens if the npc receives an item from the npc.

Sadly I don't have time to upload a new version yet. I just got it working and wanted to share it with you.
Tomorrow I'll clean up the code and upload the source of the new version.

Re: Moving NPC's v0.3 (incl source)

Posted: Mon Mar 11, 2013 11:43 pm
by Neikun
That sounds awesome. I think clicking will feel most natural for starting a conversation

Re: Moving NPC's (incl source)

Posted: Tue Mar 12, 2013 8:10 pm
by mahric
The source has been uploaded, with an example that shows the use of all functions:
- Create NPCs by either placing them on a spot in the editor or through code
- Define a pre-defined route for the NPC to walk. Repeatable if you want to
- Define a function that gets called when the player clicks on an NPC
- Another function can be set to be called when clicks on an NPC while having an item on the cursor. It gives the item to the npc that way

Please take a look at the demo, the source and let me know if you think it's usefull. (link is on the first page of this topic)
If you find bugs or want things different, please post it here.

Re: [Source] Easy to use NPC script (interaction, walking)

Posted: Sun May 12, 2013 2:21 pm
by valley609
I was wondering something, I have this custom monster which is basicly a retextured ogre, would it be possible to make this work with it as long as I change the names and directories, or is it something even deeper that keeps the other monsters from being used with this.

Will I have to change the texture of the ogre itself if I want a custom textured ogre NPC, or can I make a custom one, identical with the ogre, just retextured?

Re: [Source] Easy to use NPC script (interaction, walking)

Posted: Sun May 12, 2013 3:08 pm
by mahric
valley609 wrote:I was wondering something, I have this custom monster which is basicly a retextured ogre, would it be possible to make this work with it as long as I change the names and directories, or is it something even deeper that keeps the other monsters from being used with this.

Will I have to change the texture of the ogre itself if I want a custom textured ogre NPC, or can I make a custom one, identical with the ogre, just retextured?

If you have a retextured ogre, you should be able to get away by doing the following stuff:

0) Make sure you have your monster defined (I assum it's called myOgre in this example)
1) Open the md_npc\scripts\monsters.lua in a text editor
2) Find the definition of "md_npc_ogre"
3) Change the line: "baseObject = "ogre",
Into: "baseObject = "myOgre",
4) Save the file

After the modifications above the ogre should be replaced by your retextured ogre.
If you need any more help, feel free to post or msg me.

Re: [Source] Easy to use NPC script (interaction, walking)

Posted: Sun May 12, 2013 3:12 pm
by valley609
mahric wrote:
If you have a retextured ogre, you should be able to get away by doing the following stuff:

0) Make sure you have your monster defined (I assum it's called myOgre in this example)
1) Open the md_npc\scripts\monsters.lua in a text editor
2) Find the definition of "md_npc_ogre"
3) Change the line: "baseObject = "ogre",
Into: "baseObject = "myOgre",
4) Save the file
It works great, thank you so much.
Btw, your script is amazing.

Re: [Source] Easy to use NPC script (interaction, walking)

Posted: Sun Jun 23, 2013 10:27 pm
by LordGarth
Could this be used as a shop for buying and selling?

LordGarth

Re: [Source] Easy to use NPC script (interaction, walking)

Posted: Tue Jun 25, 2013 8:53 pm
by mahric
LordGarth wrote:Could this be used as a shop for buying and selling?

LordGarth
This script has nothing to do with buying and/or selling itself.

Theoretically it can be expanded to incorporate buying and/or selling, but it would have to be build from the ground up.
The only thing you can re-use is the start of the interaction (e.q. player clicks on the npc to start trading or gives an item to sell).

If you're looking for a quick solution I think there are other buy/sell scripts floating around somewhere.

Re: [Source] Easy to use NPC script (interaction, walking)

Posted: Tue Jun 25, 2013 9:03 pm
by LordGarth
I will have to check but I dont think they are compatible with skyscript framework.

LordGarth

Re: [Source] Easy to use NPC script (interaction, walking)

Posted: Wed Jun 26, 2013 3:25 pm
by bongobeat
woww

I'm not sure what you are all doing here peoples!
are you programming grimrock 2 or something? :D

nice job!