Forum

> > CS2D > Scripts > Does anyone have "Random Wall Spawn" script ?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Does anyone have "Random Wall Spawn" script ?

2 replies
To the start Previous 1 Next To the start

old Does anyone have "Random Wall Spawn" script ?

Rainoth
Moderator Off Offline

Quote
Well.. I found random item spawn script but no script that spawns walls randomly. I got the idea from HC server where barbed wires,mines,all kinds of walls,turrets,dispensers etc are spawned thorough the whole map. If not the script ... Could you at least tell me what hook should be used (I doubt it would help me much but still a move towards goal..) Thank you in advance.

old Re: Does anyone have "Random Wall Spawn" script ?

Deleted User

Quote
1
2
3
4
5
6
7
8
9
10
local list = {1,2,3,4,5,6,7,8,9,11,12,15}
for x = 0, map('xsize') do
	 for y = 0, map('ysize') do
		if tile(x, y, 'walkable') and tile(x, y, 'frame') ~= 0 then
			if math.random(1, 100) > 75 then
				parse('spawnobject '.. list[math.random(1, #list)] ..' '.. x ..' '.. y ..' 0 0 '.. math.random(0, 2) ..' 0')
			end
		end
	end
end

Didn't tested it, but should work.

Edit: Crashing fixed, don't use this script on big maps.
edited 2×, last 17.02.13 11:09:50 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview