Forum

> > CS2D > Scripts > How do i change the character with custom one?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How do i change the character with custom one?

19 replies
To the start Previous 1 Next To the start

old Re: How do i change the character with custom one?

Mami Tomoe
User Off Offline

Quote
There are many approaches to doing this, each with their own downside.

You can use mods to hide the player sprites so everyone is invisible, and then use cs2d lua cmd image on a spreadsheet mode to display a custom skin, but that won't overlay very well because you can't place an image above the feet but below the held weapons.
This would also be affected by lag, as you'd need to change the sprite using the cs2d lua hook switch hook, which is ping dependent and won't look good visually.

Instead, a better approach would be to use mods to simply change the skin, though then you're still limited to 4 characters per team.
Also, you can't set a skin through Lua, not yet at least, so it would be fairly messy to force a skin, if you wish.

This is assuming that your definition of a character is the skin, if not, do elaborate on what it is.

old Re: How do i change the character with custom one?

Komo the Cat
User Off Offline

Quote
Quote
Instead, a better approach would be to use mods to simply change the skin, though then you're still limited to 4 characters per team.
I think this one is a good idea, but the problem is that the texture only affects on clientside, not server one. Is there any ways to make the mod downloaded on the other players' device?

old Re: How do i change the character with custom one?

Masea
Super User Off Offline

Quote
user Komo the Cat has written
Quote
Instead, a better approach would be to use mods to simply change the skin, though then you're still limited to 4 characters per team.
I think this one is a good idea, but the problem is that the texture only affects on clientside, not server one. Is there any ways to make the mod downloaded on the other players' device?
Note that you can't force a player to use a specific skin, so this is relatively useless if you plan to change a player's character skin via code. Custom skins you do via the mods folder are just there for the sake of appearance if anyone cares.

One of the mods that come to my mind with custom skins is a classes mod where every class will possess different characteristics and a custom sprite. You can't do this with that.

old Re: How do i change the character with custom one?

Mami Tomoe
User Off Offline

Quote
@user Masea, you can force a skin but it's very...

You'd have to use cs2d cmd maket/cs2d cmd makect depending on the player's team to set the team until the randomiser sets the skin on the skin that you want.

An example code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
local setTeam = { [0] = 'makespec', [1] = 'maket', [2] = 'makect' }

setTeam[3] = setTeam[2] -- V.I.P. support.


function setSkin(p, skin)
	if skin < 0 or skin > 3 then
		-- No such skin id.

		return
	end

	local team = player(p, 'team')

	if team == 0 then
		-- Player is a spectator

		return
	end

	-- Optimise this as much as possible
	local exec	= parse
	local get	= player
	local cmd	= setTeam[team]

	while get(p, 'look') ~= skin do
		-- Keep setting the team
		-- for as long as the randomiser
		-- didn't choose the skin that we want.
		exec(cmd .. ' ' .. p)
	end
end
edited 1×, last 29.01.22 11:44:43 pm

old Re: How do i change the character with custom one?

Cebra
User Off Offline

Quote
I don't think there will be a force download, if only because of security reasons.
A more practical solution maybe would be if the server can check which mods are available and can set one of them.
If sb joins who has not the right mod you can kick him
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview