Page 2 of 3

Re: NPC's and custom voice/sound?

Posted: Sat Nov 29, 2014 4:55 am
by Grimfan
Nicely done Mahric. :D

Re: NPC's and custom voice/sound?

Posted: Wed Dec 10, 2014 9:23 am
by Mysterious
Hi mahric. The script you made is awesome and I was wondering how I could the Item given to the NPC be a certain item. Your script allows for any item. I would like to for example, if the player give the NPC a Staff then the se_ogre.script.WizardGone1() activates. I cant remember how to do that. I think it's like: if item==staff then etc... Could you help me on this please thxs :)

function onGive(self, monster, item) --Would like this to be a certain item only--
hudPrint("Thank you for that "..item:getUiName())
se_ogre.script.WizardGone1()
return true

Re: NPC's and custom voice/sound?

Posted: Thu Dec 11, 2014 9:07 pm
by mahric
In the script you can check the name if the item that is given.
If it's not the item you want the NPC to accept, return false and the item will be kept on the cursor.

See the example below; it's what I use in the mod i'm working on now.
The name of the item the npc accepts is "md_sewer_package". You can replace it with anything you want to accept.

Code: Select all

function onGive(self, npc, item)
	if item.go.name == "md_sewer_package" then	
		-- do magic stuff here, the right item was given
		return true
	end
	hudPrint("I have no need for this item")
	return false
end

Re: NPC's and custom voice/sound?

Posted: Fri Dec 12, 2014 12:46 am
by bongobeat
if you want to add custom voice to your npc, here is a site that allow you to hear what you write, in most languages.

http://www.oddcast.com/home/demos/tts/tts_example.php
you can then record what you hear with your computer/micro the sound.
it's quite good, I have use this for my mod toorum manor, to simulate some super computer voice.

Re: NPC's and custom voice/sound?

Posted: Wed Dec 17, 2014 2:27 am
by Eleven Warrior
Hi mahric. This script is awesome man I was wonder is there a way that if the party attacks the npc then the npc turns on the party and attacks them? I do hope this is possible because this script has so much potential. Thxs for any help :)

Re: NPC's and custom voice/sound?

Posted: Wed Dec 17, 2014 8:44 am
by Eleven Warrior
SORRY BUMP :)

Re: NPC's and custom voice/sound?

Posted: Thu Dec 18, 2014 9:31 pm
by mahric
It's not possible at the moment, but I don't think it's too hard to add to the script, as long as you don't mind the monster will stay hostile once it is.

I don't have time to look at this right now, I hope I can get to it this weekend.

Re: NPC's and custom voice/sound?

Posted: Fri Dec 19, 2014 5:21 am
by Eleven Warrior
Thxs for the reply Mahric. It will be awesome, because if the party attacks the NPC they may fail a Quest or he gets the Shits and say imam not help you now unless you say sorry lol :)

Re: NPC's and custom voice/sound?

Posted: Fri Dec 19, 2014 11:44 am
by Aisuu
It is possible and its very easy with a hook onDamage. Here is example if your using mahric npc scripts.

mdNPC.script:registerNPC("npc_neutral")
SpoilerShow

Code: Select all

npc_neutral.monster:addConnector("onDamage",self.go.id,"npcdamage")

function npcdamage(sender)
  spawn("regular_mob",npc_neutral.level,npc_neutral.x,npc_neutral.y,npc_neutral.facing,npc_neutral.elevation,nil)
	delayedCall(self.go.id,0.1,"killnpc")
end

function killnpc()
	npc_neutral:destroy()
end

Re: NPC's and custom voice/sound?

Posted: Fri Dec 19, 2014 3:29 pm
by mahric
Thanks for the solution Aisuu, now I don't have to worry how to fit this into my schedule!