Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Is there any possibility for spawning custom peds?#1515

AnsweredbyJohnFromGWN
patryksuu asked this question inQ&A
Discussion options

can I spawn addon ped in v2? source/scripting_v2/GTA.Native/PedHash.cs

is there option to spawn by model name?

You must be logged in to vote

i think by "custom ped"@patryksuu is not referring to peds like player_zero which is as vanilla as it gets. He means mods. So, while this is a late answer, there are dozens of different ways to indeed spawn custom peds (replace or addons) and an infinite number of combinations. However v2 is no longer supported so v3 should be the way to go. Here is an example for any noob coming across this discussion.

// Create the PedPedped;// Determine if the identifier is a string (name) or an enumeration value (PedHash)if(identifierisstringpedName){ped=World.CreatePed(pedName,spawnPosition);}elseif(identifierisPedHashpedHash){ped=World.CreatePed(pedHash,spawnPos…

Replies: 1 comment 4 replies

Comment options

well, you can spawn a ped with anyModel, likeWorld.CreatePed("player_zero", Game.Player.Character.Position) andWorld.CreatePed((Model)unchecked((int)0x9b22dbaf), Game.Player.Character.Position).Model defines implicit operators that convert anint and astring into aModel.

You must be logged in to vote
4 replies
@JohnFromGWN
Comment options

i think by "custom ped"@patryksuu is not referring to peds like player_zero which is as vanilla as it gets. He means mods. So, while this is a late answer, there are dozens of different ways to indeed spawn custom peds (replace or addons) and an infinite number of combinations. However v2 is no longer supported so v3 should be the way to go. Here is an example for any noob coming across this discussion.

// Create the PedPedped;// Determine if the identifier is a string (name) or an enumeration value (PedHash)if(identifierisstringpedName){ped=World.CreatePed(pedName,spawnPosition);}elseif(identifierisPedHashpedHash){ped=World.CreatePed(pedHash,spawnPosition);}else{thrownewArgumentException("Identifier must be a string (name) or PedHash.");}
Answer selected bypatryksuu
@kagikn
Comment options

i thought my examples explained how to spawn peds with any models good enough, but it appears that@patryksuu thought the snippet provided by@JohnFromGWN explained better.

i admit i explained worse this time, i could've explained with non-vanilla model hashes, though it would've been a lot better if@patryksuu told me my snippets hadn't made enough sense to them 🥲

@JohnFromGWN
Comment options

I don't think there was anything wrong with your answer, I think it was just the question from the OP was more about addon peds. I know you're a much more skilled programmer than I am, or anyone else in the GTA V community, but I'm not sure about your second example. I tried it for fun and it did not work. From my experience, these are the ways to spawn peds, but i'm sure there are more.

//Example of addon mod Kira
MyPed = World.CreatePed("Kira", PP.Position + PP.ForwardVector * 3f, PP.Heading + 90);

// 4 equivalent examples of vanilla mod Vagos female
MyPed = World.CreatePed(new Model(1520708641),PP.Position + PP.ForwardVector * 3f, PP.Heading + 90);
MyPed = World.CreatePed("g_f_y_vagos_01", PP.Position + PP.ForwardVector * 3f, PP.Heading + 90);
MyPed = World.CreatePed(PedHash.Vagos01GFY,PP.Position + PP.ForwardVector * 3f, PP.Heading + 90);
MyPed = World.CreatePed(new Model(0x5AA42C21), PP.Position + PP.ForwardVector * 3f, PP.Heading + 90);

// Examples of Franklin vanilla player
MyPed = World.CreatePed("player_one", PP.Position + PP.ForwardVector * 3f, PP.Heading + 90);
MyPed = World.CreatePed(PedHash.Franklin, PP.Position + PP.ForwardVector * 3f, PP.Heading + 90);

@kagikn
Comment options

Oops, my second example was wrong about how to cast literal integers to another integer type that can't exactly represent the target values, where anunchecked expression was required. Yes, you could just directly usenew Model(int), though you would have to use anunchecked expression when you cast a literalint that can't exactly represent the value asuint touint.

Also, thank you for cheering me up.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@patryksuu@kagikn@JohnFromGWN

[8]ページ先頭

©2009-2025 Movatter.jp