English How do i change the character with custom one?

19 replies
Goto Page
To the start Previous 1 Next To the start
Up
UrNightmare
User
Offline Off
So i see a thread that talking about custom character, i am curious of it since you CAN'T change your character in CS2D. Hope you guys help me find the answer
[ String+ ] make string library more extended and advanced!
28.01.22 11:14:45 am
Up
Mami Tomoe
User
Offline Off
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.
Look at me standing, here on my own again
29.01.22 07:17:15 am
Up
UrNightmare
User
Offline Off
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?
[ String+ ] make string library more extended and advanced!
29.01.22 05:08:09 pm
Up
Mami Tomoe
User
Offline Off
Server mods affect all who choose to join the server.
Look at me standing, here on my own again
29.01.22 11:02:32 pm
Up
Masea
Super User
Offline Off
user UrNightmare 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.
Shit your pants: file cs2d Outlast II Mod (29) | Create your UI faster: CS2D UI Framework
29.01.22 11:28:41 pm
Up
Mami Tomoe
User
Offline Off
@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:
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
Look at me standing, here on my own again
30.01.22 12:15:38 am
Up
Masea
Super User
Offline Off
@user Mami Tomoe: That's one way of giving a proper welcome to a player
Shit your pants: file cs2d Outlast II Mod (29) | Create your UI faster: CS2D UI Framework
30.01.22 12:18:00 am
Up
Mami Tomoe
User
Offline Off
@user Masea, assuming that you do it whilst the player is dead, they won't repeatedly die.

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.
Look at me standing, here on my own again
30.01.22 12:22:09 am
Up
Masea
Super User
Offline Off
Better devs just add the feature, yes? Yes.
Shit your pants: file cs2d Outlast II Mod (29) | Create your UI faster: CS2D UI Framework
30.01.22 05:47:00 am
Up
UrNightmare
User
Offline Off
I think CS2D has a downside where you can't force player to download the sprite, hoping for devs to add force download so the mod maker didn't get a headache making a custom character apply on player.
[ String+ ] make string library more extended and advanced!
30.01.22 07:01:39 am
Up
Mami Tomoe
User
Offline Off
I literally said that mods are forced.
Look at me standing, here on my own again
30.01.22 09:24:01 am
Up
UrNightmare
User
Offline Off
No, not like that. Like adding a texture pack feature so we don't have to use mod for changing player's character.
[ String+ ] make string library more extended and advanced!
30.01.22 10:47:59 am
Up
Cebra
User
Offline Off
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
loading...
30.01.22 11:39:24 am
Up
Mami Tomoe
User
Offline Off
A server mod allows you to replace all the GFX and SFX resources for a given player.
The player will 100% have that mod loaded once joining the server.
Is this not what you want?
Look at me standing, here on my own again
30.01.22 12:58:16 pm
Up
UrNightmare
User
Offline Off
Yes, that's what I want
[ String+ ] make string library more extended and advanced!
30.01.22 01:52:39 pm
Up
Mami Tomoe
User
Offline Off
That is already a feature in the game.
Use server mods.
Look at me standing, here on my own again
31.01.22 09:40:24 am
Up
Gaios
Security Supporter
Offline Off
user Mami Tomoe has written:
(...) 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....

What's switch hook?
31.01.22 02:33:20 pm
Up
Mami Tomoe
User
Offline Off
@user Gaios: Read the documentation.
Executed every time a player switches their held item.
In this context used to change the player sprite accordingly.
Look at me standing, here on my own again
31.01.22 03:18:46 pm
Up
Gaios
Security Supporter
Offline Off
user Mami Tomoe has written:
@user Gaios: Read the documentation.
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.
31.01.22 03:24:19 pm
Up
Mami Tomoe
User
Offline Off
@user Gaios: Oh, I meant the cs2d lua hook select.
Look at me standing, here on my own again
To the start Previous 1 Next To the start