Scenarios
Scenarios are short looping animations that can be triggered with the
Scenarios can be invoked by using the task:
StartScenario(string name, Vector3 position, float heading);
The StartScenario task function requires 3 parameters: the name of the scenario you want to play, the position in which your
Try to play the scenario animation WORLD_HUMAN_BINOCULARS on your game character:
Game.Player.Character.Task.StartScenario("WORLD_HUMAN_BINOCULARS", Game.Player.Character.Position, 1f);
Scenarios are looping by default. Since scenarios are tasks, you can use
List of available scenarios
WORLD_HUMAN_AA_COFFEE
WORLD_HUMAN_AA_SMOKE
WORLD_HUMAN_BINOCULARS
WORLD_HUMAN_BUM_FREEWAY
WORLD_HUMAN_BUM_SLUMPED
WORLD_HUMAN_BUM_STANDING
WORLD_HUMAN_BUM_WASH
WORLD_HUMAN_VALET
WORLD_HUMAN_CAR_PARK_ATTENDANT
WORLD_HUMAN_CHEERING
WORLD_HUMAN_CLIPBOARD
WORLD_HUMAN_CLIPBOARD_FACILITY
WORLD_HUMAN_CONST_DRILL
WORLD_HUMAN_COP_IDLES
WORLD_HUMAN_DRINKING
WORLD_HUMAN_DRINKING_FACILITY
WORLD_HUMAN_DRINKING_CASINO_TERRACE
WORLD_HUMAN_DRUG_DEALER
WORLD_HUMAN_DRUG_DEALER_HARD
WORLD_HUMAN_MOBILE_FILM_SHOCKING
WORLD_HUMAN_GARDENER_LEAF_BLOWER
WORLD_HUMAN_GARDENER_PLANT
WORLD_HUMAN_GOLF_PLAYER
WORLD_HUMAN_GUARD_PATROL
WORLD_HUMAN_GUARD_STAND
WORLD_HUMAN_GUARD_STAND_CASINO
WORLD_HUMAN_GUARD_STAND_CLUBHOUSE
WORLD_HUMAN_GUARD_STAND_FACILITY
WORLD_HUMAN_GUARD_STAND_ARMY
WORLD_HUMAN_HAMMERING
WORLD_HUMAN_HANG_OUT_STREET
WORLD_HUMAN_HANG_OUT_STREET_CLUBHOUSE
WORLD_HUMAN_HIKER
WORLD_HUMAN_HIKER_STANDING
WORLD_HUMAN_HUMAN_STATUE
WORLD_HUMAN_JANITOR
WORLD_HUMAN_JOG
WORLD_HUMAN_JOG_STANDING
WORLD_HUMAN_LEANING
WORLD_HUMAN_LEANING_CASINO_TERRACE
WORLD_HUMAN_MAID_CLEAN
WORLD_HUMAN_MUSCLE_FLEX
WORLD_HUMAN_MUSCLE_FREE_WEIGHTS
WORLD_HUMAN_MUSICIAN
WORLD_HUMAN_PAPARAZZI
WORLD_HUMAN_PARTYING
WORLD_HUMAN_PICNIC
WORLD_HUMAN_POWER_WALKER
WORLD_HUMAN_PROSTITUTE_HIGH_CLASS
WORLD_HUMAN_PROSTITUTE_LOW_CLASS
WORLD_HUMAN_PUSH_UPS
WORLD_HUMAN_SEAT_LEDGE
WORLD_HUMAN_SEAT_LEDGE_EATING
WORLD_HUMAN_SEAT_STEPS
WORLD_HUMAN_SEAT_WALL
WORLD_HUMAN_SEAT_WALL_EATING
WORLD_HUMAN_SEAT_WALL_TABLET
WORLD_HUMAN_SECURITY_SHINE_TORCH
WORLD_HUMAN_SIT_UPS
WORLD_HUMAN_SMOKING
WORLD_HUMAN_SMOKING_CLUBHOUSE
WORLD_HUMAN_SMOKING_POT
WORLD_HUMAN_SMOKING_POT_CLUBHOUSE
WORLD_HUMAN_STAND_FIRE
WORLD_HUMAN_STAND_FISHING
WORLD_HUMAN_STAND_IMPATIENT
WORLD_HUMAN_STAND_IMPATIENT_CLUBHOUSE
WORLD_HUMAN_STAND_IMPATIENT_FACILITY
WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT
WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT_FACILITY
WORLD_HUMAN_STAND_MOBILE
WORLD_HUMAN_STAND_MOBILE_CLUBHOUSE
WORLD_HUMAN_STAND_MOBILE_FACILITY
WORLD_HUMAN_STAND_MOBILE_UPRIGHT
WORLD_HUMAN_STAND_MOBILE_UPRIGHT_CLUBHOUSE
WORLD_HUMAN_STRIP_WATCH_STAND
WORLD_HUMAN_STUPOR
WORLD_HUMAN_STUPOR_CLUBHOUSE
WORLD_HUMAN_SUNBATHE
WORLD_HUMAN_SUNBATHE_BACK
WORLD_HUMAN_SUPERHERO
WORLD_HUMAN_SWIMMING
WORLD_HUMAN_TENNIS_PLAYER
WORLD_HUMAN_TOURIST_MAP
WORLD_HUMAN_TOURIST_MOBILE
WORLD_HUMAN_VEHICLE_MECHANIC
WORLD_HUMAN_WELDING
WORLD_HUMAN_WINDOW_SHOP_BROWSE
WORLD_HUMAN_YOGA
PROP_HUMAN_ATM
PROP_HUMAN_BBQ
PROP_HUMAN_BUM_BIN
PROP_HUMAN_BUM_SHOPPING_CART
PROP_HUMAN_MUSCLE_CHIN_UPS
PROP_HUMAN_MUSCLE_CHIN_UPS_ARMY
PROP_HUMAN_MUSCLE_CHIN_UPS_PRISON
PROP_HUMAN_PARKING_METER
PROP_HUMAN_SEAT_ARMCHAIR
PROP_HUMAN_SEAT_BAR
PROP_HUMAN_SEAT_BENCH
PROP_HUMAN_SEAT_BENCH_FACILITY
PROP_HUMAN_SEAT_BENCH_DRINK
PROP_HUMAN_SEAT_BENCH_DRINK_FACILITY
PROP_HUMAN_SEAT_BENCH_DRINK_BEER
PROP_HUMAN_SEAT_BENCH_FOOD
PROP_HUMAN_SEAT_BENCH_FOOD_FACILITY
PROP_HUMAN_SEAT_BUS_STOP_WAIT
PROP_HUMAN_SEAT_CHAIR
PROP_HUMAN_SEAT_CHAIR_DRINK
PROP_HUMAN_SEAT_CHAIR_DRINK_BEER
PROP_HUMAN_SEAT_CHAIR_FOOD
PROP_HUMAN_SEAT_CHAIR_UPRIGHT
PROP_HUMAN_SEAT_CHAIR_MP_PLAYER
PROP_HUMAN_SEAT_COMPUTER
PROP_HUMAN_SEAT_COMPUTER_LOW
PROP_HUMAN_SEAT_DECKCHAIR
PROP_HUMAN_SEAT_DECKCHAIR_DRINK
PROP_HUMAN_SEAT_MUSCLE_BENCH_PRESS
PROP_HUMAN_SEAT_MUSCLE_BENCH_PRESS_PRISON
PROP_HUMAN_SEAT_SEWING
PROP_HUMAN_SEAT_STRIP_WATCH
PROP_HUMAN_SEAT_SUNLOUNGER
PROP_HUMAN_STAND_IMPATIENT
CODE_HUMAN_CROSS_ROAD_WAIT
CODE_HUMAN_MEDIC_KNEEL
CODE_HUMAN_MEDIC_TEND_TO_DEAD
CODE_HUMAN_MEDIC_TIME_OF_DEATH
CODE_HUMAN_POLICE_CROWD_CONTROL
CODE_HUMAN_POLICE_INVESTIGATE
EAR_TO_TEXT
EAR_TO_TEXT_FAT
--- ---
WORLD_BOAR_GRAZING
WORLD_CAT_SLEEPING_GROUND
WORLD_CAT_SLEEPING_LEDGE
WORLD_COW_GRAZING
WORLD_COYOTE_HOWL
WORLD_COYOTE_REST
WORLD_COYOTE_WANDER
WORLD_COYOTE_WALK
WORLD_CHICKENHAWK_FEEDING
WORLD_CHICKENHAWK_STANDING
WORLD_CORMORANT_STANDING
WORLD_CROW_FEEDING
WORLD_CROW_STANDING
WORLD_DEER_GRAZING
WORLD_DOG_BARKING_ROTTWEILER
WORLD_DOG_BARKING_RETRIEVER
WORLD_DOG_BARKING_SHEPHERD
WORLD_DOG_SITTING_ROTTWEILER
WORLD_DOG_SITTING_RETRIEVER
WORLD_DOG_SITTING_SHEPHERD
WORLD_DOG_BARKING_SMALL
WORLD_DOG_SITTING_SMALL
WORLD_DOLPHIN_SWIM
WORLD_FISH_FLEE
WORLD_FISH_IDLE
WORLD_GULL_FEEDING
WORLD_GULL_STANDING
WORLD_HEN_FLEE
WORLD_HEN_PECKING
WORLD_HEN_STANDING
WORLD_MOUNTAIN_LION_REST
WORLD_MOUNTAIN_LION_WANDER
WORLD_ORCA_SWIM
WORLD_PIG_GRAZING
WORLD_PIGEON_FEEDING
WORLD_PIGEON_STANDING
WORLD_RABBIT_EATING
WORLD_RABBIT_FLEE
WORLD_RATS_EATING
WORLD_RATS_FLEEING
WORLD_SHARK_SWIM
WORLD_SHARK_HAMMERHEAD_SWIM
WORLD_STINGRAY_SWIM
You can give scenarios to multiple
List<string> myScenarios = new List<string>();
List<Ped> myPeds = new List<Ped>();
Then you can add NPCs and scenarios by adding them to each respective
Ped myFirstPed = World.CreatePed(PedHash.Clown01SMY, Game.Player.Character. GetOffsetPosition(new Vector3(0, 8, 0)));
Ped mySecondPed = World.CreatePed(PedHash.Clown01SMY, Game.Player.Character. GetOffsetPosition(new Vector3(2, 8, 0)));
//add the Ped to my list of Peds myPeds
myPeds.Add(myFirstPed);
//add the two Peds to my list of Peds myPeds
myPeds.Add(mySecondPed);
//add scenarios to the list of scenarios
myScenarios.Add("WORLD_HUMAN_AA_COFFEE");
myScenarios.Add("WORLD_HUMAN_TOURIST_MAP");
myScenarios.Add("WORLD_HUMAN_TOURIST_MOBILE");
You can control individual NPCs and trigger specific scenarios by going through the list items. For example the following line will control the first NPC
//get the first ped in the list to play the third scenario in the list
myPeds[0].Task.StartScenario(scenarios[2], myPeds[0].Position, 300f);
In the code below you press
Example code
using System;
using System.Windows.Forms;
using GTA;
using GTA.Math;
using System.Collections.Generic;
namespace moddingTutorial
{
public class moddingTutorial : Script
{
//create two empty list to store your scenarios and your NPCs
List<string> myScenarios = new List<string>();
List<Ped> myPeds = new List<Ped>();
public moddingTutorial()
{
this.KeyDown += onKeyDown;
}
private void onKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.G) //PRESS G
{
//add scenarios to the list of scenarios
myScenarios.Add("WORLD_HUMAN_AA_COFFEE");
myScenarios.Add("WORLD_HUMAN_TOURIST_MAP");
myScenarios.Add("WORLD_HUMAN_TOURIST_MOBILE");
myScenarios.Add("WORLD_HUMAN_BINOCULARS");
myScenarios.Add("WORLD_HUMAN_PARTYING");
myScenarios.Add("WORLD_HUMAN_MUSCLE_FLEX");
//create 5 Clown NPCs and add the to the list of myPeds
for (int i = 0; i < 5; i++)
{
//spawn a new Ped called newPed
Ped newPed = World.CreatePed(PedHash.Clown01SMY, Game.Player.Character. GetOffsetPosition(new Vector3(i - 2.5f, 8, 0)));
//add the new Ped to my list of Peds
myPeds.Add(newPed);
}
}
if (e.KeyCode == Keys.H) //PRESS H
{
//if the Peds have been spawned
if(myPeds.Count >0)
{
//give the scenarios to the Peds
for (int i = 0; i < 5; i++)
{
myPeds[i].Task.StartScenario(myScenarios[i], myPeds[i].Position, 300f);
}
}
}
if (e.KeyCode == Keys.J) //PRESS J
{
//if the Peds have been spawned
if(myPeds.Count >0)
{
//stop the task of each Ped
for (int i = 0; i < 5; i++)
{
myPeds[i].Task.ClearAllImmediately();
}
}
}
if (e.KeyCode == Keys.K) //PRESS K
{
//if the Peds have been spawned
if(myPeds.Count >0)
{
//delete 5 Peds
for (int i = 0; i < 5; i++)
{
myPeds[i].Delete();
}
//and clear the list
myPeds.Clear();
}
}
}
}
}