Ayuda con traspasar una entidad
#1
Hola que tal, estuve en todo el dia intetando de muchas maneras pero no logro hacer, por favor necesito de su ayuda

Esta es la entidad que creo:

Código PHP:
public largar_Caja(id){
 
 new 
ent create_entity("info_target")
 
 
entity_set_string(entEV_SZ_classname"npc_caja")
 
entity_set_model(entmodel_caja)
 
entity_set_size(entFloat:{ -12.0, -12.0, -12.0 }, Float:{ 12.012.012.0 })
 
entity_set_float(entEV_FL_health1000.0)
 
set_rendering(entkRenderFxGlowShell2551515kRenderNormal1);
 
entity_set_float(entEV_FL_takedamageDAMAGE_AIM)
 
entity_set_int(entEV_INT_solidSOLID_BBOX)
 
 
 
//entity_set_edict(ent, EV_ENT_owner, id);
 
 
entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP)
 
entity_set_int(entEV_INT_sequenceANIM_IDLE
 
entity_set_origin(entfOrigin)
 
drop_to_floor(ent


y esto es el código que uso para traspasar a mi compañeros me anda perfecto pero no logro traspasar la entidad que puse arriba npc_caja

Código PHP:
[u]PostThink[/u]

new 
i;
 for(
1<= g_maxplayers; ++i)
 {
 if(
g_player_restore[i])
 {
 
entity_set_int(iEV_INT_solidSOLID_SLIDEBOX);
 
g_player_restore[i] = 0;
 }
 } 

Código PHP:
[u]PreThink[/u]

static 
iLastThink;
 static 
i;
 
 if(
iLastThink id)
 {
 for(
1<= g_maxplayers; ++i)
 {
 if(!
g_isalive[i])
 {
 
g_player_solid[i] = 0;
 continue;
 }
 
 
g_player_solid[i] = entity_get_int(iEV_INT_solid) == SOLID_SLIDEBOX 0;
 }
 }
 
 
iLastThink id;
 
 if(
g_player_solid[id]){
 for(
1<= g_maxplayers; ++i)
 {
 if(!
g_player_solid[i] || id == i)
 continue;
 
 if((
g_newround || g_endround) || (g_zombie[id] && g_zombie[i]) || (!g_zombie[id] && !g_zombie[i])){
 
entity_set_int(iEV_INT_solidSOLID_NOT);
 
g_player_restore[i] = 1;
 }
 }
 } 

Espero que se entienda , muchas gracias

Edit: No se porque no se me tabula cuando lo paso aca el código
Responder
#2
Muéstrame el think de la caja
Responder
#3
Hola, solo tengo el código que pase, que es crear la entidad de la caja, y el semiclip que agregué es el que uso para los humanos como ejemplo
Responder
#4
Código PHP:
public fw_TouchCaja(const pEntity, const pToucher)
{
    if(!is_valid_ent(pEntity) || !is_user_alive(pToucher))
        return;
    
    
static iOwner;
    iOwner entity_get_edict(pEntityEV_ENT_owner);
    
    
if(iOwner && pToucher == iOwner)
        return; 
    
    
// Recompensa por agarrar la caja
    // Se remueve la entidad
    cs_set_user_money(pTouchercs_get_user_money(pToucher) + 1000);
    remove_entity(pEntity);
}

public 
largar_Caja(id)
{
    new ent create_entity("info_target")
    
    entity_set_string
(entEV_SZ_classname"npc_caja")

    entity_set_model(entmodel_caja)

    entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP)
    entity_set_int(entEV_INT_sequenceANIM_IDLE

    entity_set_float(entEV_FL_health1000.0)

    entity_set_float(entEV_FL_takedamageDAMAGE_AIM)
    entity_set_int(entEV_INT_solidSOLID_TRIGGER)
    
    entity_set_size
(entFloat:{ -12.0, -12.0, -12.0 }, Float:{ 12.012.012.0 })
    entity_set_origin(entfOrigin)

    //entity_set_edict(ent, EV_ENT_owner, id);

    set_rendering(entkRenderFxGlowShell2551515kRenderNormal1);
    drop_to_floor(ent


y en plugin_init pon:

Código PHP:
register_touch("npc_caja""*""fw_TouchCaja"); 
Responder
#5
Que funcion cumple fw_TouchCaja?
Responder
#6
(10/08/2021, 08:38 PM)Spirit escribió: Que funcion cumple fw_TouchCaja?

Touch = Tocar

Concentrated
Responder
#7
Si quieres atravesar la entidad, deberías usar var_owner, el comportamiento de var_owner respecto a usar iuserX es "casi" lo mismo, almacenas el owner, pero el comportamiento respecto a la entidad es diferente (en términos de física entre tu y la entidad)
Responder
#8
Bueno tkod, pruebo y te aviso  muchas gracias por tu ayuda

Hola metita, con el método que vos decís sería solo yo con mi entidad , o también se puede con la entidad owner de los demás?, esta entidad sería en general que va dejando los jugadores
Responder
#9
Yo lo dije en base a lo que entendi de tu post, con var_owner solo TU (el Owner, el dueño) podrás atravesar la entidad, si no te queda hacer los chequeos respectivos en touch.
Responder
#10
Ok, tengo una idea, gracias metita, cualquier cosa aviso gracias
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)