Half-Life и Adrenaline Gamer форум

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

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




Начать новую тему Ответить на тему  [ Сообщений: 26 ]  На страницу 1, 2, 3  След.
Автор Сообщение
 Заголовок сообщения: spawn (players /entities) in some classname ?
СообщениеДобавлено: 10 дек 2017, 19:44 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
19 мар 2024, 11:39
Сообщения: 1018
Hi
Why can not I spawn some entities in classname already on the map ?

What i try :

1) first for Players :
i try ready plugins to spawn players in info_player_team1 & info_player_team2
i get the debug messages when spawn but the The player can spawn in just one point (i think in info_player_start)

2) for ent :
using jctf plug
I have try to replaced the flags classname :
old classname in the default plugin:
Код:
new iFindSpawn = find_ent_by_class(-1, iFlagTeam == TEAM_BLUE ? "info_player_start" : "info_player_deathmatch")  
to ==>
new classname :
Код:
new iFindSpawn = find_ent_by_class(-1, iFlagTeam == TEAM_BLUE ? "item_flag_team1" : "item_flag_team2") 
Knowing this classname exist in the map (and othere maps to ! ) //CTF maps compatibility hack ;)
Код:
{
"origin" "0 -2984 66"
"classname" "item_flag_team1"
}
{
"origin" "0 2984 66"
"classname" "item_flag_team2"
}
but the The flags can spawn in just one point to !
Inside the exact function :
Код:
public flag_spawn(iFlagTeam)
{
    if(g_fFlagBase[iFlagTeam][x] == 0.0 && g_fFlagBase[iFlagTeam][y] == 0.0 && g_fFlagBase[iFlagTeam][z] == 0.0)
    {
        new iFindSpawn = find_ent_by_class(-1, iFlagTeam == TEAM_BLUE ? "item_flag_team1" : "item_flag_team2")

        if( pev_valid(iFindSpawn) )
        {
            entity_get_vector(iFindSpawn, EV_VEC_origin, g_fFlagBase[iFlagTeam])
            server_print("[CTF] %s flag origin not defined, set on player spawn.", g_szTeamName[iFlagTeam])
        }
        else
        {
            server_print("[CTF] WARNING: player spawn for ^"%s^" team does not exist !", g_szTeamName[iFlagTeam])
            log_error(AMX_ERR_NOTFOUND, "[CTF] WARNING: player spawn for ^"%s^" team does not exist !", g_szTeamName[iFlagTeam])
            set_fail_state("Player spawn unexistent!")

            return PLUGIN_CONTINUE
        }
    }
    entity_set_origin(ent, g_fFlagBase[iFlagTeam])

Note: i try plugins in agmini server

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: spawn (players /entities) in some classname ?
СообщениеДобавлено: 11 дек 2017, 22:33 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
18 мар 2024, 17:42
Сообщения: 6864
As usual, I am not sure what you are trying to do and asking for.
About customly named entites - if they appear in the .map file - if game dll knows about them, they will spawn, otherwise they will not. For example, .map can contain "my_random_ent" and it shouldn't spawn, AFAIK. Because engine will search for the code for that entity class inside of game dll.
But, after it is spawned (created) class can be changed to what ever you want. This is how all these plugins do with "info_target" class name. It is done so, because "info_target" entity type is very simple
Код:
class CPointEntity : public CBaseEntity
{
public:
   void   Spawn( void );
   virtual int   ObjectCaps( void ) { return CBaseEntity :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
private:
};
LINK_ENTITY_TO_CLASS( info_target, CPointEntity );


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: spawn (players /entities) in some classname ?
СообщениеДобавлено: 12 дек 2017, 02:28 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
19 мар 2024, 11:39
Сообщения: 1018
Lev писал(а):
As usual, I am not sure what you are trying to do and asking for.
I want to exploit some of the class on the map and create either entities or spawn the players in some class (in his team calss )
The general idea is that I want to write a mod ctf for mini ag with the same settings as available.

Lev писал(а):
About customly named entites - if they appear in the .map file - if game dll knows about them, they will spawn,
Yes it shows up as I said ..but The flags can spawn in just one point (in info_player_start)! [I'm not sure I understand you correctly][/quote]
Lev писал(а):
otherwise they will not. For example, .map can contain "my_random_ent" and it shouldn't spawn, AFAIK. Because engine will search for the code for that entity class inside of game dll.
Do not tell me that this can not be achieved. This is bad news :o
Lev писал(а):
But, after it is spawned (created) class can be changed to what ever you want. This is how all these plugins do with "info_target" class name. It is done so, because "info_target" entity type is very simple
How can I search it? (class) . bcz i try to debug it do not get results?

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: spawn (players /entities) in some classname ?
СообщениеДобавлено: 12 дек 2017, 07:18 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
18 мар 2024, 17:42
Сообщения: 6864
After setting custom class name to an entity usual searching for that classname should work.
Код:
   while ((oldEntity = engfunc(EngFunc_FindEntityByString, oldEntity, "classname", "my_random_ent")))
Код:
find_ent_by_class(-1, "my_random_ent")

Still I didn't got your idea about spawning, etc...


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: spawn (players /entities) in some classname ?
СообщениеДобавлено: 12 дек 2017, 14:32 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
19 мар 2024, 11:39
Сообщения: 1018
Yes I used one of the two methods but I do not get a result? (map ==> agctf_duff)
the ent spawn only in info_player_start class
 

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: spawn (players /entities) in some classname ?
СообщениеДобавлено: 12 дек 2017, 21:38 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
18 мар 2024, 17:42
Сообщения: 6864
Код:
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")) 
   entity_set_string(ent, EV_SZ_classname, ENT_CLASSNAME)
Why not just
Код:
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, ENT_CLASSNAME)) 
?

Try to delay creation a bit with a task. May be not a good idea to create entity in precache. Sadly I don't remember exactly. So, just for a case.
Also you didn't used any debug output so I dunno where your code behave not as expected.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: spawn (players /entities) in some classname ?
СообщениеДобавлено: 13 дек 2017, 21:56 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
19 мар 2024, 11:39
Сообщения: 1018
Lev писал(а):
Код:
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")) 
   entity_set_string(ent, EV_SZ_classname, ENT_CLASSNAME)
Why not just
Код:
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, ENT_CLASSNAME)) 
?

