Everything posted by crossed99
-
[SOLVED] How to make a ped flee or cower properly?
TASK::TASK_GO_TO_COORD_ANY_MEANS(ped, coords.x, coord.y, coord.z, 1.0f, 0, 0, 786603, 0xbf800000); TASK::TASK_FOLLOW_NAV_MESH_TO_COORD(ped, coords.x, coord.y, coord.z, 1.0f, -1, 0.5f, 1048580, 40000.0f); These are the ones I'm using. The params are: ped, coordinates, speed, timeout I think but not use, don't know the rest... 1.0 is walk speed, 2.0 should be jog and 3.0 is sprint. edit: oh the parameter after the timeout I think is how close they're supposed to stop to the given coords. 0 is exactly the coords.
-
Aggro and relationships
You don't have to dehash them, the code I posted makes most peds attack on sight in towns. You can get all their rel groups with the getAllPeds function.
-
Ped Damage Overhaul
The revive mechanic in AMJM is incompatible with this mod unfortunately, because it needs to change the NPC's max health, but this mod also changes it and "overwrites" it. You can disable the revive mechanic in AMJMTransport.ini by setting ALLOW_REVIVE to 0, after that they should work. I'm not sure if it's possible to solve it on PDO's end.
- 1,267 comments
- 5 reviews
-
-
- 1
-
-
AM&JM Transport
It does have a distance check + it's supposed to go away when you're not targeting the wagon. But yeah, I've been having trouble uploading here lately, the latest version have targeting the wagon temporarily disabled, so you can't access that prompt.
- 110 comments
- 3 reviews
-
Aggro and relationships
You have to make civilian relationship groups hate your group with the same method. PED::SET_RELATIONSHIP_BETWEEN_GROUPS(6, 2318650831, myRelGroup); // townfolk male ? PED::SET_RELATIONSHIP_BETWEEN_GROUPS(6, 841021282, myRelGroup); // townfolk female ? I don't really know relationship groups, but you can target any ped and check their rel group with the native I posted in the other post. Some peds might set to always avoid combat though, you might have to look into config flags or combat attributes if you want everybody to fight. SET_PED_COMBAT_ATTRIBUTES https://alloc8or.re/rdr3/doc/enums/eCombatAttribute.txt SET_PED_CONFIG_FLAG https://alloc8or.re/rdr3/doc/enums/ePedScriptConfigFlags.txt
-
Aggro and relationships
You can create your own relationship group: Hash myRelGroup; PED::ADD_RELATIONSHIP_GROUP("MyRelGroup", &myRelGroup); PED::SET_RELATIONSHIP_BETWEEN_GROUPS(6, 707888648/*LAW*/, myRelGroup); // 6 means the first group will attack the second on sight Pretty sure lawmen would attack whoever you add to this group with PED::SET_PED_RELATIONSHIP_GROUP_HASH(aimed_target_ped, myRelGroup); unless I got the hash for lawmen wrong, not 100% sure, but you can check with GET_PED_RELATIONSHIP_GROUP_HASH(Ped ped).
-
(disable) "out of the way" screaming
You could try putting EVENT::IS_SHOCKING_EVENT_IN_SPHERE(Hash eventType, float x, float y, float z, float radius) with all the shocking events in a loop and see if you get something. Just an idea, I don't know if almost running into a ped is a shocking event or if this would detect it.
-
How to script a controller with a prompt
void registerPrompt(int& prompt, const char* input, const char* name, bool toggle, bool addToGroup, Entity entity) { prompt = HUD::_UIPROMPT_REGISTER_BEGIN(); HUD::_UIPROMPT_SET_CONTROL_ACTION(prompt, MISC::GET_HASH_KEY(input)); HUD::_UIPROMPT_SET_TEXT(prompt, MISC::VAR_STRING(10, "LITERAL_STRING", name)); HUD::_UIPROMPT_SET_HOLD_MODE(prompt, 1); if (addToGroup) { int group = HUD::_UIPROMPT_GET_GROUP_ID_FOR_TARGET_ENTITY(entity); HUD::_UIPROMPT_SET_GROUP(prompt, group, 0); } HUD::_UIPROMPT_REGISTER_END(prompt); togglePrompt(prompt, toggle); } void togglePrompt(int prompt, bool enable) { HUD::_UIPROMPT_SET_VISIBLE(prompt, enable); HUD::_UIPROMPT_SET_ENABLED(prompt, enable); } I do it like this, you can use it like: static int myPrompt{}; registerPrompt(myPrompt, "INPUT_SPRINT", "My Prompts Name", false, true, *example ped*); Ped target; PLAYER::GET_PLAYER_INTERACTION_TARGET_ENTITY(PLAYER::PLAYER_ID(), &target, 1, 1); if (target == *example ped*) // if you're targeting your example ped you reistered the prompt on togglePromt(myPrompt, true); else togglePromt(myPrompt, false); Adding it to a ped or other entity is optional. Depending on what you do there are better ways to do the toggling.. Btw I have a few of my mods source code shared on their pages, you can find stuff like this in them. edit: I edited the input, it was supposed to be "INPUT_SPRINT"
-
How to script a controller with a prompt
Maybe it's me, but I don't really understand. What are you trying to do?
-
Changing the font when drawing text
Tbh I didn't bother to update my natives in a while, I use somewhat outdated ones. Using the above method works for me using these, so unless someone can help, you can try adding these your natives: static void _DISPLAY_TEXT(const char* text, float xPos, float yPos) { invoke<Void>(0xD79334A4BB99BAD1, text, xPos, yPos); } template<typename... Args> static const char* VAR_STRING(int flags, Args... args) { return invoke<const char*>(0xFA925AC00EB830B9, flags, args...); }
-
Best way of sandboxing spawned NPCs
ENTITY::GET_ENTITY_COORDS(&(Local_130[2 /*2*/]) just get's the center coordinates of the area they wanted the ped to wander in. So they're ped, coodrdinates, then 4 unknown: TASK::TASK_WANDER_IN_AREA(ped, area.x, area.y, area.z, 2f, 2f, 4f, 0); TASK::TASK_WANDER_IN_AREA(ped, area.x, area.y, area.z, 10f, 1f, 3f, 0);
-
Changing the font when drawing text
Those natives are outdated, but as long as you have them in your natives.h the solution you linked should work. But you could try using the up to date natives VAR_STRING and BG_DISPLAY_TEXT I think, and see if that works.
-
Best way of sandboxing spawned NPCs
No idea, it was in decomplied scripts. It's either those exact values or something like these: TASK::TASK_WANDER_IN_AREA(0, ENTITY::GET_ENTITY_COORDS(&(Local_130[2 /*2*/]), true, false), 2f, 2f, 4f, 0); TASK::TASK_WANDER_IN_AREA(&(Local_130[iVar0 /*2*/]), func_178(3, 12), 10f, 1f, 3f, 0);
-
Best way of sandboxing spawned NPCs
I've only done a little testing trying to make peds hang around my camp so I don't know if this helps. TASK::TASK_WANDER_IN_AREA(ped, coord.x, coord.y, coord.z, 30.0f, 1077936128, 1086324736, 1); This made them walk away during the day, but if I called it at around 8-9 pm they started using scenarios around the campfire (warming hands and stuff), then later they laid down to sleep or sat in the tent for the night. Don't know what the parameters are, I assumed the 30.0f is the radius but not use. I haven't tested this in towns at all..
-
How to clean up scenario props
You can use this to make whatever is in the ped's hand disappear before they drop it, I don't know if there's a better way, let me know if you find one :) WEAPON::_HIDE_PED_WEAPONS(myPed, 0, true);
-
[Solved!] How to spawn ped from C++ Script Hook?
Modifying X and Y moves the spawn point east / west and north / south from you, regardless of your facing. You can get the coordinates in front of a ped with this: Vector3 front = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0f, 2.0f, 0.0f); I can't test it right now, but your native to turn them should work, pretty sure I used that before. Make sure "player" is PLAYER::PLAYER_PED_ID() and not PLAYER::PLAYER_ID() or something, other than that not sure...
-
[Solved!] How to spawn ped from C++ Script Hook?
Without the _SET_RANDOM_OUTFIT_VARIATION line they're invisible when they spawn in, so it might be working you just can't see them. You can also try instead: ENTITY::SET_ENTITY_VISIBLE(pedSpawn, true); Or maybe they fall under the ground without the PLACE_ENTITY_ON_GROUND line. But they shouldn't give you compiler errors. What errors are you getting?
-
AM&JM Transport
- 110 comments
- 3 reviews
-
AM&JM Transport
- 110 comments
- 3 reviews
-
[SOLVED] Check if player is eating/drinking.
Maybe you could use GET_CLOSEST_OBJECT_OF_TYPE(float x, float y, float z, float radius, Hash modelHash, BOOL isMission, BOOL p6, BOOL p7) or one of script hook's 'get all' functions. worldGetAllPickups(pickups, pickupsArraySize); worldGetAllObjects(objects, objectsArraySize); Something like: const int arrSize{ 512 }; Object objects[arrSize]; int objCount = worldGetAllObjects(objects, arrSize); for (int i = 0; i < objCount; ++i) if (ENTITY::GET_ENTITY_MODEL(pickups[i]) == MISC::GET_HASH_KEY("s_brandy01x")) { // if bottle found // check distance to player ?? } I mean it's pretty convoluted, but if it finds the object while it's in the players hand then it could be used reliably.
-
[SOLVED] Check if player is eating/drinking.
I don't think there's a native for that. There's a scenario for pouring coffee at camp, probably one for taking stew, too, or you can check if you have a coffee mug or plate in your hand, but I doubt you can detect just normally eating something from your inventory that way. Checking your core values might be another way, when they're being refilled and the player is not sleeping then probably eating or drinking... I don't know if it's possible to do it reliably. Let me know if you find a way, I'd be interested, too 😄
-
SIMULATE_PLAYER_INPUT_GAIT
p1: speed p2: time in millisecons p3: direction p4: set if direction is relative to player's heading or world coords p5: ??
-
BodyguardSpawner
-
AM&JM Transport
- 110 comments
- 3 reviews
-
Ped task ids
I'm getting these tasks as active when they're idle compared to when I make them do the hand up task with TASK_HANDS_UP: 2021-11-27 15:48:42.==== player idle ===== 2021-11-27 15:48:42. - 18 2021-11-27 15:48:42. - 21 2021-11-27 15:48:42. - 25 2021-11-27 15:48:42. - 48 2021-11-27 15:48:42. - 53 2021-11-27 15:48:42. - 320 2021-11-27 15:48:42. - 332 2021-11-27 15:48:42. - 335 2021-11-27 15:48:44.==== npc idle ===== 2021-11-27 15:48:44. - 48 2021-11-27 15:48:44. - 53 2021-11-27 15:48:44. - 244 2021-11-27 15:48:44. - 266 2021-11-27 15:48:44. - 270 2021-11-27 15:48:44. - 291 2021-11-27 15:48:44. - 320 2021-11-27 15:48:44. - 335 2021-11-27 15:48:46.==== pl hands up ===== 2021-11-27 15:48:46. - 0 2021-11-27 15:48:46. - 47 2021-11-27 15:48:46. - 320 2021-11-27 15:48:46. - 335 2021-11-27 15:48:47.==== npc hands up ===== 2021-11-27 15:48:47. - 0 2021-11-27 15:48:47. - 47 2021-11-27 15:48:47. - 320 2021-11-27 15:48:47. - 335 So 0 or 47 maybe? Or maybe it's a different task when they do it "naturally" and not with TASK_HANDS_UP...