DukeInstinct
|
|
« Reply #15 on: April 24, 2010, 12:52:02 am » |
|
Either way takes about the same amount of memory. You might save a couple bytes in your dat file with the loop method.
If you want to use a loop then the second piece of code I posted should go into your create explosion function while the first piece of code I posted should go into your spawn debris function.
|
Urban Wars Coder/3d Modeler/Animator
|
|
|
|
Mexicouger
Lieutenant
Posts: 111
|
|
« Reply #16 on: April 24, 2010, 01:00:59 am » |
|
NEXT QUESTION. Is there a distinct surface for a player. A distinct vector? Say you shoot a gun and you have arichochet sound effecta You don`t want it to play whne you hit the player. So how woul dyou setup that if statement?
|
|
|
|
DukeInstinct
|
|
« Reply #17 on: April 24, 2010, 01:56:29 am » |
|
If you're using a traceline to detect what your weapon hit then you'd use: if (trace_ent.takedamage) To check whether it's a player/monster. If you're using a entity that acts as a projectile then in that projectile's touch function you'd add: if (other.takedamage)
|
Urban Wars Coder/3d Modeler/Animator
|
|
|
Mexicouger
Lieutenant
Posts: 111
|
|
« Reply #18 on: April 24, 2010, 02:04:04 am » |
|
OK i think I get it now. I added richochet sounds and I don`t want it to play on a player. Also, sorry bout so many questions and bad spelling. My phone is retarded and blends letters. I also wa sjust messing with th erandom code and added a random func to a .nextthink function, an dnow the debris randomly disapears between 1-8 seconds. I think coding is fooking awesome. Now I did something a bit offtopic a while ago. I created a solid sprite that .thinks about shooting a weapon. he .nextthinks in 3 seconds but never nextthinks. Any help? like he will shoot the weapon when I load the map in 3 seconds, But he won`t shoot it again. I added the think funcstions and all. i put his .think = W_FirePistol and he does the whole pistol action, but he won`t do it again.
|
|
|
|
DukeInstinct
|
|
« Reply #19 on: April 24, 2010, 09:35:28 pm » |
|
There should also be an assignment to nextthink in the actual think function. So basically add: self.nextthink=time+3; to your think function.
|
Urban Wars Coder/3d Modeler/Animator
|
|
|
Mexicouger
Lieutenant
Posts: 111
|
|
« Reply #20 on: April 26, 2010, 08:42:40 am » |
|
I had a nextthink already. And time counts as 1 second right? self.nextthink = time + 5; that is 6 seconds right?
|
|
|
|
DukeInstinct
|
|
« Reply #21 on: April 26, 2010, 06:12:25 pm » |
|
Nope. It's 5 seconds.
|
Urban Wars Coder/3d Modeler/Animator
|
|
|
Mexicouger
Lieutenant
Posts: 111
|
|
« Reply #22 on: April 26, 2010, 07:45:18 pm » |
|
So why must we put time + 5; then?
|
|
|
|
DukeInstinct
|
|
« Reply #23 on: April 26, 2010, 10:01:58 pm » |
|
time is the amount of seconds that has elapsed since the game began.
If you just put nextthink=5; then that would mean 5 seconds after the game began. You'd most likely be past that time every call to that function so your think function would never be triggered. However, if you put nextthink=time+5; then that would mean 5 seconds after you assigned nextthink.
|
Urban Wars Coder/3d Modeler/Animator
|
|
|
Mexicouger
Lieutenant
Posts: 111
|
|
« Reply #24 on: April 26, 2010, 10:23:26 pm » |
|
Oh wow! That`s a big difference! Thanks!
|
|
|
|
|
|