English How to spawn a projectile?

14 replies
Goto Page
To the start Previous 1 Next To the start
30.12.14 05:01:45 pm
Up
Louie
User
Offline Off
I've seen in some maps that when u "Use" something(like a button) then a projectile will spawn at a location,how do i do that?
No system is safe.
30.12.14 05:05:30 pm
Up
DC
Admin
Offline Off
With some Lua scripting.
cs2d lua hook use or cs2d lua hook usebutton with cs2d lua cmd parse and cs2d cmd spawnprojectile
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
30.12.14 05:05:32 pm
Up
eledah
User
Offline Off
cs2d lua hook usebutton, cs2d cmd spawnprojectile

edit: 2 seconds late, remove this if it's not necessary.
edited 1×, last 30.12.14 05:41:33 pm
[̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]
30.12.14 05:14:24 pm
Up
Louie
User
Offline Off
I opened one of my favorite maps in the editor and this is what i saw to spawn the projectile(it was a Trigger_If entity) parse('spawnprojectile 0 47 2736 3760 448 0') tho,i dont know what all those numbers mean lol,can someone please explain that.
edited 1×, last 30.12.14 05:28:42 pm
No system is safe.
30.12.14 05:40:54 pm
Up
eledah
User
Offline Off
Read cs2d cmd spawnprojectile's description.
[̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]
30.12.14 06:04:57 pm
Up
Louie
User
Offline Off
Ok i think i got the basics of it but i have a slight problem how to find the x/y pixels?
No system is safe.
30.12.14 06:12:00 pm
Up
DC
Admin
Offline Off
The map editor shows the tile position in the bottom left as small text. The first number is x, the second y. Multiply each with 32 to get the position in pixels (because each tile has a size of 32 pixels). This is the top left of the tile you are currently pointing at with your cursor. Add another 16 pixels to x and y to get the center position of that tile.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
30.12.14 06:29:08 pm
Up
Louie
User
Offline Off
Thx guys now I know how to do it
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
No system is safe.
31.12.14 12:08:14 pm
Up
hacked
User
Offline Off
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:
Code:
1
'spawnprojectile 0 47 2736 3760 448 math.random(0, 360)'
31.12.14 12:33:19 pm
Up
eledah
User
Offline Off
Laser is not a projectile, only the ones that are marked with a little 'P' can be used as projectiles.
[̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]
31.12.14 01:40:26 pm
Up
Mora_rus
User
Offline Off
@topic:
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?:
Code:
1
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
31.12.14 02:02:45 pm
Up
eledah
User
Offline Off
Code:
1
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
[̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]
31.12.14 03:38:38 pm
Up
Mora_rus
User
Offline Off
@user eledah: i have array of ALL weapons, and as you can see:
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
31.12.14 06:12:05 pm
Up
Louie
User
Offline Off
user 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:
Code:
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
No system is safe.
01.01.15 01:04:19 pm
Up
hacked
User
Offline Off
We need a captain.
To the start Previous 1 Next To the start