Aller au contenu

Créateur de YTYP

Crée des entrées CBaseArchetypeDef pour tes props custom : nom, texture dictionary, distance de LOD, flags, physics dictionary et asset type. Dépose des fichiers XML .ydr de CodeWalker et la bounding box, le centre et le rayon de la sphère sont mesurés à partir du mesh. Importe n'importe quel ytyp du jeu comme point de départ.

Cet outil et ses notes sont en anglais pour l'instant.

Config & codeMaps, Props, TéléchargementLire la doc

Ytyp

1 archetype

Add archetypes

Bounds are taken in model space with GTA axes (Z up), exactly as the game archetype stores them: the model's own bounding box when it matches the high LOD mesh, otherwise the mesh itself. The sphere is the box centre and half its diagonal, like every game prop. Open each archetype for the notes.

Archetypes (1)

  • 1

Export

my_props.ytyp.xml
<?xml version="1.0" encoding="UTF-8"?>
<CMapTypes>
 <extensions />
 <archetypes>
  <Item type="CBaseArchetypeDef">
   <lodDist value="60" />
   <flags value="32" />
   <specialAttribute value="0" />
   <bbMin x="-1.5877" y="-0.4547" z="0.0047" />
   <bbMax x="1.5877" y="0.4468" z="0.4543" />
   <bsCentre x="0" y="-0.00395" z="0.2295" />
   <bsRadius value="1.6656836" />
   <hdTextureDist value="5" />
   <name>my_bench</name>
   <textureDictionary>my_bench</textureDictionary>
   <clipDictionary />
   <drawableDictionary />
   <physicsDictionary>my_bench</physicsDictionary>
   <assetType>ASSET_TYPE_DRAWABLE</assetType>
   <assetName>my_bench</assetName>
   <extensions />
  </Item>
 </archetypes>
 <name>my_props</name>
 <dependencies />
 <compositeEntityTypes itemType="CCompositeEntityType" />
</CMapTypes>

CodeWalker XML, same layout as the game's own ytyps. The game needs the binary .ytyp: see Convert.

From a model to a spawnable prop

  1. In CodeWalker's RPF Explorer, right click your .ydr (or .yft, .ydd) and its .ytd, Export XML.
  2. Drop the XML files here. Each model becomes an archetype named after the file, with bounds measured and textureDictionary set to the matching .ytd.
  3. Pick flags and lodDist, fix anything the checks point out, then download <name>.ytyp.xml.
  4. Convert it in CodeWalker (RPF Explorer, File, Open Folder, Edit mode, Edit, Import XML) and put the .ytyp in stream/ with your models.
  5. Add data_file 'DLC_ITYP_REQUEST' 'stream/<name>.ytyp' to fxmanifest.lua, ensure the resource and reconnect.

The model file, the archetype name and the name you spawn must all be the same. For a .ydr the game finds the model by the archetype name, not by assetName.

What each field does

FieldMeaning
nameThe model name you spawn and place in ymaps. Same as the model file without extension.
lodDistDraw distance in metres. 100 is by far the most common game value (13,968 props), small clutter uses 20 to 40, landmarks 300 and up.
hdTextureDistDistance where +hi.ytd / +hidr.ytd HD textures stream in. 5 on 68% of game props. Keep it at or below lodDist.
flagsBit field of archetype behaviour (static, dynamic, shadows, cover, animation, doors). See the table below.
specialAttributeMarks special objects: 7 normal door, 5 garage door, 8 sliding door, 3 traffic light, 11/13 bushes, 30 clock, 32 street light. 0 for everything else.
bbMin, bbMaxAxis aligned box in model space, Z up. Used for culling and returned by GetModelDimensions.
bsCentre, bsRadiusBounding sphere. In every one of the 33,071 game prop archetypes it is the box centre and half the box diagonal, so the tool calculates it the same way.
textureDictionaryThe .ytd with the textures, without extension. Embedded textures do not need it.
physicsDictionaryGame props point at a shared physics dictionary. For a custom model with embedded collision use its own name (what Sollumz writes) or leave it empty.
clipDictionaryThe .ycd for animated props, together with flag 512 (anim) or 1024 (UV anim).
drawableDictionaryOnly for models inside a .ydd, with assetType ASSET_TYPE_DRAWABLEDICTIONARY.
assetTypeASSET_TYPE_DRAWABLE for .ydr, ASSET_TYPE_FRAGMENT for .yft, ASSET_TYPE_DRAWABLEDICTIONARY for .ydd.
assetNameWritten as the name again, like every drawable and fragment prop in the game.
timeFlagsOnly on CTimeArchetypeDef: bit 0 to 23 are the hours the model is visible, bit 24 lets it switch while on screen. 32505919 is 20:00 to 06:00.

Flag values you will see

ValueBitsUsed by
0none11,889 game props, mostly map furniture
32staticSimple fixed custom props
8192don't cast shadowsLOD models, emissive and light props (1,815)
536870912use ambient scaleInterior decoration (2,685)
537001984ambient scale + dynamicThe most common non-zero value (4,690)
549584896ambient scale + dynamic + no AI cover + no player coverBins, cones, crates (1,665)
549584928the same + staticprop_wait_bench_01
604110848ambient scale + door physics + dynamic419 doors, with specialAttribute 7
1024UV animationScreens, water, scrolling signs

Common pitfalls

  • Prop is invisible. The ytyp is still XML, the data_file line is missing, or the archetype name does not match the model file name.
  • White or purple textures. textureDictionary does not match the .ytd name, or the .ytd is not streamed.
  • Prop disappears at screen edges. Bounds too small. Drop the model XML again to measure them.
  • Same name as a game prop. Your archetype replaces or duplicates the game one. Give custom props their own prefix.
  • Changes do not show. Reconnect. Archetypes are registered when the resource starts.

Where the data comes from

  • Default values of the 33,071 game props: the game's own prop ytyps.
  • Flag names: CodeWalker archetype panel and Sollumz (special attribute values too).
  • DLC_ITYP_REQUEST: FiveM data file reference, where it is listed as the equivalent of PERMANENT_ITYP_FILE.