Custom Modshop
#1

Custom Modshop


Description
I've been working on this throughout the week (on and off) from last Tuesday and finally I finished it yesterday. I'd like to think that I took my time to structure it properly from start to the end rather than just throwing myself into it starting to code. Anyhow, the video below showcases the modshop where you can repair, upgrade and customize your vehicle. Most of the code is just different scenarios of what the textdraw's will display (in text) since all vehicle modelids have different vehicle upgrades (especially under the category "Cosmetic Upgrades").


Future Aims
In the future I would like to perhaps even add "purchase"/"preview" and "back" button instead of having to use /confirm or /cancel as it would be more user-friendly that way. Another thing I wanted to add was upgrading vehicle health by some car components under "Functionality Upgrades", however for the time being, as it is meant for a roleplay server, I didn't want to add that. However, if you have any suggestions feel free to pop them and I hope you enjoy the short video.


Video
https://www.youtube.com/watch?v=gIa-YTrGKIs
Reply
#2

So far so good! Looks alright as a base design. I'd recommend something that not a lot of servers do nowadays and that is being able to customize your vehicle in advanced mode (Attached Objects), special text somewhere or vehicle stickers would be interesting to introduce.
Reply
#3

Haven't even thought of that (attaching objects and text) other than neon lights, good suggestion thank you, highly appreciated!
Reply
#4

Considering I'm already registered on the forums for OC-RP and such and we've had a conversation or two.
Great work. Can't wait to see more sneak peaks of the gamemode. And like Reyo said, definitely make it possible to attach certain objects to your car. Or better yet, eventually make it possible to build a car from scratch.

Maybe, go mining and such to get the materials, or goto a hardware store where a miner sold his supplies to. Buy the metal, the blowtorch, the tires, engine, etc. You get it.
Reply
#5

Great stuff, add attached vehicle objects as mentioned by Reyo, It'll be even sicker
Reply
#6

Damn great work!
Reply
#7

Quote:
Originally Posted by Eoussama
View Post
Great stuff, add attached vehicle objects as mentioned by Reyo, It'll be even sicker
That is a lot of work.

- design entire editing platform from scratch (there is no native support for editing attached objects)
- save all this data
- text/textures/colors (this gets complicated to work with)

I am not saying it can't be done by any means just the scope is significantly wider compared to what is already present. But I think it is worth it instead of only attaching some faggy neon lights.

Interesting fact.
https://github.com/Pottus/Texture-St...o/vehicles.pwn

I took this system and hacked and sliced it to work as a feature on DayZ (uncompleted) but the concept completely woks. So I would recommend looking through this at how to deal with editing attached vehicle objects. But here a small gift I didn't use this in Texture Studio I created it after and too bad I did otherwise it probably would have been used.

Creates an edit pivot point that you can use to rotate move anything.

Code:
#include <YSI\y_hooks>

enum EDITPOINTDATA
{
	pEditObject,
	Float:pEditX,
	Float:pEditY,
	Float:pEditZ,
	Float:pEditRX,
	Float:pEditRY,
	Float:pEditRZ,
	
	Float:pSaveX,
	Float:pSaveY,
	Float:pSaveZ,
	Float:pSaveRX,
	Float:pSaveRY,
	Float:pSaveRZ,
	
	pEditObjectSel,
	pEditCallBack[32],
}

static pEditPoint[MAX_PLAYERS][EDITPOINTDATA];

stock PlayerEditPoint(playerid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, callback[], objectid = -1)
{
	if(pEditPoint[playerid][pEditObject] > -1)
		DestroyDynamicObject(pEditPoint[playerid][pEditObject]);

	if(objectid == -1)
	{
		pEditPoint[playerid][pEditObject] = CreateDynamicObject(1974,
					x,
					y,
					z,
					rx,
					ry,
					rz,
					-1, -1, playerid, .priority = 1);
	    SetDynamicObjectMaterial(pEditPoint[playerid][pEditObject], 0, 10765, "airportgnd_sfse", "white", -256);
	    format(pEditPoint[playerid][pEditCallBack], 32, "%s", callback);

	    pEditPoint[playerid][pEditX] = x;
	    pEditPoint[playerid][pEditY] = y;
	    pEditPoint[playerid][pEditZ] = z;
	    pEditPoint[playerid][pEditRX] = rx;
	    pEditPoint[playerid][pEditRY] = ry;
	    pEditPoint[playerid][pEditRZ] = rz;

	    pEditPoint[playerid][pSaveX] = x;
	    pEditPoint[playerid][pSaveY] = y;
	    pEditPoint[playerid][pSaveZ] = z;
	    pEditPoint[playerid][pSaveRX] = rx;
	    pEditPoint[playerid][pSaveRY] = ry;
	    pEditPoint[playerid][pSaveRZ] = rz;

		Streamer_Update(playerid);

		EditDynamicObject(playerid, pEditPoint[playerid][pEditObject]);
	}
	else
	{
		pEditPoint[playerid][pEditObjectSel] = objectid;
        EditDynamicObject(playerid, pEditPoint[playerid][pEditObjectSel]);
	}
	
	return 1;
}

stock DestroyEditPoint(playerid)
{
	if(pEditPoint[playerid][pEditObject] != -1)
	{
		DestroyDynamicObject(pEditPoint[playerid][pEditObject]);
		pEditPoint[playerid][pEditObject] = -1;
	}
	return 1;
}

hook OnGameModeInit()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    pEditPoint[i][pEditObject] = -1;
	    pEditPoint[i][pEditObjectSel] = -1;
	}
	return 1;
}

