English Creating npc

6 replies
Goto Page
To the start Previous 1 Next To the start
07.04.12 10:14:16 am
Up
deividas270
User
Offline Off
Hello, its my first thread and i want to ask you how to create new npc? For example, creating a dog npc that moves and attacks? And how to paint images? And what lua scripting tutorial could you rekomend for me?
07.04.12 10:27:22 am
Up
EngiN33R
Moderator
Offline Off
1. Creating custom NPCs is difficult and requires skills. I'm not sure, but I think there are some NPC scripts in the file archive.
2.
Code:
1
imagecolor(imageid,red,green,blue)

3. I'd recommend you to read TKD's tutorial as well as just study the Lua user manual - it has plenty of examples of how to use different Lua features.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
07.04.12 12:07:18 pm
Up
Iamle0
User
Offline Off
user EngiN33R Is it a book? Give me link please:)
07.04.12 12:15:57 pm
Up
EngiN33R
Moderator
Offline Off
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
16.04.12 07:25:51 pm
Up
xSkyLordx
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
npc={}
npc[1]={name="Robert",x=27,y=27,msg="Can you help me?",rot=120,img=1}

addhook("second","spawnimg")
function spawnimg(id)
     for a=1,#npc do
          npc[a].px=npc[a].x*32+16
          npc[a].py=npc[a].y*32+16
          npc[a].sprite=image("gfx/npc"..npc[a].img..".png",npc[a].px,npc[a].py,1)
     end
end

addhook("say","wordsay")
function wordsay(id,t)
     for a=1,#npc do
          if (player(id,"tilex")>=npc[a].x-1 and player(id,"tilex")<=npc[a].x+1 and player(id,"tiley")>=npc[a].y-1 and player(id,"tiley")<=npc[a].y+1) then
               if t=="hi" or t=="hello" then
                    msg2(id,""..npc[a].name..":"..npc[a].msg.."")
               end
          end
     end
end


say hi front of NPCs after NPCs answer you
16.04.12 08:54:33 pm
Up
Infinite Rain
Reviewer
Offline Off
user xSkyLordx has written:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
npc={}
npc[1]={name="Robert",x=27,y=27,msg="Can you help me?",rot=120,img=1}

addhook("second","spawnimg")
function spawnimg(id)
     for a=1,#npc do
          npc[a].px=npc[a].x*32+16
          npc[a].py=npc[a].y*32+16
          npc[a].sprite=image("gfx/npc"..npc[a].img..".png",npc[a].px,npc[a].py,1)
     end
end

addhook("say","wordsay")
function wordsay(id,t)
     for a=1,#npc do
          if (player(id,"tilex")>=npc[a].x-1 and player(id,"tilex")<=npc[a].x+1 and player(id,"tiley")>=npc[a].y-1 and player(id,"tiley")<=npc[a].y+1) then
               if t=="hi" or t=="hello" then
                    msg2(id,""..npc[a].name..":"..npc[a].msg.."")
               end
          end
     end
end


say hi front of NPCs after NPCs answer you

*FACEPALM*
I think he meant NPC as mobs
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
16.04.12 08:57:26 pm
Up
4Vendetta
User
Offline Off
Today when I was playing I've saw one server [mobs test] and I've played there was a lot of monster whos follow you and attack you ...
IMG:http://orig12.deviantart.net/d660/f/2015/294/4/a/loki_free_icon_smite_by_cuti_chan-d9dwjst.gif
No one can play Masturball... IMG:http://orig08.deviantart.net/2bdc/f/2015/360/1/f/khepri_free_icon_smite_by_cuti_chan-d9llycr.gif
To the start Previous 1 Next To the start