|
4 registered members (VoroneTZ, kiamonster, Grant, 1 invisible),
3,511
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
[ANET] Send animation
#302487
12/19/09 20:58
12/19/09 20:58
|
Joined: Aug 2008
Posts: 37 Hungary
Kronomanta
OP
Newbie
|
OP
Newbie
Joined: Aug 2008
Posts: 37
Hungary
|
Hi! I try to send my animation to every clients. The animation works correctly on the own pc (host and/or client), but the others cannot see them. I play the animation normal, then reverse:
if (key_ctrl > 0 && (my.skill42<1 || my.skill42>99))
{
if(my.skill44==-1){my.skill44=1;}
else {my.skill44=-1;}
}
if (my.skill43==0)
{
if(my.skill44==-1 && my.skill42<100)
{
my.skill42+=10*time_step;
ent_animate(my,"fly",my.skill42,null);
}
if(my.skill44==1 && my.skill42>0)
{
my.skill42-=10*time_step;
ent_animate(my,"fly",my.skill42,null);
}
enet_send_skills(enet_ent_globpointer(my),42,42,-1); //sends the new skill value
my.skill43=1;
}
else
{
if(my.skill43 == 1) //only send the skill if the value has changed
{
my.skill43 = 0;
enet_send_skills(enet_ent_globpointer(my),42,42,-1); //sends the new skill value
}
}
Where do I make the mistake?
|
|
|
Re: [ANET] Send animation
[Re: Kronomanta]
#302546
12/20/09 11:32
12/20/09 11:32
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Your mistake is the following:
my.skill[42] isn't the same as my.skill42, because my.skill42 is my.skill[43] in reality. This is because my.skill[] starts with 0 and my.skillx starts with 1.
my.skill[] is the new way to access skills (the way it should be done in Lite-C). my.skillx exists only to prefent users that have to convert their codes from C-Script to Lite-C from changing all skillx calls.
enet_send_skills() needs the skill number starting by 0.
=> if you want to send my.skill42 you have to use enet_send_skills(enet_ent_globpointer(my),41,41,-1);
But I would advise you to generally use the my.skill[] notation to prefent such problems.
By the way, if you want to produce less traffic you can do sending animations much easier. The point is, that it's not important that the animation is synchronized on all participants but it's only important that the same animation is played on all hosts. => you can use a skill and set it to 0 for the stand animation, 1 for the run animation, 2 for the swim animation,... Everytime the animtaion changes, you save the new value in the skill and send it to all hosts. After that, the other hosts check the current value of the skill and play the according animation.
This would produce MUCH less traffic!
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
|