FPedBuilder
Builder class for creating FPed instances with configurable properties.
Methods
WithWarrantsOptions
Options for the
Parameters
| Name | Type | Description |
|---|---|---|
| Warrants | List<string> | The warrants to use. |
| IncludeAll | bool | Specifies whether to include all warrants. It should be true only when ped history is loaded. Does not respect |
| ChanceForAnyWarrant | int | The chance for any warrant to be included. |
| MaxWarrants | int | The maximum number of warrants to include. |
WithPedData
Sets the PedData for this ped.
Parameters
| Name | Type | Description |
|---|---|---|
| pedData | PedData | The PedData to associate with this ped. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithOwningVehicleNetworkId
Sets the id of the vehicle the ped is owning.
Parameters
| Name | Type | Description |
|---|---|---|
| vehicleNetworkId | int | The network ID of the vehicle to assign. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithFirstname
Sets the firstname of the ped.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The first name to set. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithFirstname
Sets a random firstname for the ped from a provided list.
Parameters
| Name | Type | Description |
|---|---|---|
| names | List<string> | The list of possible first names to choose from. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithLastname
Sets the lastname of the ped.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The last name to set. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithLastname
Sets a random lastname for the ped from a provided list.
Parameters
| Name | Type | Description |
|---|---|---|
| names | List<string> | The list of possible last names to choose from. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithBirthdate
Sets a random birthdate for the ped between 1960 and 2004.
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithBirthdate
Sets the birthdate of the ped.
Parameters
| Name | Type | Description |
|---|---|---|
| birthdate | DateTime | The birthdate to set. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithItems
Selects and sets a random set of items for the ped.
Parameters
| Name | Type | Description |
|---|---|---|
| items | IEnumerable<Item> | The collection of possible items to choose from. |
| includeAll | bool | When true, includes all items. When false, selects a random subset. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithWarrants
Sets the warrants for the ped according to the specified options.
Parameters
| Name | Type | Description |
|---|---|---|
| options | WithWarrantsOptions | Configuration options for warrant assignment. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithLicense
Adds a single license to the ped if they don't already have one of the same type.
Parameters
| Name | Type | Description |
|---|---|---|
| pedLicense | PedLicense | The license to add. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithLicenses
Adds multiple licenses to the ped, skipping any license types the ped already has.
Parameters
| Name | Type | Description |
|---|---|---|
| licenses | IEnumerable<PedLicense> | The collection of licenses to add. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithAlcoholLevel
Sets a specific alcohol level for the ped.
Parameters
| Name | Type | Description |
|---|---|---|
| alcoholLevel | double | The alcohol level to set. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithAlcoholLevel
Sets a random alcohol level for the ped based on the provided configuration.
Parameters
| Name | Type | Description |
|---|---|---|
| alcoholConfig | AlcoholConfig | The configuration defining alcohol level probabilities and limits. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithDrugs
Adds a collection of drugs to the ped's inventory.
Parameters
| Name | Type | Description |
|---|---|---|
| drugs | IEnumerable<Drug> | The drugs to add. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithDrugs
Randomly adds drugs to the ped based on the provided configurations.
Parameters
| Name | Type | Description |
|---|---|---|
| drugsConfig | List<DrugConfig> | The configuration defining drug probabilities. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
WithRandomLicenses
Randomly assigns licenses to the ped based on the provided configuration.
Parameters
| Name | Type | Description |
|---|---|---|
| pedLicensesConfig | PedLicensesConfig | The configuration defining license types and probabilities. |
Returns
| Name | Type |
|---|---|
| FPedBuilder | The current builder instance. |
Build
Creates a new FPed instance using the configured properties.
Returns
| Name | Type |
|---|---|
| FPed | A new FPed instance. |
Properties
PedDataId
Gets the PedHistory id.
Type: int
Licenses
Gets the licenses of the ped.
Type: List<PedLicense>
Drugs
Gets the drugs of the ped.
Type: List<Drug>