|
| |||||||
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Advanced Member ![]() Join Date: Mar 2008
Posts: 107
![]() | Hey guys, I'm not quite sure if this is the right place to put this - but can someone make a simple wire thing in lua that would add up the masses of all the objects constrained to it. Thanks! |
| | |
| Sponsored Links | |
| | #2 (permalink) | |
| Advanced Member ![]() Join Date: May 2008
Posts: 179
![]() | i think some one was working on an 'object gate' that you link to an prop, and it will output weight, damage etc. and you can input things like RGB values to change its colour and there was a way to change its pysical properties and it model. I'll see if i can dig it up for you, or if they ever actually finished it
__________________ Linux is like wigwam - no windows, no gates, and an apache inside Quote:
| |
| | |
| | #3 (permalink) | ||
| UWSVN Contributor ![]() | Well here we go... Code: function TOOL:LeftClick( trace )
if (SERVER) then
if trace.HitNonWorld then
local attached = duplicator.GetAllConstrainedEntitiesAndConstraints(trace.Entity, {},{} ) or {}
attached[trace.Entity:EntIndex()] = trace.Entity
local AddedWeight
for _,Ent in pairs(attached) do
if Ent:IsValid() then //Check if the constrained entites are valid
if Ent:GetClass() == "prop_physics" || Ent:GetClass() == "prop_ragdoll" || Ent:GetClass() == "gmod_thruster" || Ent:GetClass() == "gmod_wheel"
|| Ent:GetClass() == "gmod_thruster" || Ent:GetClass() == "gmod_cameraprop" || Ent:GetClass() == "gmod_rtcameraprop"
|| Ent:GetClass() == "gmod_turret" || Ent:GetClass() == "gmod_lamp" || Ent:GetClass() == "gmod_button"
|| Ent:GetClass() == "prop_vehicle_jeep" || Ent:GetClass() == "prop_vehicle_prisoner_pod" || Ent:GetClass() == "prop_vehicle_airboat"
|| Ent:GetClass() == "gmod_nail" || Ent:GetClass() == "gmod_emitter" || Ent:GetClass() == "sent_ball"
|| Ent:GetClass() == "npc_rollermine" || Ent:GetClass() == "npc_manhack" || Ent:GetClass() == "npc_cscanner"
then
local phys = Ent:GetPhysicsObject()
AddedWeight = AddedWeight + (phys:GetMass()) //This variable adds to itself every ent's mass
end
end
end
end
end
return true
end
This is it in partial stool form btw or did you mean an entity?
__________________ Quote:
Quote:
IF ALL ELSE FAILS THEN READ THIS BEFORE MAKING A HELP THREAD Remember to ask me for cpu help if you need it, just pm me with your situation and/or problem code Last edited by Hitman271; 10-19-2008 at 11:10 AM.. Reason: O Sh!t | ||
| | |
| | #4 (permalink) |
| Advanced Member ![]() Join Date: Mar 2008
Posts: 107
![]() | Does that output on the screen what the entire weight is? Sorry, I'm not very good with lua... But I'm thinking about a siren model or something that takes the constrained objects' weights (including the siren model or whatever it is) and outputs it so I can make an egate that takes that into consideration when using thrusters. |
| | |
| | #5 (permalink) | ||
| UWSVN Contributor ![]() | No, that is STOOL code not ENTITY code per se. You will have to shape that code to your own likings and needs as I won't. The AddedWeight variable in that code adds all the weights from whatever object got hit by the stool and stores it.
__________________ Quote:
Quote:
IF ALL ELSE FAILS THEN READ THIS BEFORE MAKING A HELP THREAD Remember to ask me for cpu help if you need it, just pm me with your situation and/or problem code | ||
| | |
| | #7 (permalink) | ||
| UWSVN Contributor ![]() | Well you asked this in the LUA section so I gave you LUA. Goto the weapons part in any addon and read up on the code for STOOLS. They are quite useful...
__________________ Quote:
Quote:
IF ALL ELSE FAILS THEN READ THIS BEFORE MAKING A HELP THREAD Remember to ask me for cpu help if you need it, just pm me with your situation and/or problem code | ||
| | |
| Sponsored Links | |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|