acd009 Posted December 20, 2014 Share Posted December 20, 2014 I have have been trying make a object in my game switch its mass to 0 when i hit a button. I am very new to leadwerks and dont know much about scripting but the very basics. I found a script for doing this on one of aggor/ricks forums and for some reason it redirects me to a page that says sorry can not find that file. Did he remove the file or is there just something wrong with the page? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 20, 2014 Share Posted December 20, 2014 Looks like the gravity activator script is no longer there.However setting a mass is really easy: self.entity:SetMass(1) http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetmass-r74 Quote Link to comment Share on other sites More sharing options...
acd009 Posted December 20, 2014 Author Share Posted December 20, 2014 Is there a way to change a objects collision type in game using a script? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 20, 2014 Share Posted December 20, 2014 http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetcollisiontype-r35 Quote Link to comment Share on other sites More sharing options...
acd009 Posted December 21, 2014 Author Share Posted December 21, 2014 i ment like when you hit a button or lever Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 21, 2014 Share Posted December 21, 2014 Can you elaborate what you mean with button? Keyboard button or something ingame. If you have a partial script please post it. Quote Link to comment Share on other sites More sharing options...
acd009 Posted December 21, 2014 Author Share Posted December 21, 2014 i mean if you were to use the collision trigger or collision button already in leadwerks. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 21, 2014 Share Posted December 21, 2014 Do you work with the flowgraph editor? If you want to use a script and you want to set mass and collisiontype via script then use this: function Script:Start() self.entity1:SetMass(1) self.entity1:SetCollisionType(Collision.Prop) end Quote Link to comment Share on other sites More sharing options...
acd009 Posted December 21, 2014 Author Share Posted December 21, 2014 how do i add imput to make it work with the flowgraph editor? Like if I want to connect it to a lever with one of the collision scripts using the flowgraph editor. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 23, 2014 Share Posted December 23, 2014 Have you seen this video tutorial? : Quote Link to comment Share on other sites More sharing options...
acd009 Posted December 23, 2014 Author Share Posted December 23, 2014 Should I have the the script be called by in script start or update world or what? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 23, 2014 Share Posted December 23, 2014 Not really sure what you are asking in the post above. This is how I would do it: You have a button with a buttonscript. You have a rock/box with a ActivateMassScript. The rock/box has a mass higher than 0 and is of collision type prop. The button script has a Flowgraph output called "button pressed". The massScript has an input function called "ActivateMass" (or a name that you find usefull) Inside the flowgraph editor you hook the output to the input. The massScript: The Start function has saves the current mass to a temp variable and sets the current mass to 0. The ActivateMass function sets the mass back to original value, which is stored in the temp value. (instead of swapping the mass value, we can also set different collision types. it realy depends on what you find most useful.) Quote Link to comment Share on other sites More sharing options...
acd009 Posted December 24, 2014 Author Share Posted December 24, 2014 In my game I have logs (are collected from trees) and I have the same script that allows you to pick up barrels in the tutorial maps attached that makes them able to be picked up and I need that script so you can build shelters. How could I make the logs have two scripts. I tried using pivots but it doesnt work. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 24, 2014 Share Posted December 24, 2014 You can either merge the scripts or use pivots. With pivots you do have to take in to account that the parent of the pivot is the object you want to retrieve first, because the pivot itself is nothing but a point in space. Quote Link to comment Share on other sites More sharing options...
acd009 Posted December 25, 2014 Author Share Posted December 25, 2014 So if I make the log the parent will it work Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 25, 2014 Share Posted December 25, 2014 Can you post the scripts you are using? 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.