3 февраля 2016 г.

Актёр ходит

Учим актёра идти в нужные нам координаты.

Введите код "GOES", и за домом Свита на Гроув Стрит появится человек, который ходит и бегает по заданному скриптом маршруту, а также выполняет несколько других действий. Исходный код научит Вас пользоваться AS pack'ами (алгоритмами; списками действий) и применять опкоды движения для актёров.


/* Made by Vital */
//$PLAYER_ACTOR $PLAYER_GROUP $ONMISSION
{$CLEO}
0000:
while true
wait 0
    if
    player.Defined(0)
    then
        if and
        not actor.Driving($PLAYER_ACTOR)
        86FF: not  any_ped_near_actor $PLAYER_ACTOR in_range 10.0
        0ADC:   test_cheat "GOES"
        then
        actor.Create(0@,CivMale,#MALE01,2536.3445,-1662.0776,15.1842)
        0615: define_AS_pack_begin 1@
        05D3: AS_actor -1 goto_point 2537.0566 -1670.5176 15.1682 mode 4 time -1 ms //Walk
        0667: AS_actor -1 aim_at 2513.3735 -1669.4349 13.5078 500 ms
        05C8: AS_actor -1 look_around
        05D3: AS_actor -1 goto_point 2513.3735 -1669.4349 13.5078 mode 6 time -1 ms //Run
        05C9: AS_actor -1 on_guard 2000 ms
        05F5: AS_actor -1 goto_point_using_paths 2462.8699 -1650.6917 13.4648 mode 7 time -1 //Sprint
        05DE: AS_actor -1 walk_around_ped_path
        0616: define_AS_pack_end 1@       
        0618: assign_actor 0@ to_AS_pack 1@               
        061B: remove_references_to_AS_pack 1@
            while gosub @ActorAliveAndNear
            wait 0
            end
        actor.RemoveReferences(0@)           
        end
    end
end

:ActorAliveAndNear
if and
not actor.Dead(0@)
0104:   actor $PLAYER_ACTOR near_actor 0@ radius 50.0 50.0 50.0 sphere 0
then
0485:  return_true
else
059A:  return_false
end
return

Комментариев нет: