Jump to content

Recommended Posts

Posted

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?

Posted

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

Posted

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.

Posted

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.)

Posted

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.

Posted

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.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...