Forum

> > CS2D > Scripts > Spawning objects in a specific direction/rotation
Forums overviewCS2D overview Scripts overviewLog in to reply

English Spawning objects in a specific direction/rotation

2 replies
To the start Previous 1 Next To the start

old Spawning objects in a specific direction/rotation

dcrew
User Off Offline

Quote
Hi, I'm working on a new project, and a new gamemode made with LUA in CS2D (obviously CS2D) and I'm getting stuck. this is all original this gamemode and my map is original too (except it uses an existing tileset made by another person)

I have this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
color = {'©255200000','©000255000','©160160255','©255000000','©240000240','©255128064','©255255255','©155255000','©100100255'}
function dczf_msg(c,t)
	msg(color[c]..t)
end
function co(type,xtile,ytile,rot,mode,team,player)
	x = getxposoftile(xtile)
	y = getyposoftile(ytile)
	parse("spawnobject "..type.." "..xtile.." "..ytile.." "..rot.." "..mode.." "..team.." 0")
end
addhook("trigger","trigger")
function trigger(trigger,source)
	if (trigger == "smines1") then
		co(21,66,43,180,1,2,0)
		co(21,61,48,90,1,2,0)
		co(21,84,43,180,1,2,0)
		co(21,89,48.-90,1,2,0)
		co(21,89,66,-90,1,2,0)
		co(21,84,71,0,1,2,0)
		co(21,66,71,0,1,2,0)
		co(21,61,66,90,1,2,0)
		co(20,62,52,0,1,2,0)
		co(20,62,53,0,1,2,0)
		co(20,62,61,0,1,2,0)
		co(20,62,62,0,1,2,0)
		co(20,88,52,0,1,2,0)
		co(20,88,53,0,1,2,0)
		co(20,88,61,0,1,2,0)
		co(20,88,62,0,1,2,0)
		co(20,70,70,0,0,2,0)
		co(20,72,70,0,0,2,0)
		co(20,74,70,0,0,2,0)
		co(20,76,70,0,0,2,0)
		co(20,78,70,0,0,2,0)
		co(20,80,70,0,0,2,0)
		co(20,70,44,0,0,2,0)
		co(20,72,44,0,0,2,0)
		co(20,74,44,0,0,2,0)
		co(20,76,44,0,0,2,0)
		co(20,78,44,0,0,2,0)
		co(20,80,44,0,0,2,0)
		dczf_msg(4,"CT have activated the traps!")
	end
end

the objects that are rotated (e.g the objects I created with rotation set at 90,-90,180,0 ect) don't rotate, from what I see in-game it still creates them all facing upwards, in my time of LUA programming with CS2D I havn't really come across creating Lazor Mines facing a certain direction. Can someone help me please?

old Re: Spawning objects in a specific direction/rotation

dcrew
User Off Offline

Quote
But on the CS2D rcon wiki thing it says "rot : 0-360 : rotation of the object" but I'll try 0,1,2, or 3 and let y'know if it solves my prob, thanks!


Edit: OMG DAMN! I didn't have to change anything, I realized I accidently placed a dot "." instead of a comma "," on one of the create objects, I fixed that and it worked!
edited 1×, last 05.09.11 04:11:54 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview