Make Characters Talk
Page 1 of 1 • Share •
Make Characters Talk
function LocalChat(role,target,text)
local pkt = GetPacket()
local tid = GetCharID( target )
WriteCmd( pkt, 501 );
WriteDword( pkt, tid );
WriteString( pkt, text);
SendPacket( role, pkt );
end
function Say(character,text)
local map_copy = GetChaMapCopy ( character )
local ply_num = GetMapCopyPlayerNum(map_copy)
local ps={}
local i = 1
BeginGetMapCopyPlayerCha ( map_copy )
for i = 1 ,ply_num , 1 do
ps[i]=GetMapCopyNextPlayerCha ( map_copy )
end
for i=1,ply_num,1 do
if(ps[i]~=0 and ps[i]~=nil)then
LocalChat( ps[i], character, text )
end
end
end
I hope you can learn from this code
it makes the Character talk to all characters around without any need of storing some info in some variables
Usage:
Say(character,"Hallo World")
local pkt = GetPacket()
local tid = GetCharID( target )
WriteCmd( pkt, 501 );
WriteDword( pkt, tid );
WriteString( pkt, text);
SendPacket( role, pkt );
end
function Say(character,text)
local map_copy = GetChaMapCopy ( character )
local ply_num = GetMapCopyPlayerNum(map_copy)
local ps={}
local i = 1
BeginGetMapCopyPlayerCha ( map_copy )
for i = 1 ,ply_num , 1 do
ps[i]=GetMapCopyNextPlayerCha ( map_copy )
end
for i=1,ply_num,1 do
if(ps[i]~=0 and ps[i]~=nil)then
LocalChat( ps[i], character, text )
end
end
end
I hope you can learn from this code

it makes the Character talk to all characters around without any need of storing some info in some variables

Usage:
Say(character,"Hallo World")
Admin- Admin
- Posts : 23
Join date : 2011-10-23

» How do you make your fantage character, your avatar?
» Describe Yourself In 3 Fictional Characters
» Empire's Top 100 Movie Characters
» ♦♦♦ PASSWORDS ♦♦♦ - Make them STRONG !!!
» How to make yourself look like a smurf.
» Describe Yourself In 3 Fictional Characters
» Empire's Top 100 Movie Characters
» ♦♦♦ PASSWORDS ♦♦♦ - Make them STRONG !!!
» How to make yourself look like a smurf.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|