It does not work.
Here is another code :
 
debug output :
Цитата:
--------------
classname1 = info_player_team1
---------------
--------------
classname2 = info_player_team1
---------------
Still creates at one different point (this mean not in "info_player_team1")

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: spawn (players /entities) in some classname ?
СообщениеДобавлено: 13 дек 2017, 22:31 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
18 мар 2024, 17:42
Сообщения: 6864
Код:
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
   entity_set_string(ent, EV_SZ_classname, ENT_CLASSNAME)
   entity_get_string(ent,EV_SZ_classname,className,32)
   server_print("--------------^nclassname1 = %s^n---------------",className)
   server_print("--------------^nclassname2 = %s^n---------------",className)
Цитата:
classname1 = info_player_team1
classname2 = info_player_team1
All looks pretty logical: you set it, you get it, twice.
So I still unsure what you want.

Добавлено спустя 1 минуту 27 секунд:
Код:
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, ENT_CLASSNAME)) 
abdobiskra писал(а):
It does not work.
Again, just words and no description how it doesn't work.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: spawn (players /entities) in some classname ?
СообщениеДобавлено: 13 дек 2017, 23:35 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
19 мар 2024, 11:39
Сообщения: 1018
My mistake was sorry the test was fast ("info_player_team1" to ==> "item_flag_team1")

Lev писал(а):
All looks pretty logical: you set it, you get it, twice.
ok here :
 
debug output :
Цитата:
--------------
classname = item_flag_team1
---------------
Lev писал(а):
So I still unsure what you want.
just want to create the entity and spawn it in this classname "item_flag_team1" thats all.

Lev писал(а):
Again, just words and no description how it doesn't work.
ok .
when i try this way I did not get debug output and the ent not found in the map .
Код:
#include <amxmisc>
#include <engine>
#include <fakemeta>

new const ENT_MODEL[] = "models/barney.mdl" // For example
new const ENT_CLASSNAME[] = "item_flag_team1"


public plugin_precache()
   precache_model(ENT_MODEL)
public plugin_init()
   set_task(10.0, "ent_spawn")


public ent_spawn()
{
   new className[33]
   
   new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, ENT_CLASSNAME))
   
   if(!pev_valid(ent)) return // i cheak it bcz i get the bug ( [ENGINE] Invalid entity 155)
   
   entity_get_string(ent,EV_SZ_classname,className,32)
   server_print("--------------^nclassname = %s^n---------------",className)
   
   
   entity_set_model(ent, ENT_MODEL)
   dllfunc(DLLFunc_Spawn, ent)
   entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
   
}
i hope you understand me bcz i use my R.I.P ENG .

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: spawn (players /entities) in some classname ?
СообщениеДобавлено: 14 дек 2017, 02:02 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
18 мар 2024, 17:42
Сообщения: 6864
abdobiskra писал(а):
spawn it in this classname "item_flag_team1"
First of all, you mentioned this twice, so probably you are really write it so. You can't spawn _IN_ classname. You can create entity of certain classname. You can change classname. That's it. No more.
So, you probably want to find entity with item_flag_team1 classname, get its coordinates and then, move your entity (no matter of what classname) there.


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

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


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

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


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

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