Greetings once again. I've sidetracked a bit and decided to try making an entity, since I've seen in some help threads that working with the bouncy ball SENT can help teach you how to create entities. Personally I've found this specific example a little too complex for an introduction to SENTs, but that's for another story. I've managed to recreate it and have learned a lot of interesting things in the process... although an error still eludes me. It doesn't seem to functionally cause anything wrong (besides for every ball I spawn being pitch black). However, I might discover it causes more problems later on and it could really irritate me later. This is the error:
[ERROR] lua/includes/extensions/entity.lua:202: bad argument #3 to 'SetFunc' (Vector expected, got number)
1. SetFunc - [C]:-1
2. __newindex - lua/includes/extensions/entity.lua:202
3. SetBallColor - lua/includes/extensions/entity.lua:285
4. unknown - lua/entities/mysent_ball.lua:93
5. Spawn - [C]:-1
6. SpawnFunction - lua/entities/mysent_ball.lua:50
7. Spawn_SENT - gamemodes/sandbox/gamemode/commands.lua:612
8. unknown - gamemodes/sandbox/gamemode/commands.lua:669
9. unknown - lua/includes/modules/concommand.lua:69
I've checked my code and I haven't been able to find anything that I would THINK is causing it, for the most part I stuck pretty tight to the example besides for slight modifications for personal challenges. I didn't want to post the code here in the OP because it's like, 200+ lines... so, I'll just put it in a pastebin.
[url]http://pastebin.com/JLD9YKbf[/url]
Am I missing something obvious? And while I'm on it, are there more simple scripted entities I could reference or learn from? Thanks for reading!
Your giving it a number, when it requires a vector. Looking at the default sent_ball.lua, it seems that SetBallColor is used like this: [lua] self:SetBallColor( Vector( 1, 1, 0.3 ) )[/lua] However, your using it like this: [lua] self:SetBallColor( 1, 0.3, 0.3 );[/lua] Convert the numbers your passing into a vector.
wait why do you need a vector lol
shouldn't you be using Color()?
[QUOTE=BFG9000;43415155]wait why do you need a vector lol
shouldn't you be using Color()?[/QUOTE]
No idea why he isn't just doing SetColor.
SetBallColor is an accessory to the datavar BallColor, which is a vector, that's why you need a vector for it.
[QUOTE=crazyscouter;43411777]Your giving it a number, when it requires a vector. Looking at the default sent_ball.lua, it seems that SetBallColor is used like this: [lua] self:SetBallColor( Vector( 1, 1, 0.3 ) )[/lua] However, your using it like this: [lua] self:SetBallColor( 1, 0.3, 0.3 );[/lua] Convert the numbers your passing into a vector.[/QUOTE]
Haha, whoopsies! Had a long night of re-creating this SENT, I wasn't looking closely. Works like a charm now, thanks!
Sorry, you need to Log In to post a reply to this thread.