Forum

> > CS2D > Scripts > Spawnprojectile Command
Forums overviewCS2D overview Scripts overviewLog in to reply

English Spawnprojectile Command

3 replies
To the start Previous 1 Next To the start

old Spawnprojectile Command

iLoveUS
User Off Offline

Quote
Hello guys, I am making my first script, I was planning to add the spawnprojectile command to complete my script. I tested the sample script called Projectile.lua, When I pressed F2 which was the serveraction1, 8 grenades spawn at once, so I opened the sample script, and I was wondering how to edit the grenades will spawn. Oh and 1 more thing, how do I make the projectiles spawn in my position and go to the cursor. Oh the Projectile.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
if sample==nil then sample={} end
sample.projectiles={}

addhook("serveraction","sample.projectiles.serveraction")
function sample.projectiles.serveraction(id,key)
	if (player(id,"health")>0 and player(id,"team")>0) then
		if (key==1) then
			for i=0,315,45 do
				parse("spawnprojectile "..id.." 51 "..player(id,"x").." "..player(id,"y").." 200 "..i)
			end
		elseif (key==2) then
			for i=0,315,45 do
				parse("spawnprojectile "..id.." "..math.random(1,6).." "..player(id,"x").." "..player(id,"y").." 200 "..i)
			end
		elseif (key==3) then
			for i=0,315,45 do
				parse("spawnprojectile "..id.." 47 "..player(id,"x").." "..player(id,"y").." 500 "..i)
			end
		end
	end
end
Well that's a sample script from user DC , I'm just using it to understand spawnprojectile command, If your just gonna say go to cs2d.com well I did and I don't understand

old Re: Spawnprojectile Command

omg
User Off Offline

Quote
theres a method of making them fly towards cursor, although it may be a bit laggy(?)
with reqcld and clientdata, you can track where players and their cursors are and figure out a range and the players rotation using basic functions

is there anything specific you want to know?

old Re: Spawnprojectile Command

iLoveUS
User Off Offline

Quote
user omg has written
theres a method of making them fly towards cursor, although it may be a bit laggy(?)
ok, could you show me some example? I tried using reqcld and clientdata but it spawned on the cursor and flied away and also how do I control the items will spawn?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview