PDA

View Full Version : Make func_illusionary solid to SOLID_BBOX



anggara_nothing
13-02-2016, 05:47 PM
Is it possible? because i placed info_node above illusionary which is required to above solid entities.

Solokiller
13-02-2016, 06:01 PM
Assuming the compiler doesn't strip clipnodes from it, setting its solid variable to SOLID_BSP will turn it into BSP geometry. SOLID_BBOX should work if you set the size using g_EntityFuncs.SetSize. I haven't tried it myself though.

anggara_nothing
13-02-2016, 07:07 PM
Should i set keyvalue "solid" in BSP or use angelscript to override it?

anggara_nothing
13-02-2016, 07:25 PM
Sorry for double post.
This angelscript not working.

/*
* func_illusionary
*/

class func_illusionary : ScriptBaseEntity
{
void KeyValue( KeyValueData@ pkvd )
{
BaseClass.KeyValue( pkvd );
}

void Precache()
{
BaseClass.Precache();
}

void Spawn()
{
self.pev.movetype = MOVETYPE_NONE;
self.pev.solid = SOLID_BSP;

SetThink( ThinkFunction( this.IllusiThink ) );
self.pev.nextthink = g_Engine.time + 0.1f;

self.Precache();
self.SetObjectCollisionBox();
}

void IllusiThink()
{
self.pev.solid = SOLID_BSP;
self.pev.nextthink = g_Engine.time + 0.1f;
}
}

void RegisterPointIllusionaryEntity()
{
g_CustomEntityFuncs.RegisterCustomEntity( "func_illusionary", "func_illusionary" );
}

Solokiller
13-02-2016, 07:51 PM
You can't override existing entities in Angelscript. To change the solid variable, do this:



void ChangeSolid()
{
CBaseEntity@ pEnt = g_EntityFuncs.FindEntityByTargetname( null, "name" );

if( pEnt is null )
return;

pEnt.pev.solid = SOLID_BSP;
}


Adjust the targetname as needed, modify it as needed to suit your needs.

anggara_nothing
13-02-2016, 08:09 PM
You can't override existing entities in Angelscript. To change the solid variable, do this:



void ChangeSolid()
{
CBaseEntity@ pEnt = g_EntityFuncs.FindEntityByTargetname( null, "name" );

if( pEnt is null )
return;

pEnt.pev.solid = SOLID_BSP;
}


Adjust the targetname as needed, modify it as needed to suit your needs.

Sorry for late reply.
This code seems work.

void ChangeIllusiSolid()
{
CBaseEntity@ ent = null;
// FindEntityByClassname is case sensitive. Make a workaround later.
while( ( @ent = g_EntityFuncs.FindEntityByClassname( ent, "func_illusionary" ) ) !is null )
{
ent.pev.solid = SOLID_BSP;
}
}

I started the method in MapInit, MapActivate. But info_node seems not connected correctly.

EDIT: I replaced func_illusionary with func_wall and it worked!!! Thanks for the replies.