Jump to content

Recommended Posts

 _dog = createAgent ["Fin_random_F", getPos player, [], 5, "CAN_COLLIDE"];
 _dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
 
dogStop = [_dog] spawn {
    params ["_dog"];
    _dog playMove "Dog_Stop";
    
while {alive _dog && speed player = 0} do 
    {
        _dog moveTo getPos player;
        sleep 0.5;
    };
};

dogWalk = [_dog] spawn {
    params ["_dog"];
    _dog playMove "Dog_Walk";
    
while {alive _dog && speed player > 0} do 
    {
        _dog moveTo getPos player;
        sleep 0.5;
    };
};

dogSprint = [_dog] spawn {
    params ["_dog"];
    _dog playMove "Dog_Sprint";
    
while {alive _dog && speed player > 18} do 
    {
        _dog moveTo getPos player;
        sleep 0.5;
    };
};
while {alive _dog && speed player = 0} do 
{
_dog moveTo getPos player;
sl>
 5:48:55   Error position: <= 0} do 
{
_dog moveTo getPos player;
sl>
 5:48:55   Error Missing ;
 5:48:55 File C:\....\missions\Task Force Wolfpack\Mission  Templates\Mission_Template_v1-0.Takistan\scripts\dog\dog.sqf, line 8
 5:48:55 Error in expression <op";

Does anyone know what that means?

Share this post


Link to post
Share on other sites

= assigns a value to a variable but == compares

sent from mobile using Tapatalk

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, sarogahtyp said:

= assigns a value to a variable but == compares

sent from mobile using Tapatalk
 

It doesn't work.

What I'm trying to do is, make this:
 

_dog = createAgent ["Fin_random_F", getPos player, [], 5, "CAN_COLLIDE"];
 _dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
 
0 = [_dog] spawn {
	params ["_dog"];
 
	_dog playMove "Dog_Sprint";
 
	while {alive _dog} do 
	{
		_dog moveTo getPos player;
 
		sleep 0.5;
	};
};

Controllable by my speed, if I stop, the dog stops, if I walk, the dog walks, if I run, the dog runs.

Share this post


Link to post
Share on other sites
4 hours ago, SoOCoOL said:

while {alive _dog && speed player = 0} do { 
	_dog moveTo getPos player; 
    sleep 0.5; 
};

 

Just what @sarogahtyp said. Instead of the code above use

 

while {alive _dog && speed player == 0} do { 
	_dog moveTo getPos player; 
    sleep 0.5; 
};

 

Share this post


Link to post
Share on other sites
37 minutes ago, 7erra said:

Just what @sarogahtyp said. Instead of the code above use

 


while {alive _dog && speed player == 0} do { 
	_dog moveTo getPos player; 
    sleep 0.5; 
};

 

_dog = createAgent ["Fin_random_F", getPos player, [], 5, "CAN_COLLIDE"];
_dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
 
_dogSit = [_dog] spawn {
    params ["_dog"];
    _dog playMove "Dog_Sit";
    
while {alive _dog && speed player == 0} do 
    {
        _dog moveTo getPos player;
		hint "The dog is sitting";
        sleep 0.5;
    };
};

_dogWalk = [_dog] spawn {
    params ["_dog"];
    _dog playMove "Dog_Walk";
    
while {alive _dog && speed player > 0} do 
    {
        _dog moveTo getPos player;
		hint "The dog is walking";
        sleep 0.5;
    };
};

_dogSprint = [_dog] spawn {
    params ["_dog"];
    _dog playMove "Dog_Sprint";
    
while {alive _dog && speed player >= 18} do 
    {
        _dog moveTo getPos player;
		hint "The dog is sprinting";
        sleep 0.5;
    };
};

That's what I got, but it won't work.

Once I execute the script it will show "The dog is sitting", and it won't change it once I am speeding more than 0 or when I'm at 18 or speeding over it.

Share this post


Link to post
Share on other sites
 _dog = createAgent ["Fin_random_F", getPos player, [], 5, "CAN_COLLIDE"];
 _dog setVariable ["BIS_fnc_animalBehaviour_disable", true];

dogMove = [_dog] spawn {
    params ["_dog"];
    while {alive _dog} do
    {
        _speed = abs (speed player);
        _distance = _dog distance player;
        _anim = "";
        switch (true) do {
            case (_speed == 0 && _distance <= 10): {_anim = "Dog_Stop";};
            case (_speed > 0 && _speed < 18): {_anim =  "Dog_Walk";};
            case (_speed >= 18 OR _distance > 10): {_anim =   "Dog_Sprint";};
        };
        _dog switchMove _anim;
        _dog moveTo getPos player;
        waitUntil {sleep 1; round _speed != round speed player OR _distance > 10};
    };
};

Should work. Though I'm not entirely satisified with the case when you are not moving but the dog is over 10m away. It plays the animation once every second.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×