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

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
motorsport71

[c++ Spawned Ped Not Taking Attributes]

Recommended Posts

motorsport71

Hey all. i'm working on spawning a ped but it doesn't seem to be taking the ENTITY::SET_ENTITY_AS_MISSION_ENTITY flag. When i spawn a bodyguard using the same code they are fine, but regular pedestrians won't take the code. Does anyone have an idea what it could be? here's the example:

if (ZombieSpawn)
	{
		
		ZombieSpawn = false;

		Player player = PLAYER::PLAYER_ID();
		Ped playerPed = PLAYER::PLAYER_PED_ID();
		
		Ped ped2;
		int max = 80;
		int min = 70;

		int X = rand() % (max - min) + min;
		
		if (rand() % 2 == 0)
		{
			X = X * -1;

		}
		

		int y = rand() % (max - min) + min;

		if (rand() % 2 == 0)
		{
			y = y * -1;

		}

		Vector3 spawnPos;
		

		spawnPos = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 0.0f, 0.0f);
		PED::CREATE_RANDOM_PED(spawnPos.x + X, spawnPos.y + y, -0.5);

		ENTITY::SET_ENTITY_AS_MISSION_ENTITY(ped2, true, true);


		STREAMING::REQUEST_ANIM_SET("[email protected]@verydrunk");
		PED::SET_PED_KEEP_TASK(ped2, true);
		PED::SET_PED_MOVEMENT_CLIPSET(ped2, "[email protected]@verydrunk", 1.0);
		PED::SET_BLOCKING_OF_NON_TEMPORARY_EVENTS(ped2, 1);
		PED::SET_PED_FLEE_ATTRIBUTES(ped2, 0, 0);
		PED::SET_PED_COMBAT_ATTRIBUTES(ped2, 46, 1);
		PED::SET_PED_HEARING_RANGE(ped2, 5);
		PED::SET_PED_SEEING_RANGE(ped2, 20);
		PED::SET_PED_DIES_INSTANTLY_IN_WATER(ped2, true);
		PED::SET_PED_MAX_HEALTH(ped2, 9999);
		PED::SET_PED_CAN_SWITCH_WEAPON(ped2, false);
		PED::SET_PED_AS_ENEMY(ped2, true);
		PED::SET_PED_MONEY(ped2, 0);
		PED::APPLY_PED_DAMAGE_PACK(ped2, "SCR_Torture", 0.0, 9.0);
		PED::APPLY_PED_DAMAGE_PACK(ped2, "SCR_Dumpster", 0.0, 9.0);
		PED::APPLY_PED_DAMAGE_PACK(ped2, "BigHitByVehicle", 0.0, 9.0);
		PED::SET_PED_CAN_PLAY_GESTURE_ANIMS(ped2, false);

		WEAPON::REMOVE_ALL_PED_WEAPONS(ped2, true);

		AI::SET_PED_PATH_CAN_DROP_FROM_HEIGHT(ped2, true);
		AI::SET_PED_PATH_PREFER_TO_AVOID_WATER(ped2, true);
		AI::SET_PED_PATH_CAN_USE_CLIMBOVERS(ped2, true);
		AI::SET_PED_PATH_CAN_USE_LADDERS(ped2, true);

		ENTITY::SET_ENTITY_MAX_HEALTH(ped2, 1200);
		ENTITY::SET_ENTITY_HEALTH(ped2, 1200);

		AUDIO::DISABLE_PED_PAIN_AUDIO(ped2, true);
		AUDIO::STOP_PED_SPEAKING(ped2, true);
		

		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(RelationshipHate, playerPed, 580191176); //shark vs player
		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(RelationshipHate, 580191176, playerPed); //shark vs player


		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(RelationshipHate, 45677184, 580191176); //civmale vs shark

		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(RelationshipHate,  580191176, 45677184);//shark vs civmale
		
		AI::TASK_COMBAT_HATED_TARGETS_AROUND_PED(ped2, 30.0f, 0);

	}

If you see what i'm missing please let me know. I set this on a keypress to test the peds reaction and they just stand there, and when there is gun fire they run like a non mission character.

Thanks for reading,

 

motorsport71

Share this post


Link to post
Share on other sites
LeeC2202

I don't programme in C++ but from what I can see, you're not assigning the random ped to ped2. I think you need to do it like this:

ped2 = PED::CREATE_RANDOM_PED(spawnPos.x + X, spawnPos.y + y, -0.5);

 

Share this post


Link to post
Share on other sites
motorsport71

Thanks LeeC2202 for catching that. Much appreciated!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

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

×

Important Information

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