• Print

Author Topic: Customized Balls  (Read 4808 times)

0 Members and 1 Guest are viewing this topic.

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Customized Balls
« on: April 11, 2016, 02:11:31 pm »
Hai, hasn't been a while since I posted help or asked for help, so here ye go ^-^

I have hit an unfortunate bump in my code right now and since it's not ULX related I've put it in off-topic. (And cause I know you guys are smart and are possibly able to help!) Is there an easy way for me to be able to spawn a ball (With a swep I have made), upon secondary fire (right click) it cycles through a few colours (which would be printed in chat of the colour thats being set), and when reloading it changes the size in chunks of 16. (Maybe 8, GMod base ball code size is 4-128 [pixels?]) And a surprise command that changes the gravity the ball has. (I can code this, I just need to get pointed in the colour changing/size changing/spawning direction.)

All thanks given now, and I appreciate the help if you tackle this :)

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Customized Balls
« Reply #1 on: April 11, 2016, 04:27:06 pm »
These wiki pages should get you going in the right direction:

ents.Create

Entity:SetColor

Entity:SetModelScale

I suggest that in the future you also post questions in the Facepunch Garry's Mod Development Problems That Don't Need Their Own Thread. Not that people here are any worse than those on Facepunch (this forum usually seems to be nicer), it's just that Facepunch has many more users and thus you are more likely to get an answer faster.

(if any mods have an issue with me promoting a FP thread, feel free to ask me to/just remove it)
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Re: Customized Balls
« Reply #2 on: April 11, 2016, 05:27:22 pm »
(this forum usually seems to be nicer), more likely to get an answer faster.
Definitely, although I don't mind about time :P
Thanks :)

Is there a model for a ball, or should I just use,

Code: Lua
  1.                 local ent = ents.Create( "sent_ball" )
  2.                 ent:SetPos( SpawnPos )
  3.                 --ent:SetModel( "models/helicopter_bomb01.mdl" ) -- Model if any
  4.                 ent:Spawn()
  5.                 ent:Activate()
  6.  
« Last Edit: April 11, 2016, 05:44:32 pm by WispySkies »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Customized Balls
« Reply #3 on: April 11, 2016, 07:35:45 pm »
(if any mods have an issue with me promoting a FP thread, feel free to ask me to/just remove it)

BAN!!!! (joking...people go there at their own risk)

since it's not ULX related I've put it in off-topic.

Psst!
Read the "About this section" sticky of Developers Corner.
We meant it as open to any code development questions, even if our core has been Lua, Glua, and ULib/ULX in that order.
Here, happy to move it for you (and happy you're at least smarter than the average bear and didn't post it in ULX help and support section...Thanks!)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline WispySkies

  • Full Member
  • ***
  • Posts: 144
  • Karma: 0
  • I make random commands and Lua errors.
Re: Customized Balls
« Reply #4 on: April 11, 2016, 08:05:21 pm »
Gummy Bear actually :)

I think I figured it out when testing ulx ent. I'll edit this when I'm done.

  • Print