Raised This Month: $32 Target: $400
 8% 

entity takedamage and solid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kazalu
Senior Member
Join Date: Dec 2013
Location: Romania
Old 12-27-2015 , 09:00   entity takedamage and solid
Reply With Quote #1

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 );
}

Last edited by Arkshine; 12-27-2015 at 13:36.
Kazalu is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-27-2015 , 11:07   Re: entity takedamage and solid
Reply With Quote #2

Quote:
Originally Posted by Kazalu View Post
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.
__________________
Bugsy is offline
Kazalu
Senior Member
Join Date: Dec 2013
Location: Romania
Old 12-27-2015 , 11:10   Re: entity takedamage and solid
Reply With Quote #3

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.
Kazalu is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:28.


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