Evil Resident Posted December 29, 2014 Share Posted December 29, 2014 Good day everyone. What would be the best way to make an object disapear from your game beside hidding it? Because, if i'm not mistaken, hidding does not remove an object from the game. Quote Link to comment Share on other sites More sharing options...
Rick Posted December 29, 2014 Share Posted December 29, 2014 I think it's calling Release() Quote Link to comment Share on other sites More sharing options...
Gonan Posted December 31, 2014 Share Posted December 31, 2014 I added this bit of code to MonsterAI.lua make the end of the setmode function look like this elseif mode=="dying" then self.entity:Stop() self.animationmanager:SetAnimationSequence("Death",0.04,300,1,self,self.EndDeath) elseif mode=="dead" then self.entity:SetCollisionType(0) self.entity:SetMass(0) self.entity:SetShape(nil) self.entity:SetPhysicsMode(Entity.RigidBodyPhysics) if self.target ~=nil then self.target = nil end self.deadtime=Time:GetCurrent() end the end of the UpdatePhysics to look like this elseif self.mode=="attack" then if self.attackbegan~=nil then if t-self.attackbegan>self.attackdelay then if self.target.entity:GetDistance(self.entity)<1.5 then self.attackbegan=nil self.target:Hurt(self.damage) end end end local pos = self.entity:GetPosition() local targetpos = self.target.entity:GetPosition() local dx=targetpos.x-pos.x local dz=targetpos.z-pos.z self.entity:AlignToVector(-dx,0,-dz) elseif self.mode=="dead" then if t>self.deadtime+1000 then self.entity:SetPosition(self.entity:GetPosition().x,self.entity:GetPosition().y-0.01,self.entity:GetPosition().z) end if t>self.deadtime+2000 then self.enabled=false self.entity:Release() end end You should also add Script.deadtime=0 to the list of Private values at the top of the .lua file When your monster is killed, it lies dead for 1 second, then sinks into the ground for the next second and the release causes it to disappear. Quote Link to comment Share on other sites More sharing options...
Evil Resident Posted December 31, 2014 Author Share Posted December 31, 2014 Thanks for the replys. I was thinking of "releasing" inanimated objects. When thrown in a meat grinder they hit a hidden box with the collisiontrigger script and they disappear from the game and that trigger a particle emitter for a second or so. Unfortunaly, i'm not a very good scripter...Could some of you just give me some hints to get me started. I don't want a script from some one, just the general idea so i can make this happen an learn at the same time. Thanks for your time. 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.