• Mario Fireballs Errors
    57 replies, posted
Never mind that... [ERROR] lua/entities/mariofire/init.lua:136: attempt to call field 'Entity' (a nil value) 1. unknown - lua/entities/mariofire/init.lua:136 [code] if data.Entity():IsPlayer() or data.Entity():IsNPC() then SafeRemoveEntity( self.Entity ) end[/code] With and without (), I get the same error. How to I check what entity I am hitting in physics collide? [editline]14th December 2012[/editline] And I don't mean the physics object. Otherwise, I will have to comment it out. I don't want it disappearing when it hits the world.
cancel that line out and put [lua]print(data, physobj)[/lua] for debugging under [lua]function ENT:PhysicsCollide( data, physobj )[/lua] comment out [lua] if data.Speed <= 12 then timer.Simple(5, function() local vPoint = self:GetPos() local effectdata = EffectData() effectdata:SetStart( vPoint ) effectdata:SetOrigin( vPoint ) effectdata:SetScale( 1 ) util.Effect( "Explosion", effectdata ) if IsValid(self) then self:Remove() end end) end[/lua] if you don't want it disappearing so you can debug :) Look at these pages [url]http://wiki.garrysmod.com/page/Classes/CollisionData[/url] [url]http://wiki.garrysmod.com/page/Classes/PhysObj[/url]
[ERROR] lua/entities/mariofire/init.lua:105: Tried to use a NULL entity! 1. GetPos - [C]:-1 2. unknown - lua/entities/mariofire/init.lua:105 Timer Failed! [Simple][@lua/entities/mariofire/init.lua (line 104)] [
[QUOTE=luavirusfree;38821497][ERROR] lua/entities/mariofire/init.lua:105: Tried to use a NULL entity! 1. GetPos - [C]:-1 2. unknown - lua/entities/mariofire/init.lua:105 Timer Failed! [Simple][@lua/entities/mariofire/init.lua (line 104)] [[/QUOTE] New code please.
Nvm...
[QUOTE=luavirusfree;38821533]Nvm...[/QUOTE] Kk...
I've gotten it to work. Now I just need a spherical model, it bounces/slides like a doll... [editline]14th December 2012[/editline] models/XQM/Rails/gumball_1.mdl [editline]14th December 2012[/editline] Didn't change it at all... How do I make it bounce, instead of rolling most of the time with sent ball code... [editline]14th December 2012[/editline] [ERROR] lua/weapons/mario_fireballs/shared.lua:80: bad argument #2 to '__sub' (Vector expected, got userdata) 1. __sub - [C]:-1 2. unknown - lua/weapons/mario_fireballs/shared.lua:80 [code]function SWEP:PrimaryAttack() local Player = self.Owner local Fireball = ents.Create( "mariofire" ) Fireball:SetOwner( Player ) Fireball:SetPos( Player:GetShootPos() ) -- Fireball:SetAngles( Angle(30, 30, Player:GetAimVector().z) ) Fireball:Spawn() local mPhys = Fireball:GetPhysicsObject() local Force = (Player:GetAimVector() * 128) - Angle( 45, 45, 0 ) mPhys:ApplyForceCenter( Force ) self.Weapon:EmitSound( "mario/fire" ) -- self.Weapon:SendWeaponAnim( ACT_VM_THROW ) -- timer.Simple( 0.3, self.Weapon.SendWeaponAnim, self, ACT_VM_IDLE ) self.STime = CurTime() self.Weapon:SetNextPrimaryFire( CurTime() ) self.Weapon:SetNextSecondaryFire( CurTime() ) end[/code] [editline]14th December 2012[/editline] [ERROR] lua/weapons/mario_fireballs/shared.lua:80: bad argument #2 to '__sub' (Vector expected, got userdata) 1. __sub - [C]:-1 2. unknown - lua/weapons/mario_fireballs/shared.lua:80 ... Put the -angle on the inside.
Change Player to ply and see if that works
That can't be the problem, it worked before. I just need to know how to make the fireballs shoot downward, keeping the player's yaw in check. [editline]14th December 2012[/editline] Line 80: local Force = (Player:GetAimVector() * 128) - Angle( 45, 45, 0 ) It's the angle that causes it... [editline]14th December 2012[/editline] ] give mario_fireballs [ERROR] lua/weapons/mario_fireballs/shared.lua:80: attempt to index global 'Angle' (a function value) 1. unknown - lua/weapons/mario_fireballs/shared.lua:80 [code] local Force = Angle:__add(Player:GetAimVector(), Angle(-30, 0, 0) )*256[/code] IDK how to get them to shoot 45degrees down!
I sent you a pm
Still not fixed...
OhMyGawd... Ninja's banned!!! OH NOES!!! ... <insert message that shouldn't be read by an admin here>.
I wonder how long my biggest helper, Ninja, is banned. [editline]21st December 1869[/editline] I don't know how to insert the edit lines, but... Can someone else please help me???? [editline]21st December 2012[/editline] I still need help making the fireballs disappear. My thought is adding a timer to the weapon, but then it might not work if multiple are shot.
[QUOTE=luavirusfree;38921445]I wonder how long my biggest helper, Ninja, is banned. [editline]21st December 1869[/editline] I don't know how to insert the edit lines, but... Can someone else please help me???? [editline]21st December 2012[/editline] I still need help making the fireballs disappear. My thought is adding a timer to the weapon, but then it might not work if multiple are shot.[/QUOTE] A timer will work. Just use timer.Simple. If you don't want to use a timer use CurTime.
I tried a timer, it glitched after I fixed all other errors.
[QUOTE=luavirusfree;38923428]I tried a timer, it glitched after I fixed all other errors.[/QUOTE] Put [code] local ref = self timer.Simple(5, function() if ( not ref or not IsValid(ref) ) then return end ref:Remove() end) [/code] in the initalizing.
SafelyRemoveEntity ...
And my timer IS in initialize. It causes errors.
[QUOTE=luavirusfree;38927296]And my timer IS in initialize. It causes errors.[/QUOTE] Please stop double/tripple/quad posting and start editing your previous posts... Also, you were supposed to replace my timer with what I gave you. I assume that the error occurs because the timer isn't run under the ENT table that's why I gave you a snippet creating a reference. It's SafeRemoveEntity not SafelyRemoveEntity. SafeRemoveEntity isn't useful, it only adds a check to check if the entity is a player or not, if its a player - don't delete. Why ? Because your game kind'a fucks up when someone deletes your player entity. And stop using self.Entity before it becomes an habbit, it's bad. self.Entity just returns the self so self.Entity is the same as self except that self.Entity is like a reroute garry once removed it and literally said you shouldn't use it. And before you say how: Just type self instead self.Entity.
I do that because it's the only way to get the [editline]Dec 12 2012[/editline] to appear... besides writing {editline}22th December 2012[/editline]; Correct me if I'm wrong.
[QUOTE=luavirusfree;38932926]I do that because it's the only way to get the [editline]Dec 12 2012[/editline] to appear... besides writing {editline}22th December 2012[/editline]; Correct me if I'm wrong.[/QUOTE] get the ? I don't get what you're saying. But no, self:Remove() works pretty much the same as SafeRemoveEntity( self )
I'm wondering why I was rated dumb... .
[QUOTE=luavirusfree;38938176]I'm wondering why I was rated dumb... .[/QUOTE] Because nobody could understand what you said. Also, don't complain about ratings or you will receive more in the direction that you don't want.
OIC... no one can understand what I'm saying when I say "I do that because it's the only way to get the Edited: to appear... besides writing {editline}22th December 2012[/editline]; Correct me if I'm wrong." ...
[QUOTE=luavirusfree;38943765]OIC... no one can understand what I'm saying when I say "I do that because it's the only way to get the Edited: to appear... besides writing {editline}22th December 2012[/editline]; Correct me if I'm wrong." ...[/QUOTE] Just deal with it. Ratings in facepunch are like stones and money, you don't like it if somebody throws a stone at you but you like receiving money except that here in facepunch we have unlimited stones and money ( Don't take this literally ).
I'm about to start another project because I can't get help with this. My main helper was banned, so please help me!
[QUOTE=luavirusfree;39003894]I'm about to start another project because I can't get help with this. My main helper was banned, so please help me![/QUOTE] Tell us what errors you get and give us the full code.
Ugh. It's changed, and i can't find the code that Ninjas told me to use... His code was great, except that it couldn't be removed with time, and it removed itself after its first bounce. [editline]28th December 2012[/editline] [URL="http://www.facepunch.com/member.php?u=446084"]brandonj4[/URL], stop rating my dumb or I will rate your posts dumb, post after post.
Sorry, you need to Log In to post a reply to this thread.