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

Solved How to smoothly move runtime model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-20-2019 , 12:38   How to smoothly move runtime model
Reply With Quote #1

Hi,
Code:
void Fly(int target)
{
	float resulting[3];
	resulting[2] = 300.0; // Y-axis
	TeleportEntity(target, NULL_VECTOR, NULL_VECTOR, resulting);
}
This code do what I want with survivor client.

But it is not work with the entity, spawned in runtime:

Code:
int AttachSoul(int target)
{
	float vLoc[3];
	GetClientAbsOrigin(target, vLoc);
	vLoc[2] += 10.0; // Y-axis
	
	int entity = CreateEntityByName("prop_dynamic"); // CDynamicProp
	DispatchKeyValue(entity, "targetname", "fake_ragdoll");
	DispatchKeyValue(entity, "spawnflags", "0");
	DispatchKeyValue(entity, "solid", "0");
	DispatchKeyValue(entity, "model", "models/survivors/survivor_biker.mdl");
	DispatchSpawn(entity);
	TeleportEntity(entity, vLoc, NULL_VECTOR, NULL_VECTOR);
	
	SetVariantString("OnUser1 !self:Kill::5.0:1");
	AcceptEntityInput(entity, "AddOutput");
	AcceptEntityInput(entity, "FireUser1");
	
	SetEntityMoveType(entity, MOVETYPE_WALK);
	SetEntityGravity(entity, 1.0);
	//SetEntityFlags(entity, 65535);
	
	Fly(entity);
	
	return entity;
}
What entity should I use?
Or what property should I set for "prop_dynamic" to allow using velocity in teleport?

Thanks.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 01-24-2019 at 11:50.
Dragokas is offline
adma
Senior Member
Join Date: Oct 2015
Old 01-20-2019 , 20:58   Re: How to smoothly move runtime model
Reply With Quote #2

Try use MOVETYPE_VPHYSICS instead of MOVETYPE_WALK
adma is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 01-20-2019 , 23:28   Re: How to smoothly move runtime model
Reply With Quote #3

https://forums.alliedmods.net/showthread.php?t=272428
__________________
8guawong is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-21-2019 , 12:43   Re: How to smoothly move runtime model
Reply With Quote #4

adma, thank you. It did not help.

Code:
int AttachSoul(int target)
{
	float vLoc[3], vAng[3];
	GetClientAbsOrigin(target, vLoc);
	GetClientEyeAngles(target, vAng);
	vLoc[0] += 100.0;
	vLoc[2] += 30.0; // Y-axis
	vAng[0] = 270.0; // horizontal, face up
	
	char sModel[64]; // clone model
	GetEntPropString(target, Prop_Data, "m_ModelName", sModel, sizeof(sModel));
	
	int entity = CreateEntityByName("prop_dynamic"); // CDynamicProp
	DispatchKeyValue(entity, "targetname", "fake_ragdoll");
	DispatchKeyValue(entity, "spawnflags", "0");
	DispatchKeyValue(entity, "solid", "0");
	DispatchKeyValue(entity, "disableshadows", "1");
	DispatchKeyValue(entity, "rendermode", "1");
	DispatchKeyValue(entity, "renderamt", "100");
	DispatchKeyValue(entity, "rendercolor", "255 255 255");
	DispatchKeyValue(entity, "disablereceiveshadows", "1");
	DispatchKeyValue(entity, "model", sModel);
	DispatchSpawn(entity);
	TeleportEntity(entity, vLoc, vAng, NULL_VECTOR);
	AcceptEntityInput(entity, "TurnOn");
	
	SetVariantString("OnUser1 !self:Kill::5.0:1");
	AcceptEntityInput(entity, "AddOutput");
	AcceptEntityInput(entity, "FireUser1");
	
	SetEntityMoveType(entity, MOVETYPE_VPHYSICS);
	SetEntityGravity(entity, 1.0);
	//SetEntityFlags(entity, 65535);
	
	float vVel[3] = {100.0, 100.0, 100.0}; // just for test
	
	SetEntPropVector(entity, Prop_Data, "m_vecBaseVelocity", vVel);
	SetEntPropVector(entity, Prop_Data, "m_vecAbsVelocity", vVel);
	SetEntPropVector(entity, Prop_Data, "m_vecAngVelocity", vVel);
	SetEntPropVector(entity, Prop_Data, "m_vecVelocity", vVel);	
	
	// "BecomeRagdoll" action - to fall down
	
	CreateTimer(1.0, tmrFly, entity, TIMER_FLAG_NO_MAPCHANGE);
	//Fly(entity);
	
	return entity;
}

public Action tmrFly(Handle timer, int ent)
{
	Fly(ent);
}

void Fly(int target)
{
	float resulting[3];
	resulting[2] = 600.0; // Y-axis
	TeleportEntity(target, NULL_VECTOR, NULL_VECTOR, resulting);
}
8guawong, thank you. I will try suggestion with truck train.

Maybe, somewhere similar plugin exist?
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 01-21-2019 at 12:43.
Dragokas is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 01-21-2019 , 19:44   Re: How to smoothly move runtime model
Reply With Quote #5

Quote:
Originally Posted by Dragokas View Post
adma, thank you. It did not help.

Code:
int AttachSoul(int target)
{
	float vLoc[3], vAng[3];
	GetClientAbsOrigin(target, vLoc);
	GetClientEyeAngles(target, vAng);
	vLoc[0] += 100.0;
	vLoc[2] += 30.0; // Y-axis
	vAng[0] = 270.0; // horizontal, face up
	
	char sModel[64]; // clone model
	GetEntPropString(target, Prop_Data, "m_ModelName", sModel, sizeof(sModel));
	
	int entity = CreateEntityByName("prop_dynamic"); // CDynamicProp
	DispatchKeyValue(entity, "targetname", "fake_ragdoll");
	DispatchKeyValue(entity, "spawnflags", "0");
	DispatchKeyValue(entity, "solid", "0");
	DispatchKeyValue(entity, "disableshadows", "1");
	DispatchKeyValue(entity, "rendermode", "1");
	DispatchKeyValue(entity, "renderamt", "100");
	DispatchKeyValue(entity, "rendercolor", "255 255 255");
	DispatchKeyValue(entity, "disablereceiveshadows", "1");
	DispatchKeyValue(entity, "model", sModel);
	DispatchSpawn(entity);
	TeleportEntity(entity, vLoc, vAng, NULL_VECTOR);
	AcceptEntityInput(entity, "TurnOn");
	
	SetVariantString("OnUser1 !self:Kill::5.0:1");
	AcceptEntityInput(entity, "AddOutput");
	AcceptEntityInput(entity, "FireUser1");
	
	SetEntityMoveType(entity, MOVETYPE_VPHYSICS);
	SetEntityGravity(entity, 1.0);
	//SetEntityFlags(entity, 65535);
	
	float vVel[3] = {100.0, 100.0, 100.0}; // just for test
	
	SetEntPropVector(entity, Prop_Data, "m_vecBaseVelocity", vVel);
	SetEntPropVector(entity, Prop_Data, "m_vecAbsVelocity", vVel);
	SetEntPropVector(entity, Prop_Data, "m_vecAngVelocity", vVel);
	SetEntPropVector(entity, Prop_Data, "m_vecVelocity", vVel);	
	
	// "BecomeRagdoll" action - to fall down
	
	CreateTimer(1.0, tmrFly, entity, TIMER_FLAG_NO_MAPCHANGE);
	//Fly(entity);
	
	return entity;
}

public Action tmrFly(Handle timer, int ent)
{
	Fly(ent);
}

void Fly(int target)
{
	float resulting[3];
	resulting[2] = 600.0; // Y-axis
	TeleportEntity(target, NULL_VECTOR, NULL_VECTOR, resulting);
}
8guawong, thank you. I will try suggestion with truck train.

Maybe, somewhere similar plugin exist?
https://forums.alliedmods.net/showth...ght=Helicopter
__________________
8guawong is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-24-2019 , 11:50   Re: How to smoothly move runtime model
Reply With Quote #6

8guawong and Mehis. Thanks very match.
Everything work very well.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas 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 20:20.


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