Half-Life и Adrenaline Gamer форум

Всё об игре в Халф-Лайф и АГ
Текущее время: 28 мар 2024, 18:04

Часовой пояс: UTC + 5 часов [ Летнее время ]




Начать новую тему Ответить на тему  [ Сообщений: 12 ]  На страницу 1, 2  След.
Автор Сообщение
 Заголовок сообщения: Ways to change player model
СообщениеДобавлено: 06 окт 2018, 01:29 
Не в сети
Зарегистрирован:
24 апр 2017, 21:16
Последнее посещение:
19 ноя 2023, 09:01
Сообщения: 53
Hi, I'm currently finishing a zombie mod for HL which I'm going to release soon, I'm looking to add zombie classes, but I really don't know how to change players models properly, I have try some ways but I end up breaking the scoreboard or something else... Any help is appreciated.

_________________
Изображение
Zombie Mod X | AG Mod X | HL Player Models API
Contact:
@Discord: rtxa#6795


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Ways to change player model
СообщениеДобавлено: 06 окт 2018, 01:36 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
20 мар 2024, 19:47
Сообщения: 1018
Hi,
viewtopic.php?f=20&t=2225

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Ways to change player model
СообщениеДобавлено: 06 окт 2018, 01:40 
Не в сети
Зарегистрирован:
24 апр 2017, 21:16
Последнее посещение:
19 ноя 2023, 09:01
Сообщения: 53
abdobiskra писал(а):
Thanks, I have read it all before, some of the solutions given there are which end up breaking the scoreboard. The thread is old so maybe someone has found a properly solution.

_________________
Изображение
Zombie Mod X | AG Mod X | HL Player Models API
Contact:
@Discord: rtxa#6795


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Ways to change player model
СообщениеДобавлено: 06 окт 2018, 01:48 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
20 мар 2024, 19:47
Сообщения: 1018
I remember it was the same problem and I forgot where the solution was put
I found a test might be the solution!
 
If it does not work, I will try to find it tomorrow if God wills :)

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Ways to change player model
СообщениеДобавлено: 06 окт 2018, 03:19 
Не в сети
Зарегистрирован:
24 апр 2017, 21:16
Последнее посещение:
19 ноя 2023, 09:01
Сообщения: 53
Thanks, but that is the code that breaks the scoreboard.



When I'm a human and I use /smodel, human bots are trying to kill me and they can hurt me, but the scoreboard isn't affected apparently.
Изображение



After that, I respawn being a human, human bots are trying to kill me yet, but now they can't hurt me, but now the scoreboard gets break. I become a zombie but the scoreboard remains the same.
Изображение

Of course, functions that are dependent of model userinfo get breaks, like hl_get_user_mode, something has to be redone, is ugly how HL handles this.

_________________
Изображение
Zombie Mod X | AG Mod X | HL Player Models API
Contact:
@Discord: rtxa#6795


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Ways to change player model
СообщениеДобавлено: 14 фев 2019, 00:22 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
26 мар 2024, 21:42
Сообщения: 6864
I think changing model in AddToFullPack should work. Even if it will be expensive, I still can recommend to try it.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Ways to change player model
СообщениеДобавлено: 20 фев 2019, 02:40 
Не в сети
Зарегистрирован:
24 апр 2017, 21:16
Последнее посещение:
19 ноя 2023, 09:01
Сообщения: 53
Lev писал(а):
I think changing model in AddToFullPack should work. Even if it will be expensive, I still can recommend to try it.
Well, I'm already using a semiclip plugin, so that shouldn't be a problem, but that doesn't work, I change ES_ModelIndex and there are no changes, can you show me some code?

_________________
Изображение
Zombie Mod X | AG Mod X | HL Player Models API
Contact:
@Discord: rtxa#6795


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Ways to change player model
СообщениеДобавлено: 07 мар 2019, 00:33 
Не в сети
Зарегистрирован:
24 апр 2017, 21:16
Последнее посещение:
19 ноя 2023, 09:01
Сообщения: 53
Well, I have some news, I have find the way to make the method with AddToFullPack(), you need to remove "model" key info, when player spawns, set his model to "", after that, block any changes with SetClientKeyValue() and client_infochanged() forwards.

