SA-MP Forums Archive
Actor Sync Bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: Actor Sync Bug (/showthread.php?tid=572777)



Actor Sync Bug - dominik523 - 01.05.2015

Hey there. When I try to create few actors in the same virtual world and apply an animation to them, actor that was created first does not sync. When I leave the virtual world and go back, it syncs perfectly.
Can someone confirm this?
[ame]www.youtube.com/watch?v=eUkNWQdjqSA&[/ame]
I've used this code to create the actors:
pawn Code:
CMD:actor(playerid)
{
    new Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    new actor = CreateActor(15, pos[0] + 1, pos[1] + 1, pos[2], 0.0);
    SetActorVirtualWorld(actor, 0);
    ApplyActorAnimation(actor, "STRIP", "STR_LOOP_A", 2.0, true, 0, 0, 0, 1500000);
    return 1;
}



Respuesta: Actor Sync Bug - Malganys - 01.05.2015

Confirmed, I have the same result.


Re: Actor Sync Bug - Crayder - 01.05.2015

This has already been discovered when they were very first added.


Re: Actor Sync Bug - IstuntmanI - 01.05.2015

Quote:

SA-MP 0.3.7 RC6-3 Optional server update

- If an actor animation has the loop or freeze parameter enabled, the animation will be automatically reapplied when the actor streams in for players.

This is why. I don't see it as a problem.


Re: Actor Sync Bug - ikey07 - 01.05.2015

its because anim needs to pre-load, the first actor you spawn, it pre-loads the anim, and each next one will get that anim at first, as its already preloaded.

just preload the anim before the use, just like you do with a player anims.


Re: Actor Sync Bug - Crayder - 01.05.2015

Quote:
Originally Posted by ikey07
View Post
its because anim needs to pre-load, the first actor you spawn, it pre-loads the anim, and each next one will get that anim at first, as its already preloaded.

just preload the anim before the use, just like you do with a player anims.
This has nothing to do with the bug, but yes [some] anims do need preloaded. The bug is not just with animations, so preloading them will not help the bug.

Also on an unrelated note, can someone try hitting some dead actors with cars and confirm this bug I'm experiencing? Procedure: Kill an actor, get in an Infernus, ram the actor repeatedly until you see what happens (it doesn't happen every time the actor is hit, but after it does happen there is no return). Result: An actor stuck in the air, until you set it's position again. This can all be done within test_cmds (just uncomment the actor damage callback).


Re: Actor Sync Bug - dominik523 - 02.05.2015

Quote:
Originally Posted by ikey07
View Post
its because anim needs to pre-load, the first actor you spawn, it pre-loads the anim, and each next one will get that anim at first, as its already preloaded.

just preload the anim before the use, just like you do with a player anims.
Didn't work. It's apparently a sync issue.

@Crayder: I'll try it now.
EDIT: I've tried to kill the spawned actor and I couldn't do any damage to it.
pawn Code:
CMD:actor(playerid)
{
    new Float:pos[3];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    new actor = CreateActor(15, pos[0] + 1, pos[1] + 1, pos[2], 0.0);
    SetActorVirtualWorld(actor, 0);
    SetActorInvulnerable(actor, 0);
   
    SetActorHealth(actor, 10.0);
    GivePlayerWeapon(playerid, WEAPON_M4, 500);
    return 1;
}
I hope this few bugs with actors will be fixed soon.


Re: Actor Sync Bug - Crayder - 02.05.2015

Quote:
Originally Posted by dominik523
View Post
@Crayder: I'll try it now.
EDIT: I've tried to kill the spawned actor and I couldn't do any damage to it.
You forgot to uncomment the actor damage callback. It's OnPlayerGiveDamageActor I think. It's in the test_cmds but it's commented out.


Re: Actor Sync Bug - dominik523 - 03.05.2015

Okay I've tried to kill the actor and then go over it with the infernus and everything worked fine. This is the code I've used:
pawn Code:
public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float: amount, weaponid, bodypart)
{
    new string[128], attacker[MAX_PLAYER_NAME];
    new weaponname[24];
    GetPlayerName(playerid, attacker, sizeof (attacker));
    GetWeaponName(weaponid, weaponname, sizeof (weaponname));

    format(string, sizeof(string), "%s has made %.0f damage to actor id %d, weapon: %s", attacker, amount, damaged_actorid, weaponname);
    SendClientMessageToAll(0xFFFFFFFF, string);

    if(!IsActorInvulnerable(damaged_actorid)) //Check if actor is vulnerable
    {
        new Float:health;
        GetActorHealth(damaged_actorid, health); //Get current health
        SetActorHealth(damaged_actorid, health-amount); //Apply damage, set new health
    }
    return 1;
}



Re: Actor Sync Bug - Crayder - 03.05.2015

Quote:
Originally Posted by dominik523
View Post
Okay I've tried to kill the actor and then go over it with the infernus and everything worked fine. This is the code I've used:
pawn Code:
public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float: amount, weaponid, bodypart)
{
    new string[128], attacker[MAX_PLAYER_NAME];
    new weaponname[24];
    GetPlayerName(playerid, attacker, sizeof (attacker));
    GetWeaponName(weaponid, weaponname, sizeof (weaponname));

    format(string, sizeof(string), "%s has made %.0f damage to actor id %d, weapon: %s", attacker, amount, damaged_actorid, weaponname);
    SendClientMessageToAll(0xFFFFFFFF, string);

    if(!IsActorInvulnerable(damaged_actorid)) //Check if actor is vulnerable
    {
        new Float:health;
        GetActorHealth(damaged_actorid, health); //Get current health
        SetActorHealth(damaged_actorid, health-amount); //Apply damage, set new health
    }
    return 1;
}
Ok, I'll record what happens to me. (edit when uploaded)

EDIT: [ame]www.youtube.com/watch?v=B1c1Jmu90-c[/ame]