MysticDreidel Posted April 19, 2015 Share Posted April 19, 2015 I am kinda knew to leadwerks and i have found a bow model i really like and i imported it and i was wondering how do u make it so u can use the bow and shoot arrows? srry im a noob but thx for the help good sirs/madams Quote Link to comment Share on other sites More sharing options...
CreativeOcclusion Posted April 19, 2015 Share Posted April 19, 2015 Make sure that you study the documentation and take as many tutorials as you can google. Take some tutorials on lua coding. Studying the scripts that come with Leadwerks is a real good start. There is a chance that someone here may have some bow and arrow code to share with you. Welcome to Leadwerks 1 Quote Link to comment Share on other sites More sharing options...
Haydenmango Posted April 19, 2015 Share Posted April 19, 2015 Some functions you'll probably use for shooting arrows include - Instance(), SetPosition(), SetRotation(), AddForce(),SetCollisionType(), SetMass() Shooting arrows works like this in my game, Hunt For Food - function Script:ShootArrow() local arrow=self.arrow:Instance() arrow.script.livetime=Time:GetCurrent()+15000 arrow.script.active=true arrow:SetMass(.5) arrow:SetPosition(Transform:Point(0,0,.75,player.camera,nil)) arrow:SetRotation(-player.camRotation.x-90,player.camera:GetRotation(true).y+180,-player.camRotation.z) arrow:AddForce(0,1250,0,false) end I should also note that my arrows have a script to deal damage on collision. The script looks something like this - function Script:Collision(entity,position,normal,speed) if self.active==true then self.active=false if entity.script then if entity.script.hurtable==true then self.entity:SetCollisionType(Collision.None) self.entity:SetMass(0) self.entity:SetShape(nil) self.entity:SetPosition(position) self.entity:SetParent(entity) if entity.script.health>0 then entity.script:Hurt(math.random(5,8.5),player) end self.livetime=Time:GetCurrent()+3000 end end end end I hope this helps! 3 Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
MysticDreidel Posted April 21, 2015 Author Share Posted April 21, 2015 thx for the smart advice creativeocclusion lol. thx for the info. and a litttle bit of help with code haydenmango Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.