motorsport71 Posted December 14, 2018 Share Posted December 14, 2018 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 Link to comment Share on other sites More sharing options...
Guest Posted December 14, 2018 Share Posted December 14, 2018 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); Link to comment Share on other sites More sharing options...
motorsport71 Posted December 15, 2018 Author Share Posted December 15, 2018 Thanks LeeC2202 for catching that. Much appreciated! Link to comment Share on other sites More sharing options...