AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Creating a rope entity (https://forums.alliedmods.net/showthread.php?t=136017)

almcaeobtac 08-22-2010 00:32

Creating a rope entity
 
Does anyone have a script for creating a simple rope entity?

übersoldat 08-22-2010 00:46

Re: Creating a rope entity
 
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.

almcaeobtac 08-22-2010 14:15

Re: Creating a rope entity
 
I did that, It didn't work.

FaTony 08-22-2010 15:48

Re: Creating a rope entity
 
Try editing netprops. For example spawning env_beam was a huge pain in ass.

almcaeobtac 08-22-2010 22:38

Re: Creating a rope entity
 
Does anyone have a script that successfully spawns a rope?

asherkin 08-24-2010 01:38

Re: Creating a rope entity
 
Quote:

Originally Posted by almcaeobtac (Post 1278948)
I did that, It didn't work.

Quote:

Originally Posted by almcaeobtac (Post 1279365)
Does anyone have a script that successfully spawns a rope?

Show us the code you wrote. :3

almcaeobtac 08-25-2010 17:29

Re: Creating a rope entity
 
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.

McFlurry 08-25-2010 18:07

Re: Creating a rope entity
 
I've had some trouble with the origin keyvalue before try using TeleportEntity?

AtomicStryker 08-25-2010 20:04

Re: Creating a rope entity
 
Check out a stripper dump first on what information exactly is in the needed entities.

dirtyminuth 08-26-2010 13:53

Re: Creating a rope entity
 
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.


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

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