#Game: Vice City Stories
#Author: Micsuit
#Version: 1.0
#Category: Pedestrians
#Date: 2022-04-25
#Description: Spawns a random ped that tries to kill you! Kill him first!

:COORDINATES_ENEMY
0138: generate_random_float_in_range -3.0 3.0 store_to 5@ //left right of player
0138: generate_random_float_in_range 2.0 5.0 store_to 6@ //in front of player
02EE: get_offset_from_char_in_world_coords $PLAYER_CHAR offset 5@ 6@ 0.0 store_to 5@ 6@ 7@

:SPAWN_ENEMY
0139: generate_random_int_in_range 16 167 store_to 15@ // Random ids of passengers, found in Sanny Builder/data/vcs/models.ide
0139: generate_random_int_in_range 0 37 store_to 10@ // Give the killer a random weapon
01D9: print_with_2_numbers_now '~r~Pedestrian ID: ~1~~w~~n~~b~Weapon ID: ~1~~w~' numbers 15@ 10@ time 1500 flag 1
0160: request_model 15@
0228: load_all_models_now
003E: create_char 21 model 15@ at 5@ 6@ 7@ store_to $5348

:ENEMY_SETTINGS
014B: set_char_health $5348 to 100 // Health = 100
0278: set_char_money $5348 to 0 // Money = 0$ 
00F3: set_char_obj_walk_to_char $5348 char $PLAYER_CHAR // Walk to player
0106: give_weapon_to_char $5348 weapon 10@ ammo 9999 // Give the weapon to the random ped
00E4: set_char_obj_kill_char_on_foot $5348 char $PLAYER_CHAR // Kill player

:TERMINATE_SCRIPT
0023: terminate_this_script
