Gangs as Followers
-
I'm working on some scripting where I make my player a gang member, add a few NPC peds in the same gang (which all work), then get into a vehicle for a driveby but the gangs get out, get back in and get out all pissed off but never fire on me just call me a fucking leva and never get in haha. I think I have all the relationships set correctly using the following c#:
Character[index].Body is the targeted ped at the time or my own player. its looped private int intGangVagos = Function.Call<int>(Hash.GET_HASH_KEY, "AMBIENT_GANG_MEXICAN"); private int intGangPlayer = Function.Call<int>(Hash.GET_PED_GROUP_INDEX, Game.Player.Character); Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Character[index].Body, intGangPlayer); // Makes them follow me Function.Call(Hash.SET_PED_RELATIONSHIP_GROUP_HASH, Character[index].Body, intGangVagos); Function.Call(Hash.SET_PED_RELATIONSHIP_GROUP_HASH, Character[index].Body, intGangPlayer); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 0, intGangPlayer, intGangVagos); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 0, intGangVagos, intGangPlayer);
I think I'm missing something obviously but not sure what.
Thanks in advanceWell I "was" in the mod section when I posted this... If someone could move it there for me, I tried... Thanks
-
I was able to figure out how by throwing in a bunch of code that got them to behave, except they refuse to fight attacking peds while in a vehicle. Not sure on that one. I thought of supplying a task to fight during driveby but no task exists that i am aware of...
This is my class function that sets up followers
public void Assign(int index, RPGState state) { if(index == RPGPlayerIndex) { RPGPlayer = Game.Player.Character; Character[index].Body = Game.Player.Character; } if(index < RPGPlayerCount) { if(state < RPGState.NONE) Function.Call(Hash.CLEAR_PED_TASKS_IMMEDIATELY, Character[index].Body); if(index != RPGPlayerIndex && state == RPGState.FOLLOW && Character[index].Type == RPGType.AMBIENT) { Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, Character[index].Body, true); Function.Call(Hash.TASK_COMBAT_HATED_TARGETS_AROUND_PED, Character[index].Body, 150.0f, 0); } else if(index != RPGPlayerIndex && state == RPGState.NOFOLLOW && Character[index].Type == RPGType.AMBIENT) { Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, Character[index].Body, false); } if(state == RPGState.FOLLOW) { Function.Call(Hash.REMOVE_PED_FROM_GROUP, Character[index].Body); Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Character[index].Body, intGangPlayer); } else if(state == RPGState.NOFOLLOW) { Function.Call(Hash.REMOVE_PED_FROM_GROUP, Character[index].Body); Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, Character[index].Body, intGangVagos); } Function.Call(Hash.SET_PED_RELATIONSHIP_GROUP_HASH, Character[index].Body, intGangVagos); Function.Call(Hash.SET_PED_RELATIONSHIP_GROUP_HASH, Character[index].Body, intGangPlayer); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 0, intGangPlayer, intGangVagos); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, 0, intGangVagos, intGangPlayer); Function.Call(Hash.SET_PED_FLEE_ATTRIBUTES, Character[index].Body, 0, 0); // NEVER FLEE Function.Call(Hash.SET_PED_COMBAT_ABILITY, Character[index].Body, 100); Function.Call(Hash.SET_PED_COMBAT_RANGE, Character[index].Body, 2); Function.Call(Hash.SET_PED_COMBAT_MOVEMENT, Character[index].Body, 2); Function.Call(Hash.SET_PED_COMBAT_ATTRIBUTES, Character[index].Body, 46, true); Function.Call(Hash.SET_PED_CAN_SWITCH_WEAPON, Character[index].Body, true); Function.Call(Hash.SET_ENTITY_INVINCIBLE, Character[index].Body, true); Character[index].Companion = state; Character[index].Map.Position = Character[index].Body.Position; Function.Call(Hash.SET_BLIP_ALPHA, Character[index].Map, 255); } }
I think peds are just too stupid to fight while in a vehicle haha. I spawn freemode type peds and they blast anything that moves with this code regardless where they are. I thought of maybe just deleting all the dumb peds in the world and make them all freemode for gangs. Probably too much work though & might crash the game with too many spawned peds.