Forum
CS2D Scripts How to spawn a projectile?How to spawn a projectile?
14 replies 1
use or usebutton with parse and spawnprojectile
edit: 2 seconds late, remove this if it's not necessary.
edited 1×, last 30.12.14 05:41:33 pm
edited 1×, last 30.12.14 05:28:42 pm
EDIT: Though when i want it to spawn a Laser projectile(from the Laser gun) it doesn't shoot a projectile,it throws a Laser gun lol and also last question,how do i make it to spawn a projectile at a random angle?
edited 2×, last 31.12.14 09:42:10 am
EDIT:
Oh and for the random angle:
1
'spawnprojectile 0 47 2736 3760 448 math.random(0, 360)'
goto your cs2d folder,
open sys/lua/samples/projectiles.lua <-open it by any txt editor..
@ot
Can i ask?-because topic about projectiles:
i have array, i have kill hook:
if i kill players with any weapon that attacks bullets, i got +1 array.
if i kill players with any weapon that attacks projectiles (hegren,GL,RL,RPG), i got nothing..
just nothing..
maybe something wrong?:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
function at_kill(id) local wwp = player(id,"weapontype") 	if wwp==2 then uspZ[id] = uspZ[id] >= 6 and 6 or uspZ[id] + 1 if uspZ[id] == 5 then uspZ[id] = 6 end 	elseif wwp==51 then rocketZ[id] = rocketZ[id] >= 6 and 6 or rocketZ[id] + 1 if rocketZ[id] == 5 then rocketZ[id] = 6 end 	end end
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
function at_kill(killer, victim, wep) 	if wep~=47 and wep~=48 and wep~=49 and 		wep~=51 and wep~=72 and wep~=73 and 		wep~=75 and wep~=76 and wep~=86 and 		wep~=89 then 		--Killed with normal weps 	else 		--Killed with projectile type weps 	end end
uspZ is only first array using, the next one is elite, the next is deagle. isn't means that they all using one array,-not, it's like a stats.. but it possible to do it for any projectile weapons personaly?= means if that id 47 then i do for it array:
rpgZ = arraybalalba, so, the next will be like in my code for bullets weapon.
and note: i mean not that i need for projectiles will do nothing, i mean that if i try to do same as with bullet weapons - nothing happened, i need fix that "nothing happened or buggy when i kill from projetile bullets weapons".
Hope is understandable. Sorry my english
hacked has written
You can't shoot laser projectile through lua, but you can create your own laser with env_sprite and env_hurt.
EDIT:
Oh and for the random angle:
EDIT:
Oh and for the random angle:
1
'spawnprojectile 0 47 2736 3760 448 math.random(0, 360)'
it doesn't work it shoot a projectile but it explodes just after the projectile was launched heres what i did
parse('spawnprojectile 0 47 432 825 500 math.random(150, 230') though it doesn't work(the random thing)
edited 1×, last 01.01.15 05:27:05 am
1