AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   entity takedamage and solid (https://forums.alliedmods.net/showthread.php?t=276731)

Kazalu 12-27-2015 09:00

entity takedamage and solid
 
Hey, guys.I am trying to create an entity that takes damage and is solid, but I cannot get it to work.Here's the code.

HTML Code:

public CmdSpawn( id )
{
new Float:Origin[ 3 ];
pev( id, pev_origin, Origin );

Origin[ 1 ] += 50.0;

SpawnEntities( id, Origin );
}

public SpawnEntities( owner, Float:Origin[ 3 ] )
{
new ent = create_entity( "info_target" );

if( ent )
{
entity_set_origin( ent, Origin );
new Float:maxs[3] = {100.0,100.0,100.0};
new Float:mins[3] = {-100.0,-100.0,-100.0};
entity_set_size( ent, mins, maxs );
entity_set_int( ent, EV_INT_solid, 2 );
entity_set_byte( ent, EV_BYTE_controller1, 125 );
entity_set_byte( ent, EV_BYTE_controller2, 125 );
entity_set_byte( ent, EV_BYTE_controller3, 125 );
entity_set_byte( ent ,EV_BYTE_controller4, 125 );
entity_set_float( ent, EV_FL_takedamage, 1.0 );
entity_set_float( ent, EV_FL_health, 100.0 );
entity_set_float( ent, EV_FL_max_health, 100.0 );
entity_set_string( ent, EV_SZ_classname, "npc_zombie" );
entity_set_model( ent, zmModel1 );
entity_set_float( ent, EV_FL_animtime, 2.0 );
entity_set_float( ent, EV_FL_framerate, 1.0 );
entity_set_int( ent, EV_INT_sequence, 0 );
entity_set_float( ent, EV_FL_nextthink, halflife_time() + 0.01 );
drop_to_floor( ent );
}
}

public npc_think( ent )
{
entity_set_float( ent, EV_FL_nextthink, halflife_time() + 0.01 );
}


Bugsy 12-27-2015 11:07

Re: entity takedamage and solid
 
Quote:

Originally Posted by Kazalu (Post 2376822)
Fixed.

Please do not delete your post content when you solve your issue. Instead, post your solution so others with the same issue will know what to do.

Kazalu 12-27-2015 11:10

Re: entity takedamage and solid
 
Well, ok, my bad.

The thing is I was not able to make an entity solid.Why? Because I was making it solid before I was setting its model.
That was the fix.


All times are GMT -4. The time now is 17:55.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.