Forum
CS2D Scripts How do i change the character with custom one?How do i change the character with custom one?
19 replies 1
You can use mods to hide the player sprites so everyone is invisible, and then use 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 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.
Quote
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? 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.
Komo the Cat has written
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. Quote
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?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.
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.
You'd have to use maket/ 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
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
If they're alive, they'll only die once.
You can also remove the death if they are alive, I omitted that part just because this is a proof of concept.
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
The player will 100% have that mod loaded once joining the server.
Is this not what you want?
Use server mods.
Mami Tomoe has written
(...) This would also be affected by lag, as you'd need to change the sprite using the switch hook, which is ping dependent and won't look good visually....
What's switch hook?
Executed every time a player switches their held item.
In this context used to change the player sprite accordingly.
Mami Tomoe has written
@ Gaios: Read the documentation.
Executed every time a player switches their held item.
In this context used to change the player sprite accordingly.
Executed every time a player switches their held item.
In this context used to change the player sprite accordingly.
Quote
The Lua hook "switch" has not been found. It either does not exist or it is not documented here.
1