GTA San Andreas > Скриптинг
Проблема со скриптом охраны
drs36:
--- Код: ---thread 'Actor'
:Actor
wait 0
if
player.Defined(0)
jf @Actor
if and
not actor.Dead($PLAYER_ACTOR)
not actor.Driving($PLAYER_ACTOR)
0AB0: key_pressed 50
jf @Actor
:Actor2
repeat
wait 0
until player.Defined(0)
model.Load(#AK47)
Model.Load(#BALLAS2)
038B: load_requested_models
if
Model.Available(#AK47) // проверяй всегда доступность моделей
Model.Available(#BALLAS2)
else_jump @Actor2
04C4: create_coordinate 4@ 5@ 6@ from_actor $PLAYER_ACTOR offset 0.0 1.2 0.0 // вот здесь твой косяк
3@ = Actor.Create(gang2,#BALLAS2, 4@, 5@, 6@)
7@ = Marker.CreateAboveActor(3@)
0631: put_actor 3@ in_group $PLAYER_GROUP
01B2: give_actor 3@ weapon 30 ammo 6000 // Load the weapon model before using this
Model.Destroy(#AK47)
Model.Destroy(#BALLAS2)
0243: set_actor 3@ ped_stats_to 6
011A: set_actor 3@ flags 64
011A: set_actor 3@ flags 16
actor.Health(3@) = 850
04F7: status_text $HLT 0 line 1 'TEXT4'
while true
wait 0
$HLT = actor.Health(3@)
if or
not player.Defined(0)
8104: actor $PLAYER_ACTOR near_actor 3@ radius 100.0 100.0 50.0 sphere 0
then
else_jump @Actor2
else
if
actor.Dead(3@)
then
break
end
end
end
actor.RemoveReferences(3@)
jump @Actor2
end_thread
--- Конец кода ---
Что надо изменить в коде когда игрок арестован или убит охранник (здоровье которое было у охранника чтоб нового не создавать) после его смерти появлялся рядом с ним ?
mfisto:
--- Код: ---thread 'Actor'
:Actor
wait 0
if
player.Defined(0)
jf @Actor
if and
not actor.Driving($PLAYER_ACTOR)
0AB0: key_pressed 50
jf @Actor
:Actor2
wait 0
if
player.Defined(0)
jf @Actor2
if
not actor.Driving($PLAYER_ACTOR)
jf @Actor2
model.Load(#AK47)
Model.Load(#BALLAS2)
038B: load_requested_models
04C4: create_coordinate 4@ 5@ 6@ from_actor $PLAYER_ACTOR offset 0.0 1.2 0.0
3@ = Actor.Create(gang2,#BALLAS2, 4@, 5@, 6@)
7@ = Marker.CreateAboveActor(3@)
0631: put_actor 3@ in_group $PLAYER_GROUP
01B2: give_actor 3@ weapon 30 ammo 6000 // Load the weapon model before using this
Model.Destroy(#AK47)
Model.Destroy(#BALLAS2)
0243: set_actor 3@ ped_stats_to 6
011A: set_actor 3@ flags 64
011A: set_actor 3@ flags 16
actor.Health(3@) = 850
0AB1: call_scm_func @AddStatusText 4 VARNUMBER = 31 TYPE = 0 GXT = @StatusText LINE = 1
while true
wait 0
if or
not player.Defined(0)
8104: actor $PLAYER_ACTOR near_actor 3@ radius 100.0 100.0 50.0 sphere 0
actor.Dead(3@)
then
Actor.DestroyInstantly(3@)
0AB1: call_scm_func @RemoveStatusText 1 VARNUMBER = 31
jump @Actor2
else
31@ = actor.Health(3@)
end
end
:AddStatusText
0AB1: call_scm_func @__VarToOffset 1 0@ 0@
0AB1: call_scm_func @__LabelToOffset 1 2@ 2@
0AA6: call_method 0x0044CDA0 struct 0x00BA1788 num_params 4 pop 0 ( LINE = 3@ GXT = 2@ TYPE = 1@ VARNUMBER = 0@ )
0AB2: ret 0
:RemoveStatusText
0AB1: call_scm_func @__VarToOffset 1 0@ 0@
0AA6: call_method 0x0044CE80 struct 0x00BA1788 num_params 1 pop 0 ( VARNUMBER = 0@ )
0AB2: ret 0
:__VarToOffset
0A9F: 1@ = current_thread_pointer
0A8E: 2@ = 1@ + 0xDC // mission Flag
0A8D: 2@ = read_memory 2@ size 1 virtual_protect 0
if
2@ == 1
then
1@ = 0x00A48960 // mission locals
else
1@ += 0x3C
end
0@ *= 4
005A: 1@ += 0@ // address of the local variable
1@ -= 0xA49960
0AB2: ret 1 1@
:__LabelToOffset
if
0@ == 0
then
0AB2: ret 1 0
end
0A9F: 1@ = current_thread_pointer
1@ += 0x10
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0 // baseIP
0062: 1@ -= 0@ // label address
1@ += 3
0AB2: ret 1 1@
:StatusText
0900: 'TEXT4'
0000:
--- Конец кода ---
drs36:
Все хорошо,но охранник при смерти создается новый,а как сделать чтобы у него было то здоровье когда умер игрок ?
mfisto:
а зачем жизнь сохранять, смысл в чем? если после смерти актера он снова появится
drs36:
А как еще 2-х создать через переменную ?
Навигация
Перейти к полной версии