Disableing DropToFloor for an entity.

The title says it.

I tried to make my entity stop dropping to the floor but I can’t make it stop.

I tried:
(In the ent):
self.Entity:DropToFloor = false


self.Entity:DropToFloor() = false

(and in the swep):
prop:DropToFloor = false


prop:DropToFloor() = false

But it just doesn’t work!

here is what valve did so you can get an idea:


And since I can’t stop that… I made my own ent. Here’s the code… just in case:

ENT.Type 			= "anim"
ENT.Base 			= "base_entity"

ENT.PrintName		= "melon"
ENT.Author		= "Sonic Cow"
ENT.Contact		= "n/a"

ENT.Spawnable		= false
ENT.AdminSpawnable	= false

AddCSLuaFile( "shared.lua" )

   Name: Initialize
function ENT:Initialize() 
	self.Entity:SetModel( "models/props_junk/watermelon01.mdl" )
	self.Entity:PhysicsInit( SOLID_VPHYSICS )
	self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
	self.Entity:SetSolid( SOLID_VPHYSICS )


This is for my fruit launcher

Oh god, what the hell are you trying to do there. :tinfoil: DropToFloor is a function, you call it, you don’t override it. Let’s say you have a control panel with buttons that perform different things. Basically, what you are doing there is taking a hammer and smashing a button into pieces, it’s stupid and you should feel stupid for doing it.

DropToFloor is a function that teleports an entity to the ground when you call it, it’s useful when you spawn stuff such as NPCs and want them to spawn on the ground and not somewhere in the air. Basically, it’s not what you need at all.
I guess you want your prop to ignore gravity, so here is the solution.


Go there, it has everything you need. http://wiki.garrysmod.com/?title=Lua
You should consider reading the tutorials because what you are trying to do isn’t even correct Lua, it makes no sense at all.

Also, “self.Entity” or “self.Weapon” (respectively for SENTs and SWEPs) are obsolete, you can write “self” instead. There are a bunch of coders who still write self.Entity, either because they got this habit since the first releases of GMod “10”, or just because they don’t know when they should use “self” or “self.Entity”.

nvm I got it to work but thanks anyway :slight_smile: