Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Cayo Perico Heist
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

Sign in to follow this  
Vdragon

Ped get Player out of car

Recommended Posts

Vdragon

How do i make the Ped do that? I have Peds in a relation group and they automatically attack the player, but they just stand here when the player is in a vehicle.

Share this post


Link to post
Share on other sites
ISOFX

If you're using C# this is how you would do it:

if F9 is pressed while you're in a vehicle they will come and drag you out for 5 seconds then walk off, you can change the key or remove it and put it in your script.

                    if (Game.Player.Character.IsInVehicle() && e.KeyCode == Keys.F9)                    {                        Ped DragPed;                        Game.Player.Character.CanBeDraggedOutOfVehicle = true;                        DragPed = World.CreatePed(PedHash.Franklin, Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 5, 0)));                        DragPed.Task.FightAgainst(Game.Player.Character, 5000);                    }

Hope this Helps! :)

Share this post


Link to post
Share on other sites
Vdragon

If you're using C# this is how you would do it:

if F9 is pressed while you're in a vehicle they will come and drag you out for 5 seconds then walk off, you can change the key or remove it and put it in your script.

                    if (Game.Player.Character.IsInVehicle() && e.KeyCode == Keys.F9)                    {                        Ped DragPed;                        Game.Player.Character.CanBeDraggedOutOfVehicle = true;                        DragPed = World.CreatePed(PedHash.Franklin, Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 5, 0)));                        DragPed.Task.FightAgainst(Game.Player.Character, 5000);                    }

Hope this Helps! :)

I'm using c++, but looking at how you are doing it, forcing a fight do what i want, i'm not forcing fight (only registering target, and the ped hates everyone), so i should just force the attack if the player is in a vehicle. Thanks.

Share this post


Link to post
Share on other sites
ISOFX

 

If you're using C# this is how you would do it:

if F9 is pressed while you're in a vehicle they will come and drag you out for 5 seconds then walk off, you can change the key or remove it and put it in your script.

                    if (Game.Player.Character.IsInVehicle() && e.KeyCode == Keys.F9)                    {                        Ped DragPed;                        Game.Player.Character.CanBeDraggedOutOfVehicle = true;                        DragPed = World.CreatePed(PedHash.Franklin, Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 5, 0)));                        DragPed.Task.FightAgainst(Game.Player.Character, 5000);                    }

Hope this Helps! :)

I'm using c++, but looking at how you are doing it, forcing a fight do what i want, i'm not forcing fight (only registering target, and the ped hates everyone), so i should just force the attack if the player is in a vehicle. Thanks.

 

Oh, C++, The only way i know is to fight against them and then that pulls them out. Just find something similar to what i put and it shouldnt be hard to convert to C++, or just change the relationship group to "HATES_PLAYER" and it probably attacks you i think.

Share this post


Link to post
Share on other sites
Vdragon

 

 

If you're using C# this is how you would do it:

if F9 is pressed while you're in a vehicle they will come and drag you out for 5 seconds then walk off, you can change the key or remove it and put it in your script.

                    if (Game.Player.Character.IsInVehicle() && e.KeyCode == Keys.F9)                    {                        Ped DragPed;                        Game.Player.Character.CanBeDraggedOutOfVehicle = true;                        DragPed = World.CreatePed(PedHash.Franklin, Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 5, 0)));                        DragPed.Task.FightAgainst(Game.Player.Character, 5000);                    }

Hope this Helps! :)

I'm using c++, but looking at how you are doing it, forcing a fight do what i want, i'm not forcing fight (only registering target, and the ped hates everyone), so i should just force the attack if the player is in a vehicle. Thanks.

 

Oh, C++, The only way i know is to fight against them and then that pulls them out. Just find something similar to what i put and it shouldnt be hard to convert to C++, or just change the relationship group to "HATES_PLAYER" and it probably attacks you i think.

 

They are created with the relationship group 'COUGAR' so they hate everybody except other 'COUGAR', i've been trying to set up a attack manually, but it doesn't work with AI::TASK_COMBAT_PED for some reasons :/

Share this post


Link to post
Share on other sites
whorse

I used this code to make ambient peds fight in my riot mod:

void fight(Ped ped1, Ped target){     if (WEAPON::IS_PED_ARMED(ped1, 0xFF) || WEAPON::IS_PED_ARMED(target, 0xFF))          AI::TASK_COMBAT_PED(ped1, target, 0, 16);     else          AI::TASK_PUT_PED_DIRECTLY_INTO_MELEE(ped1, target, 0, 0, 0, 0);}

because the melee native makes both the target and the attacker put their weapons away (which makes any ped with a gun constantly holster/unholster).

 

I also added them to a group that hates everyone (like COUGAR), except I made my own group. The only ones who arent willing to fight eachother are non-civilian peds from the same ped-type (like cops vs cops, SWAT vs SWAT, firefighters vs firefighters). Cops will fight SWAT though, and firefighters will fight paramedics etc.

 

Also, these natives would keep the peds on the offensive no matter what:

PED::SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(ped1, true);PED::SET_PED_FLEE_ATTRIBUTES(ped1, 0, 0);PED::SET_PED_COMBAT_ATTRIBUTES(ped1, 46, TRUE);

Share this post


Link to post
Share on other sites
Vdragon

 

I used this code to make ambient peds fight in my riot mod:

void fight(Ped ped1, Ped target){     if (WEAPON::IS_PED_ARMED(ped1, 0xFF) || WEAPON::IS_PED_ARMED(target, 0xFF))          AI::TASK_COMBAT_PED(ped1, target, 0, 16);     else          AI::TASK_PUT_PED_DIRECTLY_INTO_MELEE(ped1, target, 0, 0, 0, 0);}

because the melee native makes both the target and the attacker put their weapons away (which makes any ped with a gun constantly holster/unholster).

 

I also added them to a group that hates everyone (like COUGAR), except I made my own group. The only ones who arent willing to fight eachother are non-civilian peds from the same ped-type (like cops vs cops, SWAT vs SWAT, firefighters vs firefighters). Cops will fight SWAT though, and firefighters will fight paramedics etc.

 

Also, these natives would keep the peds on the offensive no matter what:

PED::SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(ped1, true);PED::SET_PED_FLEE_ATTRIBUTES(ped1, 0, 0);PED::SET_PED_COMBAT_ATTRIBUTES(ped1, 46, TRUE);

I actually did look at your mod when setting up the peds in mine, I'm using almost the same method (no fight function tho, only PED::REGISTER_HATED_TARGETS_AROUND_PED), props to you.

Yet, none of my ped seems to be able to get my player out of his car (even when using direct fight with TASK_COMBAT_PED or TASK_PUT_PED_DIRECTLY_INTO_MELEE), also, using KNOCK_PED_OFF_VEHICLE does nothing on my player, for some weird reason... So i suspect there may be something preventing that from happening...

the code that spawn peds is this:

char* animation = animations[rand() % animations.size()];					STREAMING::REQUEST_ANIM_SET(animation);					Ped i = PED::CREATE_RANDOM_PED(x, y, z);					zombies.push_back(i);					PED::SET_PED_MOVEMENT_CLIPSET(i, animation, 0x3e800000);					PED::SET_PED_DIES_WHEN_INJURED(i, false);					PED::SET_PED_RELATIONSHIP_GROUP_HASH(i, Utilities::get_hash("COUGAR"));					PED::SET_PED_COMBAT_ABILITY(i, 2);					PED::SET_PED_COMBAT_MOVEMENT(i, 3);					AUDIO::SET_AMBIENT_VOICE_NAME(i, "ALIENS");					AUDIO::DISABLE_PED_PAIN_AUDIO(i, true);					PED::SET_PED_COMBAT_ATTRIBUTES(i, 46, TRUE);					PED::APPLY_PED_DAMAGE_PACK(i, "BigHitByVehicle", 0, 1.0f);					PED::APPLY_PED_DAMAGE_PACK(i, "Explosion_Med", 0, 1.0f);					PED::SET_PED_RANDOM_PROPS(i);					AI::CLEAR_PED_TASKS(i);					AI::CLEAR_PED_SECONDARY_TASK(i);					PED::SET_PED_KEEP_TASK(i, false);					PED::SET_PED_HEARING_RANGE(i, HEAR_RANGE);					PED::SET_PED_COMBAT_RANGE(i, 0);					AI::TASK_WANDER_STANDARD(i, (float)(rand() % 360), 0);					AI::SET_PED_PATH_CAN_DROP_FROM_HEIGHT(i, true);					AI::SET_PED_PATH_AVOID_FIRE(i, false);					PED::SET_PED_SEEING_RANGE(i, 8.0f);					PED::SET_PED_KEEP_TASK(i, true);					PED::SET_PED_ALERTNESS(i, 3);
Edited by Vdragon

Share this post


Link to post
Share on other sites
elsewhat

You could make them enter the car in the seat position the player is in (likely as the driver). This will make them throw out the player at the same time.

 

seatIndex should be set to -1

AI::TASK_ENTER_VEHICLE(ped, playerVehicle, -1, seatIndex, 2.0, 1, 0);

ref http://www.dev-c.com/nativedb/func/info/c20e50aa46d09ca8

Share this post


Link to post
Share on other sites
Vdragon

You could make them enter the car in the seat position the player is in (likely as the driver). This will make them throw out the player at the same time.

 

seatIndex should be set to -1

AI::TASK_ENTER_VEHICLE(ped, playerVehicle, -1, seatIndex, 2.0, 1, 0);

ref http://www.dev-c.com/nativedb/func/info/c20e50aa46d09ca8

I did try that already actually... i think there may be something wrong with the player, i'm going to do more tests.*

code used was:

if (PED::IS_PED_IN_ANY_VEHICLE(target, false) && GAMEPLAY::GET_DISTANCE_BETWEEN_COORDS(tCoords.x, tCoords.y, tCoords.z, pCoords.x, pCoords.y, pCoords.z, true) < 10.0f)					{						AI::CLEAR_PED_TASKS(*it);						AI::CLEAR_PED_SECONDARY_TASK(*it);						PED::SET_PED_KEEP_TASK(*it, false);						AI::TASK_ENTER_VEHICLE(*it, PED::GET_VEHICLE_PED_IS_IN(target, false), -1, -1, 2.0f, 1, 0);						PED::SET_PED_KEEP_TASK(*it, true);					}
Edited by Vdragon

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.