Go Back   Wiremod Forums > Wiremod Adv. Skills > Wiremod Lua Coding

Reply
 
LinkBack Thread Tools Display Modes
Old 10-18-2008   #1 (permalink)
Advanced Member
 
mjmr89's Avatar
 

Join Date: Mar 2008
Posts: 107
mjmr89 is on a distinguished road
Default Something that can add up all the masses of the constrained objects

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!
mjmr89 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 10-18-2008   #2 (permalink)
Advanced Member
 
Squeakyneb's Avatar
 

Join Date: May 2008
Posts: 179
Squeakyneb is on a distinguished road
Default Re: Something that can add up all the masses of the constrained objects

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:
Originally Posted by Koolguy007 View Post
I know how you wire gurus love logic and electronics so when I saw this I figured you would like it. Atanua - About
Squeakyneb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-19-2008   #3 (permalink)
UWSVN Contributor
 
Hitman271's Avatar
 

Join Date: Feb 2008
Location: Alabama, USA
Posts: 385
Hitman271 is on a distinguished road
Send a message via Yahoo to Hitman271
Default Re: Something that can add up all the masses of the constrained objects

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
BAM!!!!!!!!!!!!!!!!!

This is it in partial stool form btw or did you mean an entity?
__________________
Quote:
Originally Posted by Anticept View Post
It is not some place where you can toss your dick around and expect people to suck it.
Quote:
Originally Posted by Black Phoenix on Fixing the Gpu
When I get laid
READ AND GET SEXAH PRONZ OR DONT AN GET BANNED

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
Hitman271 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-19-2008   #4 (permalink)
Advanced Member
 
mjmr89's Avatar
 

Join Date: Mar 2008
Posts: 107
mjmr89 is on a distinguished road
Default Re: Something that can add up all the masses of the constrained objects

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.
mjmr89 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-19-2008   #5 (permalink)
UWSVN Contributor
 
Hitman271's Avatar
 

Join Date: Feb 2008
Location: Alabama, USA
Posts: 385
Hitman271 is on a distinguished road
Send a message via Yahoo to Hitman271
Default Re: Something that can add up all the masses of the constrained objects

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:
Originally Posted by Anticept View Post
It is not some place where you can toss your dick around and expect people to suck it.
Quote:
Originally Posted by Black Phoenix on Fixing the Gpu
When I get laid
READ AND GET SEXAH PRONZ OR DONT AN GET BANNED

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
Hitman271 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-19-2008   #6 (permalink)
Advanced Member
 
mjmr89's Avatar
 

Join Date: Mar 2008
Posts: 107
mjmr89 is on a distinguished road
Default Re: Something that can add up all the masses of the constrained objects

Well, I certainly can't do anything with that, as I have no idea how to do it. So if someone else can...
mjmr89 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-19-2008   #7 (permalink)
UWSVN Contributor
 
Hitman271's Avatar
 

Join Date: Feb 2008
Location: Alabama, USA
Posts: 385
Hitman271 is on a distinguished road
Send a message via Yahoo to Hitman271
Default Re: Something that can add up all the masses of the constrained objects

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:
Originally Posted by Anticept View Post
It is not some place where you can toss your dick around and expect people to suck it.
Quote:
Originally Posted by Black Phoenix on Fixing the Gpu
When I get laid
READ AND GET SEXAH PRONZ OR DONT AN GET BANNED

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
Hitman271 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -7. The time now is 11:40 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.

Page top