hook OnFilterScriptInit()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    pEditPoint[i][pEditObject] = -1;
	    pEditPoint[i][pEditObjectSel] = -1;
	}
	return 1;
}

public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
	if(objectid == pEditPoint[playerid][pEditObject] || objectid == pEditPoint[playerid][pEditObjectSel])
	{
		if(response == EDIT_RESPONSE_FINAL)
		{
		    if(pEditPoint[playerid][pEditObjectSel])
		    {
			    CallLocalFunction(pEditPoint[playerid][pEditCallBack], "iiifffffffff",
			        playerid, objectid, response,
					x,
					y,
					z,
					rx,
					ry,
					rz,
					x - pEditPoint[playerid][pSaveX],
					y - pEditPoint[playerid][pSaveY],
					z - pEditPoint[playerid][pSaveZ]);
	            DestroyEditPoint(playerid);
		    }
		    else
		    {
			    CallLocalFunction(pEditPoint[playerid][pEditCallBack], "iiifffffffff",
			        playerid, objectid, response,
					pEditPoint[playerid][pEditX],
					pEditPoint[playerid][pEditY],
					pEditPoint[playerid][pEditZ],
					pEditPoint[playerid][pEditRX],
					pEditPoint[playerid][pEditRY],
					pEditPoint[playerid][pEditRZ],
					pEditPoint[playerid][pEditX] - pEditPoint[playerid][pSaveX],
					pEditPoint[playerid][pEditY] - pEditPoint[playerid][pSaveY],
					pEditPoint[playerid][pEditZ] - pEditPoint[playerid][pSaveZ]);
	            DestroyEditPoint(playerid);
			}
		}
		else if(response == EDIT_RESPONSE_UPDATE)
		{
		    pEditPoint[playerid][pEditX] = x;
		    pEditPoint[playerid][pEditY] = y;
		    pEditPoint[playerid][pEditZ] = z;
		    pEditPoint[playerid][pEditRX] = rx;
		    pEditPoint[playerid][pEditRY] = ry;
		    pEditPoint[playerid][pEditRZ] = rz;

		    CallLocalFunction(pEditPoint[playerid][pEditCallBack], "iiifffffffff",
		        playerid, objectid, response, x, y, z, rx, ry, rz,
				pEditPoint[playerid][pEditX] - pEditPoint[playerid][pSaveX],
				pEditPoint[playerid][pEditY] - pEditPoint[playerid][pSaveY],
				pEditPoint[playerid][pEditZ] - pEditPoint[playerid][pSaveZ]);
		}
		else if(response == EDIT_RESPONSE_CANCEL)
		{
		    CallLocalFunction(pEditPoint[playerid][pEditCallBack], "iiifffffffff",
		        playerid, objectid, response,
				pEditPoint[playerid][pSaveX],
				pEditPoint[playerid][pSaveY],
				pEditPoint[playerid][pSaveZ],
				pEditPoint[playerid][pSaveRX],
				pEditPoint[playerid][pSaveRY],
				pEditPoint[playerid][pSaveRZ],
				0.0, 0.0, 0.0);
            DestroyEditPoint(playerid);
		}
	}
	return 1;
}


hook OnPlayerDisconnect(playerid, reason)
{
	DestroyEditPoint(playerid);
	return 1;
}
Self explanatory example.
Code:
stock PlayerEditPoint(playerid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, callback[], objectid = -1)
Just take note of the callback parameters. That last values are the offsets relative to where the edit point was started.
Code:
CallLocalFunction(pEditPoint[playerid][pEditCallBack], "iiifffffffff",
		        playerid, objectid, response, x, y, z, rx, ry, rz,
				pEditPoint[playerid][pEditX] - pEditPoint[playerid][pSaveX],
				pEditPoint[playerid][pEditY] - pEditPoint[playerid][pSaveY],
				pEditPoint[playerid][pEditZ] - pEditPoint[playerid][pSaveZ]);

forward MyCallback(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float;offx, Float:offy, Float:offz);
public MyCallback(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, Float;offx, Float:offy, Float:offz)
I should get around to polishing this as an include sometime
Reply
#8

Pottus don't harm me okay? I have little knowledge of scripting but im trying to be logical about his alternatives. Couldn't he easily just create a pre-made object set under specific /loadname per vehicle and thus when players tune their vehicles a pre-made object set can be bought meaning they have no freedom in moving it or customizing it themselves.

As well as for the vehicle stickers, he could use a small object preferably a bread slice (textured into something cool) and applied to specific parts of each samp vehicle. It will definitely take him time but isn't effort that makes a good product?


You may correct me if you want.
Reply
#9

Thanks guys for positive feedback, glad to see that once in a while in this community! I've saved that code for future since I won't have time to add more functionality into the modshop @Pottus, thanks anyways it's appreciated.

About users editting versus preset coordinates it's two sides of the same coin. On one hand this feature will be used on a "heavy rp" so players are expected to be realistic but on the other hand there will always be trollers so someone could easily just troll and place things in a non-rp manner. Or perhaps simply solve it by allowing some players to edit them if given permission (hour/level limitation for instance maybe). Either way putting stickers on your vehicle wouldn't be permitted to everyone, but instead it would be a really cool feature for let's say street racing factions or company factions advertising their name logo!

About other objects that could be attached to vehicles - besides siren, taxi sign and neon lights - what could be used to customize your vehicle even further? I'm probably just lacking creativity when it comes to this and don't see the, perhaps obvious, opportunities that players could have.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)