AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem of creating entity (https://forums.alliedmods.net/showthread.php?t=224340)

wgwgkg 08-22-2013 23:46

Problem of creating entity
 
I made a NPC and I want to make it shoots to a target, so I wrote:
Code:

new target = FindClosesEnemy(ent)
new shell = create_entity("info_target")
new Float:origin[3], Float:targetorigin[3]
entity_get_vector(ent,EV_VEC_origin,origin)
entity_set_origin(shell,origin)
entity_get_vector(target,EV_VEC_origin,targetorigin)
entity_set_model(shell, "models/shell.mdl")
entity_set_string(shell, EV_SZ_classname, "shell")
entity_set_int(shell, EV_INT_solid, SOLID_BBOX)
entity_set_int(shell, EV_INT_movetype, MOVETYPE_PUSHSTEP)
new Float:mins[3] = { -0.6, -0.7, 0.0 }
new Float:maxs[3] = { 0.7, 0.7, 3.0 }
entity_set_size(shell, mins, maxs)
entity_set_int(shell, EV_FL_gravity, 0)
npc_turntotarget(shell, origin, target, targetorigin)
hook_ent(shell, target)

However the bullet stuck in the npc body, I have tried to make the origin[2] higher it works but not very realistic , the bullet shoot from the npc's head. So what can I do?


Sorry for my bad English:3


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

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