Editing Custom Maps (VC)

Techy

Jack of all Trades
SA:MP Moderator
SA:MP Mapper
SA:MP Tester
Joined
Apr 22, 2020
Messages
189
Likes
678
Points
93
Editing Vice City/Any Custom Map with Texture Studio
Texture Studio makes it easier to map by moving everything in-game and you can edit your favorite map's base objects if you have all of them in a SavedMap database. When you create a new map/objects, TS stores the info in a database and I've scripted a generator to take all the CreateDynamicObject's of VC and add them straight to a database that you could load in-game.
At least on my PC, loading VC is usually laggy and this makes it way smoother since all the object's draw distances are set to '300' by default.

Vice City
If you have the vice_city files set up*, add THIS to SERVER/scriptfiles/tstudio/SavedMaps - to /loadmap in-game.
Before you run, open the Vice City filterscript's pwn you're using (my .pwn & .amx)** and comment (//) the function/callback that houses 'CreateDynamicObject' (to stop overlapping objects)
When you load in along with the map (/loadmap), you should see the IDs for all the objects and can edit (/sel /editobject /dobject, even /undo) as normal.
*NB: If you're adding VC for the first time, add the vice_city.pwn and .amx to your filterscripts folder, to the server.cfg (pic) as well as downloading the models. (vice_city.rar - VC files || My Server)*

Custom Map

Add THIS to SERVER/scriptfiles/tstudio/SavedMaps
You'll have to create a database for the map by going into the filterscript's pwn and:
  • Define the DB near the top
  • Open it as the filterscript starts [Change the name of the .db to suit]
  • Close when it exits
  • Add the red code to the filterscript's AddObject function
    new id;
    CreateVCObject(MODEL_TYPES:model_type, modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, world = -1, interior = -1)
    {
    static Query[1000];

    //Create object lines:
    new objectid = CreateDynamicObject(modelid, x, y, z, rx, ry, rz, world, interior, .streamdistance = Vice_Stream_Info[_:model_type][vc_Object_StreamDistance] + 50.0, .drawdistance = Vice_Stream_Info[_:model_type][vc_Object_StreamDistance], .priority = Vice_Stream_Info[_:model_type][vc_Object_Priority]);
    if(Vice_Stream_Info[_:model_type][vc_Object_Static]) Streamer_ToggleItemStatic(STREAMER_TYPE_OBJECT, objectid, true);

    //Query
    format(Query, sizeof(Query), "INSERT INTO 'Objects' ('IndexID', 'ModelID', 'xPos', 'yPos', 'zPos', 'rxRot', 'ryRot', 'rzRot', 'TextureIndex', 'ColorIndex', 'usetext', 'FontFace', 'FontSize', 'FontBold', 'FontColor', 'BackColor', 'Alignment', 'TextFontSize', 'ObjectText', 'GroupID', 'Note', 'DrawDistance') VALUES ('%i','%i', '%f', '%f', '%f','%f','%f','%f', '', '', 0, 0, 0, 0, 0, 0, 0, 20, 'None', 1, '', 300.0)", id, modelid, x, y, z, rx, ry, rz); //edit variables based on what's used in CreateDynamicObject

    new DBResult:res = db_query(VCBuild, Query);
    if (res)
    {
    printf("[Object #%i] Added Object ID: %i - Model ID: %i", id, objectid, modelid);
    id++;
    }
    else
    {
    printf("[Object #%i] Error: Object ID = %i ", id, objectid);
    id++;
    }
    db_free_result(res);


    return objectid;
    }
  • Compile, run the server, and don't forget to remove/comment all the DB lines (as shown in green) before restarting the server to load the mapd
** In the .pwn from the 'My Server' link, most of the comments can be found with 'Tech' or 'notgen' **
Bugs:
  • You may get an error if a) streamer is not up-to-date or b) the models folder is missing; when compiling and/or running the server (like VC not showing) - keep texture studio's plugin files, compile VC with them
  • Seems to be a /editobject bug in the latest version of TS/new TS compiles - try THIS as a base folder (be careful with your GM and serverconfig)
  • If you're creating your own DB, download the completed VC one to copy the binary values of columns 'TextureIndex' & 'ColorIndex'' into yours, as it may produce errors in the console without them
  • E: Thanks to some discussions and testing with Interstellar, fixed the bugs when updating to streamer 2.9.4. (new tstudio.amx)
  • E: If you're using a GM other than base.pwn, you'll need to set all OnPlayerEditDynamicObject's in your GM files to return with 0 as well as add 'hook OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) return 0;' and 'hook OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ) return 0;' [Streamer Fixes]
**
CrashDetect 4.18.1, Streamer 2.9.4, Sscanf 2.8.1, FileManager 1.5, YSI version 3.09.0684 [Texture Studio 734b1aa]
Feel free to PM any suggestions/feedback x
 
Last edited:

HarryB

SA:MP Admin
SA:MP Admin
SA:MP Tester
Joined
Apr 28, 2020
Messages
83
Likes
1,424
Points
83
Hello Techy my nearest and dearest

I have used your map and done /gotomap and ended up with no floor/roads but just water.
Just wondering if you know where I'm going wrong? :eek:

safe

Hazza Brown
 

Techy

Jack of all Trades
SA:MP Moderator
SA:MP Mapper
SA:MP Tester
Joined
Apr 22, 2020
Messages
189
Likes
678
Points
93
Hello Techy my nearest and dearest

I have used your map and done /gotomap and ended up with no floor/roads but just water.
Just wondering if you know where I'm going wrong? :eek:

safe
Missing the VC filterscript, but I'll add the vice_city I use for this DB.
 

HarryB

SA:MP Admin
SA:MP Admin
SA:MP Tester
Joined
Apr 28, 2020
Messages
83
Likes
1,424
Points
83

I have just got off a discord chat with Techy Tech Support and I have to say 5 star services with helping me get to the bottom of my problems!

Thanks a lot Techy top service you provided (y)
 
Last edited:
Top