HorseCreateHorse
Contents |
[edit] HorseCreateHorse(string, location, object, string, int, int, int, string)
Create a horse.
[edit] Parameters
sResRef
The template resref of the horse to be created.
lLoc
The location at which the horse will be created.
oOwner
If specified, the creature who will own the horse.
sTag
If specified, the horse will have this tag instead of the resref default.
nAppearance
If specified, the horse will have this appearance type when dismounted.
nTail
If specified, this tail type determines what the horse looks like when mounted.
nFootstep
If specified, the horse will have this footstep type sound when moving.
sScript
If specified, this script will execute on the horse after spawning.
[edit] Description
This function will create a horse using the resref at the specified location.
It returns the object id of the horse that was spawned.
The remaining parameters can be set to non-default values to customize the horse.
This function is set up the way it is so that you could potentially use a single blueprint to store multiple appearance horses.
[edit] Remarks
It's safer to use this function for horses, rather than HorseSetOwner after this function has created the horse.
The option to specify appearance, tail and footsteps will normally only be required for custom models.
Using the pre-defined appearance and tail constants for creatures that are not horses may have bizarre results.
For example, you can create a horse with a dragon appearance using a horse resref, but when mounted it will still look like a horse, unless a custom tail model is provided.
Similarly, if you use a dragon resref without a custom tail model, the creature will be invisible when mounted.
[edit] Known Bugs
The tail parameter doesn't work as specified. Instead, you can set the local integer X3_HORSE_TAIL on the horse after using the function.
[edit] Requirements
#include " x3_inc_horse "
[edit] Version
1.69
[edit] Example
// An existing horse with a tag of "HorseTemplate" is used to create a new horse // with a tag of "NewHorse" near the PC, who becomes the owner of the new horse. #include "x3_inc_horse" void main() { object oPC = GetPCSpeaker(); object oHorse = HorseCreateHorse(GetResRef(GetObjectByTag("HorseTemplate")), GetLocation(oPC), oPC, "NewHorse"); }
[edit] See Also
functions: | |
constants: |
author: Proleric, editor: Mistress