Coding

 Reply to this postStart new topic

Make actors shoot at player (if they're in a car or on foot)

420
post Oct 5 2010, 05:02 PM
Post #1


The New Guy!

Posts: 5
From: Europe
Joined: 29-September 10



So, my actors are in cars. I set acquaintace (077A) to 1 and 4 to pedtype 0. I thought they should shoot at me when i'm near a car or when they left the car and see me on foot... but they're doing nothing, and if they're on foot and i attack them they act like cowards (crouching with arms over head or running away)... what am i doing wrong?

CODE
077A: set_actor 21@ acquaintance 4 to_actors_pedtype 6 // see ped.dat
077A: set_actor 22@ acquaintance 4 to_actors_pedtype 6 // see ped.dat
077A: set_actor 23@ acquaintance 4 to_actors_pedtype 6 // see ped.dat
077A: set_actor 24@ acquaintance 4 to_actors_pedtype 6 // see ped.dat
077A: set_actor 25@ acquaintance 4 to_actors_pedtype 6 // see ped.dat
077A: set_actor 21@ acquaintance 1 to_actors_pedtype 6 // see ped.dat
077A: set_actor 22@ acquaintance 1 to_actors_pedtype 6 // see ped.dat
077A: set_actor 23@ acquaintance 1 to_actors_pedtype 6 // see ped.dat
077A: set_actor 24@ acquaintance 1 to_actors_pedtype 6 // see ped.dat
077A: set_actor 25@ acquaintance 1 to_actors_pedtype 6 // see ped.dat


(i set pedtype to 6 to see if they would shoot at cops... they don't...)
Go to the top of the page
 
+Quote Post
Silent
post Oct 5 2010, 06:02 PM
Post #2


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



QUOTE (420 @ Oct 5 2010, 07:02 PM) *
and if they're on foot and i attack them they act like cowards (crouching with arms over head or running away)

You can use Decision Makers to change their actings, tuto is on this forum too.

However I don't know what's really a problem with it, maybe after setting their Decision Maker to 0 they will start attacking player.
Go to the top of the page
 
+Quote Post
420
post Oct 5 2010, 08:09 PM
Post #3


The New Guy!

Posts: 5
From: Europe
Joined: 29-September 10



I have no idea what to do...

the best would be if they start shooting/drivebying when the car is shot at... (tried event 41... didn't work)


CODE
{$CLEO .cs}

//-------------MAIN---------------
03A4: name_thread 'VIP'

:VIP_11
0001: wait 0 ms
00D6: if and
0AB0:   key_pressed 71
0AB0:   key_pressed 79
004D: jump_if_false @VIP_11
077E: get_active_interior_to 6@
0001: wait 0 ms
00D6: if and
0256:   player $PLAYER_CHAR defined
0004: $ONMISSION = 0
0039:   6@ == 0
004D: jump_if_false @VIP_11
0002: jump @VIP_80

:VIP_80
04C4: store_coords_to 6@ 7@ 8@ from_actor $PLAYER_ACTOR with_offset 200.0 50.0 1.0
02C1: store_to 9@ 10@ 11@ car_path_coords_closest_to 6@ 7@ 8@
0247: load_model #ADMIRAL
0247: load_model #STRETCH
0247: load_model #WMYCH
0247: load_model #OMYRI
0247: load_model #WMOMIB
0247: load_model #BMYMIB
0247: load_model #MP5LNG

:VIP_163
0001: wait 0 ms
00D6: if and
0248:   model #ADMIRAL available
0248:   model #STRETCH available
0248:   model #WMYCH available
0248:   model #OMYRI available
0248:   model #WMOMIB available
0248:   model #BMYMIB available
0248:   model #MP5LNG available
004D: jump_if_false @VIP_163
00A5: 13@ = create_car #ADMIRAL at 9@ 10@ 11@
0229: set_car 13@ primary_color_to 0 secondary_color_to 0
0224: set_car 13@ health_to 3000
0129: 17@ = create_actor_pedtype 4 model #WMYCH in_car 13@ driverseat
0526: set_actor 17@ stay_in_car 1
01C8: 21@ = create_actor_pedtype 4 model #WMOMIB in_car 13@ passenger_seat 2
01C8: 22@ = create_actor_pedtype 4 model #BMYMIB in_car 13@ passenger_seat 1
01B2: give_actor 21@ weapon 29 ammo 100 // Load the weapon model before using this
01B2: give_actor 22@ weapon 29 ammo 100 // Load the weapon model before using this
0001: wait 100 ms
04C4: store_coords_to 6@ 7@ 8@ from_actor $PLAYER_ACTOR with_offset 210.0 50.0 1.0
02C1: store_to 9@ 10@ 11@ car_path_coords_closest_to 6@ 7@ 8@
00A5: 14@ = create_car #STRETCH at 9@ 10@ 11@
0229: set_car 14@ primary_color_to 0 secondary_color_to 0
0224: set_car 14@ health_to 5000
0129: 19@ = create_actor_pedtype 4 model #WMYCH in_car 14@ driverseat
0526: set_actor 19@ stay_in_car 1
01C8: 18@ = create_actor_pedtype 4 model #OMYRI in_car 14@ passenger_seat 2
01C8: 23@ = create_actor_pedtype 4 model #BMYMIB in_car 14@ passenger_seat 1
01B2: give_actor 23@ weapon 29 ammo 100 // Load the weapon model before using this
0001: wait 100 ms
04C4: store_coords_to 6@ 7@ 8@ from_actor $PLAYER_ACTOR with_offset 220.0 50.0 1.0
02C1: store_to 9@ 10@ 11@ car_path_coords_closest_to 6@ 7@ 8@
00A5: 15@ = create_car #ADMIRAL at 9@ 10@ 11@
0229: set_car 15@ primary_color_to 0 secondary_color_to 0
0224: set_car 15@ health_to 3000
0129: 20@ = create_actor_pedtype 4 model #WMYCH in_car 15@ driverseat
0526: set_actor 20@ stay_in_car 1
01C8: 24@ = create_actor_pedtype 4 model #WMOMIB in_car 15@ passenger_seat 2
01C8: 25@ = create_actor_pedtype 4 model #BMYMIB in_car 15@ passenger_seat 1
01B2: give_actor 24@ weapon 29 ammo 100 // Load the weapon model before using this
01B2: give_actor 25@ weapon 29 ammo 100 // Load the weapon model before using this
0001: wait 0 ms
04C4: store_coords_to 6@ 7@ 8@ from_actor $PLAYER_ACTOR with_offset -200.0 -50.0 1.0
02C1: store_to 9@ 10@ 11@ car_path_coords_closest_to 6@ 7@ 8@
00A7: car 13@ drive_to 9@ 10@ 11@
00AE: set_car 13@ traffic_behaviour_to 1
00AE: set_car 14@ traffic_behaviour_to 1
00AE: set_car 15@ traffic_behaviour_to 1
07F8: car 14@ follow_car 13@ radius 7.0
07F8: car 15@ follow_car 14@ radius 7.0
00AD: set_car 13@ max_speed_to 20.0
0167: 16@ = create_marker_at 9@ 10@ 11@ flags 0 2
0168: set_marker 16@ size 3
0165: set_marker 16@ color_to 2

// That't the part that won't work...

060A: create_decision_maker_type 0 store_to 28@ // decision\allowed\m_.ped files
060B: set_actor 21@ decision_maker_to 28@
060B: set_actor 22@ decision_maker_to 28@
060B: set_actor 23@ decision_maker_to 28@
060B: set_actor 24@ decision_maker_to 28@
060B: set_actor 25@ decision_maker_to 28@
077A: set_actor 21@ acquaintance 4 to_actors_pedtype 0 // see ped.dat
077A: set_actor 22@ acquaintance 4 to_actors_pedtype 0 // see ped.dat
077A: set_actor 23@ acquaintance 4 to_actors_pedtype 0 // see ped.dat
077A: set_actor 24@ acquaintance 4 to_actors_pedtype 0 // see ped.dat
077A: set_actor 25@ acquaintance 4 to_actors_pedtype 0 // see ped.dat

// End of that part

0249: release_model #ADMIRAL
0249: release_model #STRETCH
0249: release_model #WMYCH
0249: release_model #OMYRI
0249: release_model #WMOMIB
0249: release_model #BMYMIB
0249: release_model #MP5LNG

:VIP_900
0001: wait 0 ms
00D6: if or
8205:   not actor 19@ near_car 13@ radius 18.0 18.0 7.0 flag 0
8205:   not actor 20@ near_car 14@ radius 18.0 18.0 7.0 flag 0
004D: jump_if_false @VIP_1276
00AD: set_car 13@ max_speed_to 0.0

:VIP_975
0001: wait 0 ms
00D6: if and
0205:   actor 19@ near_car 13@ radius 10.0 10.0 5.0 flag 0
0205:   actor 20@ near_car 14@ radius 10.0 10.0 5.0 flag 0
004D: jump_if_false @VIP_1061
00AD: set_car 13@ max_speed_to 20.0
0001: wait 0 ms
0002: jump @VIP_1276

:VIP_1061
0001: wait 0 ms
00D6: if or
0119:   car 14@ wrecked
0118:   actor 18@ dead
0118:   actor $PLAYER_ACTOR dead
8205:   not actor $PLAYER_ACTOR near_car 14@ radius 220.0 220.0 50.0 flag 0
01AF:   car 14@ sphere 0 in_sphere 9@ 10@ 11@ radius 15.0 15.0 10.0
004D: jump_if_false @VIP_1154
0002: jump @VIP_2327

:VIP_1154
0001: wait 0 ms
00D6: if or
0119:   car 13@ wrecked
0118:   actor 17@ dead
80DB:   not actor 17@ in_car 13@
004D: jump_if_false @VIP_1222
0001: wait 0 ms
00A7: car 14@ drive_to 9@ 10@ 11@
00AD: set_car 14@ max_speed_to 30.0
0002: jump @VIP_1517

:VIP_1222
0001: wait 0 ms
00D6: if or
0119:   car 15@ wrecked
0118:   actor 20@ dead
80DB:   not actor 20@ in_car 15@
004D: jump_if_false @VIP_975
0001: wait 0 ms
00AD: set_car 13@ max_speed_to 30.0
0002: jump @VIP_1953

:VIP_1276
0001: wait 0 ms
00D6: if or
0119:   car 14@ wrecked
0118:   actor 18@ dead
0118:   actor $PLAYER_ACTOR dead
8205:   not actor $PLAYER_ACTOR near_car 14@ radius 220.0 220.0 50.0 flag 0
01AF:   car 14@ sphere 0 in_sphere 9@ 10@ 11@ radius 15.0 15.0 10.0
004D: jump_if_false @VIP_1382
0002: jump @VIP_2327
0662: NOP "AAAAAAAAA"

:VIP_1382
0001: wait 0 ms
00D6: if or
0119:   car 13@ wrecked
0118:   actor 17@ dead
80DB:   not actor 17@ in_car 13@
004D: jump_if_false @VIP_1450
0001: wait 0 ms
00A7: car 14@ drive_to 9@ 10@ 11@
00AD: set_car 14@ max_speed_to 30.0
0002: jump @VIP_1517

:VIP_1450
0001: wait 0 ms
00D6: if or
0119:   car 15@ wrecked
0118:   actor 20@ dead
80DB:   not actor 20@ in_car 15@
004D: jump_if_false @VIP_900
0001: wait 0 ms
00AD: set_car 13@ max_speed_to 30.0
0002: jump @VIP_1953
0662: NOP "AAAAAAAAA"

:VIP_1517
0001: wait 0 ms
00D6: if
8205:   not actor 20@ near_car 14@ radius 18.0 18.0 7.0 flag 0
004D: jump_if_false @VIP_1721
00AD: set_car 14@ max_speed_to 0.0

:VIP_1567
0001: wait 0 ms
00D6: if
0205:   actor 20@ near_car 14@ radius 10.0 10.0 5.0 flag 0
004D: jump_if_false @VIP_1628
00AD: set_car 14@ max_speed_to 30.0
0001: wait 0 ms
0002: jump @VIP_1721

:VIP_1628
0001: wait 0 ms
00D6: if or
0119:   car 14@ wrecked
0118:   actor 18@ dead
0118:   actor $PLAYER_ACTOR dead
8205:   not actor $PLAYER_ACTOR near_car 14@ radius 220.0 220.0 50.0 flag 0
01AF:   car 14@ sphere 0 in_sphere 9@ 10@ 11@ radius 15.0 15.0 10.0
004D: jump_if_false @VIP_1567
0002: jump @VIP_2327

:VIP_1721
0001: wait 0 ms
00D6: if or
0119:   car 14@ wrecked
0118:   actor 18@ dead
0118:   actor $PLAYER_ACTOR dead
8205:   not actor $PLAYER_ACTOR near_car 14@ radius 220.0 220.0 50.0 flag 0
01AF:   car 14@ sphere 0 in_sphere 9@ 10@ 11@ radius 15.0 15.0 10.0
004D: jump_if_false @VIP_1827
0002: jump @VIP_2327
0662: NOP "AAAAAAAAA"

:VIP_1827
0001: wait 0 ms
00D6: if or
0119:   car 15@ wrecked
0118:   actor 20@ dead
80DB:   not actor 20@ in_car 15@
004D: jump_if_false @VIP_1517

:VIP_1860
0001: wait 0 ms
00D6: if or
0119:   car 14@ wrecked
0118:   actor 18@ dead
0118:   actor $PLAYER_ACTOR dead
8205:   not actor $PLAYER_ACTOR near_car 14@ radius 220.0 220.0 50.0 flag 0
01AF:   car 14@ sphere 0 in_sphere 9@ 10@ 11@ radius 15.0 15.0 10.0
004D: jump_if_false @VIP_1860
0002: jump @VIP_2327

:VIP_1953
0001: wait 0 ms
00D6: if
8205:   not actor 19@ near_car 13@ radius 18.0 18.0 7.0 flag 0
004D: jump_if_false @VIP_2157
00AD: set_car 13@ max_speed_to 0.0

:VIP_2003
0001: wait 0 ms
00D6: if
0205:   actor 19@ near_car 13@ radius 10.0 10.0 5.0 flag 0
004D: jump_if_false @VIP_2064
00AD: set_car 13@ max_speed_to 30.0
0001: wait 0 ms
0002: jump @VIP_2157

:VIP_2064
0001: wait 0 ms
00D6: if or
0119:   car 14@ wrecked
0118:   actor 18@ dead
0118:   actor $PLAYER_ACTOR dead
8205:   not actor $PLAYER_ACTOR near_car 14@ radius 220.0 220.0 50.0 flag 0
01AF:   car 14@ sphere 0 in_sphere 9@ 10@ 11@ radius 15.0 15.0 10.0
004D: jump_if_false @VIP_2003
0002: jump @VIP_2327

:VIP_2157
0001: wait 0 ms
00D6: if or
0119:   car 14@ wrecked
0118:   actor 18@ dead
0118:   actor $PLAYER_ACTOR dead
8205:   not actor $PLAYER_ACTOR near_car 14@ radius 220.0 220.0 50.0 flag 0
01AF:   car 14@ sphere 0 in_sphere 9@ 10@ 11@ radius 15.0 15.0 10.0
004D: jump_if_false @VIP_2263
0002: jump @VIP_2327
0662: NOP "AAAAAAAAA"

:VIP_2263
0001: wait 0 ms
00D6: if or
0119:   car 13@ wrecked
0118:   actor 17@ dead
80DB:   not actor 17@ in_car 13@
004D: jump_if_false @VIP_1953
00A7: car 14@ drive_to 9@ 10@ 11@
00AD: set_car 14@ max_speed_to 30.0
0002: jump @VIP_1860

:VIP_2327
0001: wait 0 ms
01C3: remove_references_to_car 13@ // Like turning a car into any random car
01C3: remove_references_to_car 14@ // Like turning a car into any random car
01C3: remove_references_to_car 15@ // Like turning a car into any random car
01C2: remove_references_to_actor 17@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 18@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 19@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 20@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 21@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 22@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 23@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 24@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 25@ // Like turning an actor into a random pedestrian
0164: disable_marker 16@
0394: play_music 2
0002: jump @VIP_11
Go to the top of the page
 
+Quote Post
Deji
post Oct 6 2010, 05:04 PM
Post #4


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



I'm not sure about the involvement in "acquainance" opcodes. I assume it just changes which of the decision maker respect/like/dislike/hate values have to be set in order for the actor to do something with to the other actor.

SANNY
060A: create_decision_maker_type 0 store_to 28@ // decision\allowed\m_.ped files
060B: set_actor 21@ decision_maker_to 28@
060B: set_actor 22@ decision_maker_to 28@
060B: set_actor 23@ decision_maker_to 28@
060B: set_actor 24@ decision_maker_to 28@
060B: set_actor 25@ decision_maker_to 28@
077A: set_actor 21@ acquaintance 4 to_actors_pedtype 0 // see ped.dat
077A: set_actor 22@ acquaintance 4 to_actors_pedtype 0 // see ped.dat
077A: set_actor 23@ acquaintance 4 to_actors_pedtype 0 // see ped.dat
077A: set_actor 24@ acquaintance 4 to_actors_pedtype 0 // see ped.dat
077A: set_actor 25@ acquaintance 4 to_actors_pedtype 0 // see ped.dat



Here you're creating a blank decision maker and assigning all the actors to it without setting what that decision maker does. So I'd assume when you attack the actor, it just stands there or does a basic duck.

Read this guide on Decision Makers and use GTAModdings Ped Event and Tasks documentation.

I'm not sure on the ID's for 077A, but I had this in a file from a while back:

CODE
//---------------------
// ACQUAINTANCE FLAGS

RESPECT  = 1
HATE     = 2
LIKE     = 3
DISLIKE  = 4


Not sure on validity, but you could always just try each ID.


So this is what I'd use for the code, based on the information given:

SANNY
060A: create_decision_maker_type 0 store_to 28@ // decision\allowed\m_.ped files
0709: set_decision_maker 28@ on_event 36 {when the actor sees a ped he hates} task 1000 {kill ped on foot} respect 0.0 hate 0.0 like 0.0 dislike 0.0 in_car 1 on_foot 1
060B: set_actor 21@ decision_maker_to 28@
[...]


However, if the actors react to this event, they will exit the car to kill the player. You could create a different decision maker for the ones in a car if you want them to stay in it.


If you don't want them to attack until the player fires a shot or attacks them etc...

SANNY
0709: set_decision_maker 28@ on_event 36 {when the actor sees a ped he hates} task 1000 {kill ped on foot} respect 0.0 hate 25.0 {has to be a little annoyed with the player} like 0.0 dislike 0.0 in_car 1 on_foot 1



--------------------
Go to the top of the page
 
+Quote Post
420
post Oct 6 2010, 07:06 PM
Post #5


The New Guy!

Posts: 5
From: Europe
Joined: 29-September 10



Thanks, i already read the post about decision markers... i tried to use event 41; weapon damage to the actor's car, didn't work. Anyway, event 36 works...

Setting the acquaintance to 4 usually results in killing the hated actor....
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: