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

Creating a rope entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-22-2010 , 00:32   Creating a rope entity
Reply With Quote #1

Does anyone have a script for creating a simple rope entity?
__________________
almcaeobtac is offline
übersoldat
Member
Join Date: Jun 2010
Old 08-22-2010 , 00:46   Re: Creating a rope entity
Reply With Quote #2

in hammer, the entity is called move_rope and is paired with a keyframe_rope. setting the move ropes next key frame to the keyframe rope. for this you would need to name both. you might want to add slack as well, the default is 25, but you can adjust it.
übersoldat is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-22-2010 , 14:15   Re: Creating a rope entity
Reply With Quote #3

I did that, It didn't work.
__________________
almcaeobtac is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 08-22-2010 , 15:48   Re: Creating a rope entity
Reply With Quote #4

Try editing netprops. For example spawning env_beam was a huge pain in ass.
FaTony is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-22-2010 , 22:38   Re: Creating a rope entity
Reply With Quote #5

Does anyone have a script that successfully spawns a rope?
__________________
almcaeobtac is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 08-24-2010 , 01:38   Re: Creating a rope entity
Reply With Quote #6

Quote:
Originally Posted by almcaeobtac View Post
I did that, It didn't work.
Quote:
Originally Posted by almcaeobtac View Post
Does anyone have a script that successfully spawns a rope?
Show us the code you wrote.
__________________
asherkin is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 08-25-2010 , 17:29   Re: Creating a rope entity
Reply With Quote #7

Ok

Code:
public CreateWire(Part1, Part2)
{
	decl Float:Org1[3];
	decl Float:Org2[3];
	decl String:Origin1[128];
	decl String:Origin2[128];

	GetEntPropVector(Part1, Prop_Data, "m_vecOrigin", Org1);
	GetEntPropVector(Part2, Prop_Data, "m_vecOrigin", Org2);

	Format(Origin1, 128, "%f %f %f", Org1[0], Org1[1], Org1[2]);
	Format(Origin2, 128, "%f %f %f", Org2[0], Org2[1], Org2[2]);

	new Rope1 = CreateEntityByName("move_rope");
	new Rope2 = CreateEntityByName("keyframe_rope");

	decl String:Name1[64];
	decl String:Name2[64];
	decl String:PartName1[64];
	decl String:PartName2[64];

	Format(Name1, 64, "compwire_%d", Rope1);
	Format(Name2, 64, "compwire_%d", Rope2);
	Format(PartName1, 64, "comppart_%d", Part1);
	Format(PartName2, 64, "comppart_%d", Part2);

	DispatchKeyValue(Part1, "targetname", PartName1);
	DispatchKeyValue(Part2, "targetname", PartName2);

	DispatchKeyValue(Rope1, "MoveSpeed", "64");
	DispatchKeyValue(Rope1, "Slack", "25");
	DispatchKeyValue(Rope1, "Subdiv", "2");
	DispatchKeyValue(Rope1, "Width", "1");
	DispatchKeyValue(Rope1, "TextureScale", "1");
	DispatchKeyValue(Rope1, "RopeMaterial", "cable/cable.vmt");
	DispatchKeyValue(Rope1, "PositionInterpolator", "2");
	DispatchKeyValue(Rope1, "targetname", Name1);
	DispatchKeyValue(Rope1, "NextKey", Name2);
	DispatchKeyValue(Rope1, "origin", Origin1);
	
	DispatchKeyValue(Rope2, "MoveSpeed", "64");
	DispatchKeyValue(Rope2, "Slack", "25");
	DispatchKeyValue(Rope2, "Subdiv", "2");
	DispatchKeyValue(Rope2, "Width", "1");
	DispatchKeyValue(Rope2, "TextureScale", "1");
	DispatchKeyValue(Rope2, "RopeMaterial", "cable/cable.vmt");
	DispatchKeyValue(Rope2, "PositionInterpolator", "2");
	DispatchKeyValue(Rope2, "targetname", Name2);
	DispatchKeyValue(Rope2, "origin", Origin2);

	DispatchSpawn(Rope1);
	DispatchSpawn(Rope2);

	//SetVariantString(PartName1);
	//AcceptEntityInput(Rope1, "SetParent");

	//SetVariantString(PartName2);
	//AcceptEntityInput(Rope2, "SetParent");

	WireEntity[1][Part1][Part2] = Rope1;
	WireEntity[2][Part1][Part2] = Rope2;
	WireEntity[1][Part2][Part1] = Rope2;
	WireEntity[2][Part2][Part1] = Rope1;

	return;
}
It wasn't working with the parenting, so I removed it to see if it would at least spawn in the right place for me. It didn't.
__________________
almcaeobtac is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 08-25-2010 , 18:07   Re: Creating a rope entity
Reply With Quote #8

I've had some trouble with the origin keyvalue before try using TeleportEntity?
__________________
McFlurry is offline
Send a message via Skype™ to McFlurry
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 08-25-2010 , 20:04   Re: Creating a rope entity
Reply With Quote #9

Check out a stripper dump first on what information exactly is in the needed entities.
AtomicStryker is offline
dirtyminuth
Senior Member
Join Date: Sep 2009
Old 08-26-2010 , 13:53   Re: Creating a rope entity
Reply With Quote #10

Just throwing this out there, but CreateEntityByName() for move_rope and keyframe_rope may be returning an entity reference, not an index. Use EntIndexToEntRef() to solve this issue. I ran into a similar problem trying to create a filter_activator_tfteam.

To know for sure, try printing Name1 and Name2 strings.
__________________
dirtyminuth 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:21.


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