Raised This Month: $51 Target: $400
 12% 

Movetype_walk [ SOLVED ]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zaidbt
Senior Member
Join Date: Jun 2014
Location: Morroco
Old 04-08-2015 , 07:38   Movetype_walk [ SOLVED ]
Reply With Quote #1

Hey
PHP Code:
set_pev(entpev_movetypeMOVETYPE_WALK
Usage please ? Because when i use it in this way , Cs crash with this error
Code:
Sv_phyiscs ent_npc bad movetype 3
Full Code :
PHP Code:
public clcmd_npc(id)
{
    if(
g_cooldown) return PLUGIN_HANDLED;
    
    if(
g_spawncount >= MAX_SPAWN)
    {
        
client_print(idprint_chat" Max [%i] Walls Are Made .."MAX_SPAWN)
        return 
PLUGIN_HANDLED;
    }
    
    
g_cooldown 1
    
    
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    if(!
pev_valid(ent)) return PLUGIN_HANDLED;
    
    
set_pev(entpev_classnameg_NpcClassName)
    
set_pev(entpev_netname"Barney")
    new 
Floatorigin[3], Floatangle[3], Floatvelocity[3]
    
pev(idpev_originorigin)
    
origin[2] += 30.0
    engfunc
(EngFunc_SetOriginentorigin)
    
pev(idpev_anglesangle)
    
angle[0] = 0.0
    set_pev
(entpev_anglesangle)
    
set_pev(entpev_takedamage1.0)
    
set_pev(entpev_health150.0)
    
set_pev(entpev_gravity1.0)
    
set_pev(entpev_movetypeMOVETYPE_WALK)
    
set_pev(entpev_solidSOLID_SLIDEBOX)
    
set_pev(entpev_controller_0125)
    
set_pev(entpev_controller_1125)
    
set_pev(entpev_controller_2125)
    
set_pev(entpev_controller_3125)
    
engfunc(EngFunc_SetModelentg_NpcModel)
    
engfunc(EngFunc_SetSizeent, {-15.0, -15.00.0 }, { 15.015.075.0 })
    
velocity_by_aim(id500velocity)
    
set_pev(entpev_velocityvelocity)
    
    
g_spawncount += 1
    
    set_pev
(entpev_nextthinkget_gametime() + 0.5)
    
set_task(1.0"ResetCooldown"TASK_COOLDOWN)
    
    return 
PLUGIN_HANDLED;

__________________
http://steamcommunity.com/profiles/76561198044821965
=========Working On Naruto Mod========
Zaidbt is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 04-08-2015 , 10:06   Re: Movetype_walk
Reply With Quote #2

Give us the entthink please.
__________________
Shiina.Mashiro is offline
Zaidbt
Senior Member
Join Date: Jun 2014
Location: Morroco
Old 04-08-2015 , 12:12   Re: Movetype_walk
Reply With Quote #3

What do u mean By entthink ?
__________________
http://steamcommunity.com/profiles/76561198044821965
=========Working On Naruto Mod========
Zaidbt is offline
Kiske
Veteran Member
Join Date: May 2009
Old 04-08-2015 , 12:19   Re: Movetype_walk
Reply With Quote #4

Quote:
#define MOVETYPE_WALK 3 // Player only - moving on the ground
__________________


Last edited by Kiske; 04-08-2015 at 12:20.
Kiske is offline
Send a message via Skype™ to Kiske
Old 04-08-2015, 12:20
Kiske
This message has been deleted by Kiske.
Old 04-08-2015, 13:43
Zaidbt
This message has been deleted by Zaidbt.
Zaidbt
Senior Member
Join Date: Jun 2014
Location: Morroco
Old 04-08-2015 , 15:36   Re: Movetype_walk
Reply With Quote #5

Not wokring , Cs crash:same error
__________________
http://steamcommunity.com/profiles/76561198044821965
=========Working On Naruto Mod========
Zaidbt is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 04-09-2015 , 01:53   Re: Movetype_walk
Reply With Quote #6

why could you make this when you don't even know which part is entity think
btw try with MOVETYPE_STEP
__________________
Shiina.Mashiro is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 04-09-2015 , 02:21   Re: Movetype_walk
Reply With Quote #7

It's just for players. I guess you don't know at all why you set that value to that entity.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Zaidbt
Senior Member
Join Date: Jun 2014
Location: Morroco
Old 04-09-2015 , 06:56   Re: Movetype_walk
Reply With Quote #8

#Shiina , it's not my Code . #MetaliCross , i dont get it .. Then it's impossible to make it move like a real Player ( i'm trying here to make a clone of a Player ) .. Ty
__________________
http://steamcommunity.com/profiles/76561198044821965
=========Working On Naruto Mod========
Zaidbt is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 04-09-2015 , 09:59   Re: Movetype_walk
Reply With Quote #9

maybe it's not your code but at least you must know which is the entity think part :/
btw try with MOVETYPE_STEP or MOVETYPE_PUSHSTEP, if the error still occur you can give me the entity think part
__________________
Shiina.Mashiro is offline
Zaidbt
Senior Member
Join Date: Jun 2014
Location: Morroco
Old 04-09-2015 , 10:20   Re: Movetype_walk
Reply With Quote #10

Quote:
Originally Posted by Shiina.Mashiro View Post
maybe it's not your code but at least you must know which is the entity think part :/
btw try with MOVETYPE_STEP or MOVETYPE_PUSHSTEP, if the error still occur you can give me the entity think part
It's working with other MOVETYPES , STep , pushtep , fly , bounce etc .. but not WALK , here's the full code
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#define TASK_COOLDOWN 7208
#define TASK_REMOVE 8072
#define ID_REMOVE (taskid - TASK_REMOVE)

const MAX_SPAWN 32
new g_cooldown
new g_spawncount
new g_dead[256]
new 
g_follow

new const g_NpcClassName[] = "ent_npc"

new const g_NpcModel[] = "models/narutomod/wall.mdl"

new const g_NpcSoundPain[][] = 
{
    
"barney/ba_pain1.wav"
}

new const 
g_NpcSoundDeath[][] =
{
    
"barney/ba_die1.wav"
}

new 
spr_blood_dropspr_blood_spray

public plugin_precache()
{
    
spr_blood_drop precache_model("sprites/blood.spr")
    
spr_blood_spray precache_model("sprites/bloodspray.spr")
    
    new 
i
    
for(sizeof g_NpcSoundPain i++) precache_sound(g_NpcSoundPain[i]);
    for(
sizeof g_NpcSoundDeath i++) precache_sound(g_NpcSoundDeath[i]);
    
    
precache_model(g_NpcModel)
}

public 
plugin_init()
{
    
register_plugin("Bouncing Barney""1.0""Mazza")
    
    
register_clcmd("say /npc""clcmd_npc")
    
register_clcmd("say /follow""clcmd_follow")
    
    
RegisterHam(Ham_TakeDamage"info_target""npc_TakeDamage")
    
RegisterHam(Ham_Killed"info_target""npc_Killed")
    
RegisterHam(Ham_Think"info_target""npc_Think")
    
RegisterHam(Ham_TraceAttack"info_target""npc_TraceAttack")
}

public 
clcmd_npc(id)
{
    if(
g_cooldown) return PLUGIN_HANDLED;
    
    if(
g_spawncount >= MAX_SPAWN)
    {
        
client_print(idprint_chat"[EntTest] Max [%i] spawns has been reach."MAX_SPAWN)
        return 
PLUGIN_HANDLED;
    }
    
    
g_cooldown 1
    
    
new ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    if(!
pev_valid(ent)) return PLUGIN_HANDLED;
    
    
set_pev(entpev_classnameg_NpcClassName)
    
set_pev(entpev_netname"Barney")
    new 
Floatorigin[3], Floatangle[3], Floatvelocity[3]
    
pev(idpev_originorigin)
    
origin[2] += 80.0
    engfunc
(EngFunc_SetOriginentorigin)
    
pev(idpev_anglesangle)
    
angle[0] = 0.0
    set_pev
(entpev_anglesangle)
    
set_pev(entpev_takedamage1.0)
    
set_pev(entpev_health100.0)
    
set_pev(entpev_gravity1.0)
    
set_pev(entpev_movetypeMOVETYPE_PUSHSTEP)
    
set_pev(entpev_solidSOLID_SLIDEBOX)
    
set_pev(entpev_controller_0125)
    
set_pev(entpev_controller_1125)
    
set_pev(entpev_controller_2125)
    
set_pev(entpev_controller_3125)
    
engfunc(EngFunc_SetModelentg_NpcModel)
    
engfunc(EngFunc_SetSizeent, {-12.0, -12.00.0 }, { 12.012.075.0 })
    
velocity_by_aim(id800velocity)
    
set_pev(entpev_velocityvelocity)
    
    
g_spawncount += 1
    
    set_pev
(entpev_nextthinkget_gametime() + 0.5)
    
set_task(1.0"ResetCooldown"TASK_COOLDOWN)
    
    return 
PLUGIN_HANDLED;
}

public 
clcmd_follow(id)

    
g_follow id
    
    
return PLUGIN_HANDLED;


public 
npc_TraceAttack(iEntattackerFloatdamageFloatdirection[3], tracedamageBits)
{
    if(!
pev_valid(iEnt)) return;
    
    new 
className[32]
    
pev(iEntpev_classnameclassNamecharsmax(className))
    
    if(!
equali(classNameg_NpcClassName)) return;
    
    new 
Floatend[3]
    
get_tr2(traceTR_vecEndPosend)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_BLOODSPRITE)
    
engfunc(EngFunc_WriteCoordend[0])
    
engfunc(EngFunc_WriteCoordend[1])
    
engfunc(EngFunc_WriteCoordend[2])
    
write_short(spr_blood_spray)
    
write_short(spr_blood_drop)
    
write_byte(247// color index
    
write_byte(random_num(15)) // size
    
message_end()
}

public 
npc_TakeDamage(iEntinflictorattackerFloat:damagebits)
{
    new 
className[32]
    
pev(iEntpev_classnameclassNamecharsmax(className))
    
    if(!
equali(classNameg_NpcClassName)) return;
    
    
Util_PlayAnimation(iEntrandom_num(1317), 1.25)
    
    
emit_sound(iEntCHAN_VOICEg_NpcSoundPain[random(sizeof g_NpcSoundPain)],  VOL_NORMATTN_NORM0PITCH_NORM)
}

public 
npc_Killed(iEnt)
{
    new 
className[32]
    
pev(iEntpev_classnameclassNamecharsmax(className))
    
    if(!
equali(classNameg_NpcClassName)) return HAM_IGNORED;
    
    
g_dead[iEnt] = 1
    
    Util_PlayAnimation
(iEntrandom_num(2530))
    
    
set_pev(iEntpev_solidSOLID_NOT)
    
    
emit_sound(iEntCHAN_VOICEg_NpcSoundDeath[random(sizeof g_NpcSoundDeath)],  VOL_NORMATTN_NORM0PITCH_NORM)
    
    
set_task(2.0"RemoveDeadEntity"iEnt+TASK_REMOVE)
    
    return 
HAM_SUPERCEDE;
}

public 
npc_Think(iEnt)
{
    if(!
pev_valid(iEnt)) return;
    
    static 
className[32]
    
pev(iEntpev_classnameclassNamecharsmax(className))
    
    if(!
equali(classNameg_NpcClassName)) return;
    
    if(
g_dead[iEnt]) return;
    
    if(
is_user_alive(g_follow)) entity_set_aim(iEntg_follow);
    
    
set_pev(iEntpev_nextthinkget_gametime() + 0.5)
}

public 
ResetCooldown(taskid)
{
    
g_cooldown 0
}

public 
RemoveDeadEntity(taskid)
{
    if(!
pev_valid(ID_REMOVE)) return;
    
    
engfunc(EngFunc_RemoveEntityID_REMOVE)
    
    
g_spawncount -= 1
    g_dead
[ID_REMOVE] = 0
}

entity_set_aim(entplayer

    static 
Float:origin[3], Float:ent_origin[3], Float:angles[3
    
pev(playerpev_originorigin
    
pev(entpev_originent_origin
     
    
xs_vec_sub(originent_originorigin
    
xs_vec_normalize(originorigin
    
vector_to_angle(originangles
     
    
angles[0] = 0.0 
     
    set_pev
(entpev_anglesangles)
    
set_velocity(entangles)


set_velocity(entFloat:angles[3]) 

    static 
FloatDirection[3
    
angle_vector(anglesANGLEVECTOR_FORWARDDirection
    
xs_vec_mul_scalar(Direction400.0Direction// 215 speed
    
set_pev(entpev_velocityDirection)
    
    
// Run Sequence
    
if(pev(entpev_sequence) != 5Util_PlayAnimation(ent5);
}

Util_PlayAnimation(indexsequenceFloatframerate 1.0)
{
    
set_pev(indexpev_animtimeget_gametime())
    
set_pev(indexpev_framerate,  framerate)
    
set_pev(indexpev_frame0.0)
    
set_pev(indexpev_sequencesequence)

BTW , How is it possible to Remove them using public logevent round end ? Ty
__________________
http://steamcommunity.com/profiles/76561198044821965
=========Working On Naruto Mod========
Zaidbt is offline
Reply



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 00:03.


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