03B6

From GTAMods Wiki
Jump to navigation Jump to search
03B6 before.jpg
03B6 after.jpg
A notable example of the usage of this opcode in the original script of Vice City.

GTA III Vice City San Andreas SWAP_NEAREST_BUILDING_MODEL


Description
Swaps a map model with another map model
Syntax
03B6: replace_model_at [flt1] [flt2] [flt3] radius [flt4] from [int1] to [int2]
Parameter
[flt1]
X-coordinate
[flt2]
Y-coordinate
[flt3]
Z-coordinate (or ≤-100.0 for ground z)
[flt4]
Radius
[int1]
Model index number to swap from as defined in the IDE file; also acceptable is model's DFF name with a hash character
[int2]
Model index number to swap to as defined in the IDE file; also acceptable is model's DFF name with a hash character

This opcode swaps a map model with another map model nearest to the center of the search area. The collision model and time property (TOBJ) of the model to swap to are also swapped with the model to swap from. The position and rotation of the model to swap from are preserved. Attempting to swap from a breakable object yields no effect and swapping to a breaking object does not preserve its ability to break. Objects placed onto the world through the script, like through opcode 0107, cannot be swapped.

Data of the swapped model is saved in block 0 of the save file in GTA III, block 0 in Vice City, and block 1 in San Andreas, as long as the model is swapped; if the model is swapped back to the original model, the game no longer save that information. The game can swap and save a maximum of 25 map models.


Note: It is important that the object to be replaced is defined in a normal IPL and not in a binary IPL, otherwise, moving away from the new object and coming back will reload the old object. Also keep in mind that the opcode does not usually work on all TOBJ objects, nor with LODs (at least in SA).


Keywords

replace, model, swap, building, map, nearest, closest