Issue With Actors
#1

Ok so I've finally got the Actors down. Atleast more than alot of the confusion I see going on with them. I got it to spawn at first, and so on. But now when I try to fix it's spawn location (unless I log in infront of it, it spawns in the middle of the alley), it doesn't even appear anymore, at all. Is there something I'm missing here?

pawn Код:
forward IsPlayerInRangeOfActor(playerid);
public IsPlayerInRangeOfActor(playerid)//This Works
{
    if(IsPlayerInRangeOfPoint(playerid, 1.5, 2397.78, -1468.79, 24.00))
    {
        SendClientMessage(playerid, COLOR_RED, "Success!");
        return 1;
    }
    return 1;
}

forward SpawnActor();
public SpawnActor()//This worked originally
{
    myActor = CreateActor(120, 2397.78, -1468.79, 24.00,  182.42);
    //ApplyActorAnimation(myActor,"GANGS","leanIDLE",4.1,1,0,0,0,0);
    return 1;
}

public OnActorStreamIn(actorid, forplayerid)//I added more here to try and fix the issue with the Actor, now it won't even appear
{
    SpawnActor();//I figured I'd try to force spawn it, yeah that definitely didn't pan out well
    SetActorPos(myActor, 2397.78, -1468.79, 24.00);
    SetActorFacingAngle(myActor,182.42);
    SetActorVirtualWorld(myActor, 0);
    SetActorInvulnerable(myActor, true);
    ApplyActorAnimation(myActor,"GANGS","leanIDLE",4.1,1,0,0,0,0);//Hopefully this fixes the bug with the actors
    return 1;
}
Reply
#2

What are you trying to do?
Reply
#3

I'm trying to get the Actor to actually spawn and be leaned up against the wall where he should be. If I can get that done, I'm gonna do that to the rest so the Actor's can replace the NPC's that are doing the same function (basically just standing there and look pretty). However, at first the actor would spawn. But when I drove to him, he'd be in the middle of the alley leaning up against nothing, instead of against the wall where he should be. If I logged on infront of him, he was leaned up against the wall like he should be. So I figured forcing it into that in OnActorStreamIn would fix it, turns out, it makes it so he won't even spawn anymore or whatever.
Reply
#4

I guess that all what you need to do is the following..

On top of script
PHP код:
new actor
Under on gamemodeinit

PHP код:
actor CreateActor(modelxyzrotation);
SetActorInvulnerable(actor1);
ApplyActorAnimation(actoranimlibanimnamespeedloop, and the rest of the format); 
And then check OnPlayerGiveDamageToActor, and set the actor's position to the original place, easy..
Reply
#5

When I did it that way though it spawned him right in the middle of the alley once I drove to him. Unless I logged in right where he was, then he spawned in the right place.
Reply
#6

Quote:
Originally Posted by Jay_Dixon
Посмотреть сообщение
When I did it that way though it spawned him right in the middle of the alley once I drove to him. Unless I logged in right where he was, then he spawned in the right place.
Then you didn't do the OnPlayerGiveDamageActor thingy, and if it didn't work, create a timer that checks every 1 sec if the actor's pos isn't the original one then set his pos to the original
Reply
#7

This might give a better idea of what I'm trying to do with them. They're gonna replace the NPC's if I can get atleast 2 working correctly.

https://www.youtube.com/watch?v=wNqBAn0MoQY
Reply
#8

He created an actor and applied animation to them, that's all, YOUR PROBLEM is that when you move the actor from his position by a car for example, he doesn't TP back, You can easily avoid it with this..

forward a timer function somewhere in your script
PHP код:
forward actorcheck(); 
When you create the actor set a time with him
PHP код:
SetTimer(actorcheck1000true); 
and the response..

PHP код:
public actorcheck()
{
     new 
Float:XFloat:YFloat:Z;
     
GetActorPos(actorXYZ);
     if(
!= your original X here || != your original Y here || != your original Z here)
     {
           
SetActorPos(actoryour xyz);
           
ApplyActorAnimation(blablabla);
     }

That's it.
Reply
#9

Actually the video wasn't Actors, those were the NPC's that I made a long time ago before I left that I'm now trying to replace. I'll give the actor check thing a try though, thanks

If that don't work looks like I'm buying a server that can accomidate 250+ NPC's xD
Reply
#10

I don't fully understand what you are trying to achieve because of my english, sorry.
So that you want:
- When a player enters in an interior, it create an actor or, at least, there is an actor standing there
- It apply an animation to the actor and a message appear at the front of the actor, when you are pressing a key or what ever it intereact in any way with actor
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)