• Spawn a ragdoll and make it stand
    9 replies, posted
Hi Im trying to spawn a ragdoll at a certain pos on the map and make it stand in a normal postion, standing up, looks forward and has his arms and hands down. How can i make this?
ive managed to make it spawn in the right pos, but how do i freeze the ragdoll?
[b][url=wiki.garrysmod.com/?title=PhysObj.EnableMotion]PhysObj.EnableMotion [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] Possibly?
Well there is a console command for this, not sure if it will help [code] ent_fire yourent setanimation animationname [/code] You can find the animation name in hammer. For more info look at this vid at around 2:45 [url]http://www.youtube.com/watch?v=OPUkX8Ow4hw&feature=player_embedded#[/url] Snip - Maybe this. [b][url=wiki.garrysmod.com/?title=Entity.SetSequence]Entity.SetSequence [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Why not just spawn a NPC?
i want to make this. Spawn maybe a NPC with unlimeted health. The NPC cant move it just stands on one place. when i press E on it, it will pop up a derma screen. Do anyone know how to do this. im not asking u to do it just asking for help.
Well to make it open a derma menu you would use the ENT:Use and make the client run a console command which opens the menu. So something like this [lua] ENT:Use(activator, caller) activator:ConCommand("yourconcommand") end [/lua] Clientside you would then have the derma and a console command called "yourconcommand". To make it have unlimited health I think that you can return false on ENT:OnTakeDamage, or just use ENT:SetHealth(99999999999). To make the npc just use [lua] ents.Create("npc_citizen") [/lua] Not sure how to make it not move though, maybe set it's schedule to nil or something, I haven't tried anything with NPCs before so I don't know. By the way are you making an NPC shop? Lots of people have been doing that recently.
[QUOTE=sintwins;20398105] -Snip- [/QUOTE] Usermessages are so much better for this than a console command [b][url=wiki.garrysmod.com/?title=Usermessage.Hook]Usermessage.Hook [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Yep you're right lol :)
ok thanks i made a code for the npc but it want come to the spawn menu and when i tries to use lua to spawn it, it wount spawn. i used this tutorial: [URL]http://wiki.garrysmod.com/?title=Basic_Scripted_NPC[/URL] cl_init.lua [PHP]include('shared.lua') ENT.RenderGroup = RENDERGROUP_BOTH /*--------------------------------------------------------- Name: Draw Desc: Draw it! ---------------------------------------------------------*/ function ENT:Draw() self.Entity:DrawModel() end /*--------------------------------------------------------- Name: DrawTranslucent Desc: Draw translucent ---------------------------------------------------------*/ function ENT:DrawTranslucent() // This is here just to make it backwards compatible. // You shouldn't really be drawing your model here unless it's translucent self:Draw() end /*--------------------------------------------------------- Name: BuildBonePositions Desc: ---------------------------------------------------------*/ function ENT:BuildBonePositions( NumBones, NumPhysBones ) // You can use this section to position the bones of // any animated model using self:SetBonePosition( BoneNum, Pos, Angle ) // This will override any animation data and isn't meant as a // replacement for animations. We're using this to position the limbs // of ragdolls. end /*--------------------------------------------------------- Name: SetRagdollBones Desc: ---------------------------------------------------------*/ function ENT:SetRagdollBones( bIn ) // If this is set to true then the engine will call // DoRagdollBone (below) for each ragdoll bone. // It will then automatically fill in the rest of the bones self.m_bRagdollSetup = bIn end /*--------------------------------------------------------- Name: DoRagdollBone Desc: ---------------------------------------------------------*/ function ENT:DoRagdollBone( PhysBoneNum, BoneNum ) // self:SetBonePosition( BoneNum, Pos, Angle ) end function npc_talk_serv() local mainmenu = vgui.Create( "DFrame" ) --creates menu mainmenu:SetPos( ScrW() / 2 - 300, ScrH() / 2 - 300 ) --position of menu (ScrW and ScrH mean Screen Width and Screen Height.) mainmenu:SetSize( 600, 600 ) --size of menu mainmenu:SetTitle( "Welcome to "..GetConVar("hostname")..". Please, enjoy your stay." ) --title of menu (top) mainmenu:SetVisible( true ) --visable? mainmenu:SetDraggable( false ) --draggable? mainmenu:MakePopup() --popup? mainmenu:ShowCloseButton( true ) --show close button? local menutabs = vgui.Create( "DPropertySheet" ) --menutabs menutabs:SetParent( mainmenu ) menutabs:SetPos( 10, 30 ) menutabs:SetSize( 580, 560 ) local welcomepanel = vgui.Create("DPanel") welcomepanel:SetSize( 550, 480 ) local welcometext = vgui.Create( "DTextEntry" ) welcometext:SetParent( welcomepanel ) welcometext:SetPos( 10,50 ) welcometext:SetTall( 380 ) welcometext:SetWide( 530 ) welcometext:SetDrawBackground( false ) welcometext:SetDrawBorder( false ) welcometext:SetEditable( false ) welcometext:SetEnterAllowed( false ) welcometext:SetMultiline( true ) local text = {} text[1] = ( "Welcome to "..GetConVar("hostname").." have fun!")\n\n" ) -- Displays the hostname and other text put there. text[2] = ( "\n\n" ) --"\n" means new line text[3] = ( "\n\n" ) text[4] = ( "\n\n" ) text[5] = ( "\n\n" ) text[6] = ( "Rules:\n\n" ) text[7] = ( "No Racism\n" ) text[8] = ( "No Cussing\n" ) text[9] = ( "No Spam (Mic, Chat, Etc)\n" ) text[10] = ( "\n" ) text[11] = ( "Obey Superiors\n\n" ) text[12] = ( "If these rules aren't implied, you will be punished." ) text[13] = ( "Thank you for playing on "..GetConVar("hostname") ) welcometext:SetText(table.concat(text)) menutabs:AddSheet( "Welcome", welcomepanel, "gui/silkicons/exclamation", false, false, "Welcome, please enjoy your stay." ) end[/PHP]init.lua [PHP]ENT.Base = "base_ai" ENT.Type = "ai" ENT.PrintName = "Script Breen" ENT.Author = "Yuriman" ENT.Contact = "Yuriman" //fill in these if you want it to be in the spawn menu ENT.Purpose = "Talk to" ENT.Instructions = "Press \"USE\" button on him" ENT.AutomaticFrameAdvance = true /*--------------------------------------------------------- Name: OnRemove Desc: Called just before entity is deleted ---------------------------------------------------------*/ function ENT:OnRemove() end /*--------------------------------------------------------- Name: PhysicsCollide Desc: Called when physics collides. The table contains data on the collision ---------------------------------------------------------*/ function ENT:PhysicsCollide( data, physobj ) end /*--------------------------------------------------------- Name: PhysicsUpdate Desc: Called to update the physics .. or something. ---------------------------------------------------------*/ function ENT:PhysicsUpdate( physobj ) end /*--------------------------------------------------------- Name: SetAutomaticFrameAdvance Desc: If you're not using animation you should turn this off - it will save lots of bandwidth. function ENT:SetAutomaticFrameAdvance( bUsingAnim ) self.AutomaticFrameAdvance = bUsingAnim end ---------------------------------------------------------*/[/PHP]
Sorry, you need to Log In to post a reply to this thread.