After some testing, I realize that AddToFullPack method breaks to lot of things in teamplay mode, and it will be hard to trick the gamedll to make it work fine, so I'm going back to the old method, still there is an issue whenever you set a custom model that is already in mp_teamlist.

Also, with AddToFullPack() method, by removing "model" key info, you are going to break the way bots can tell if player is teammate or not, so it's no sense to use this method because is more hard to trick the gamedll.

_________________
Изображение
Zombie Mod X | AG Mod X | HL Player Models API
Contact:
@Discord: rtxa#6795


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Ways to change player model
СообщениеДобавлено: 19 мар 2019, 02:39 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
26 мар 2024, 21:42
Сообщения: 6864
Checked the code. Looks like I was wrong. Let me suppose now that AddToFullPack works for other entites. And players are getting models to render from special svc_updateuserinfo message.
So, let assume that you are playing on the server. Then server sends you svc_updateuserinfo about each other player on the server.
Код:
   MSG_WriteByte(sb, svc_updateuserinfo);
   MSG_WriteByte(sb, cl - g_psvs.clients);
   MSG_WriteLong(sb, cl->userid);
   MSG_WriteString(sb, info);
Your client engine parse these messages into player_info_t structure, and client game dll taskes that data into hud_player_info_t via
Код:
GetPlayerInfo(playerIndex + 1, &g_PlayerInfoList[playerIndex + 1])
And then renders it with
Код:
g_PlayerInfoList[playerIndex + 1].model
Server's game dll uses the same info field "model" to select team for the player.
So your goal is to:
  • tell game dll on the server that each player has one specific team model, for ex. "red" and "blue"
  • tell engine on the server that each player has some unique model to render.
I think this is possible because you are sitting between game dll and engine on the server, so you can control how game dll sees that data.

So, to the action:
  • use engclient_cmd command to set setinfo for the player on the server. Here use your custom models.
  • hook and block FM_ClientUserInfoChanged, so new model info will not pass to the game dll.
  • to let player to change name, for example, or to set his team, use this code inside of blocked FM_ClientUserInfoChanged:
    Код:
    new info = engfunc(EngFunc_GetInfoKeyBuffer, id);
    // change model inside [b]info[/b] variable to required team model name
    ...
    // pass corrected info to the game dll
    dllfunc(DLLFunc_ClientUserInfoChanged, id, info);
I think this should work.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Ways to change player model
СообщениеДобавлено: 20 мар 2019, 23:26 
Не в сети
Зарегистрирован:
24 апр 2017, 21:16
Последнее посещение:
19 ноя 2023, 09:01
Сообщения: 53
A few days ago I finished HL Player Models API, have you take it a look? By removing model info from player, I was able to set any modelindex, so no need to use AddToFullPack, instead, set modelindex on PlayerPostThink_Post(). Unfortunately, that breaks compatibility with anything that uses player's model to distinguish teams.
Interesting solution, but I have some doubts, how can you set player model with engclient_cmd()? I have test some values like "model gina", but it doesn't trigger anything. I show you what I have done.
Код:
SetModel(id) {
   new info[256];
   copy_infokey_buffer(engfunc(EngFunc_GetInfoKeyBuffer, id), info, charsmax(info));

   new idx = contain(info, "model\");
   if (idx != -1) {
      new model[128];
      strtok(info[idx + 6], model, charsmax(model), "", 0, '\');
      replace(info[idx + 6], charsmax(info), model, "gina");
   }

   message_begin(MSG_ALL, SVC_UPDATEUSERINFO);
   write_byte(id - 1);
   write_long(get_user_userid(id));
   write_string(info);
   write_long(0);
   write_long(0);
   write_long(0);
   write_long(0);
   message_end();
}
This method changes player model without too much effort and it doens't break compatability :Yahoo!:.
What remains would be to see in what moments we have to call this. I would like to hook SVC_UPDATEUSERINFO and change values from there, but when I try this from AMX Mod X, it never gets call.

_________________
Изображение
Zombie Mod X | AG Mod X | HL Player Models API
Contact:
@Discord: rtxa#6795


Вернуться к началу
 Профиль 
  
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 12 ]  На страницу 1, 2  След.

Часовой пояс: UTC + 5 часов [ Летнее время ]


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 5


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
Создано на основе phpBB® Forum Software © phpBB Group
Русская поддержка phpBB