Forum

> > CS2D > Scripts > Speedmod on Tile
Forums overviewCS2D overview Scripts overviewLog in to reply

English Speedmod on Tile

2 replies
To the start Previous 1 Next To the start

old Re: Speedmod on Tile

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("movetile","_mt")
function _mt(id,x,y)
	if x == 10 and y == 12 then -- single tile that changes speed
		parse("speedmod "..id.." 20")
	elseif x >= 15 and x <= 18 and y >= 10 and y <= 11 then -- an area that changes speed
		parse("speedmod "..id.." 10")
	else -- all other cases (should default to resetting speed to default)
		parse("speedmod "..id.." 0")
	end
end

old Re: Speedmod on Tile

Mora
User Off Offline

Quote
you can also place entities on your map instead of always changing code:
1
2
3
4
5
6
7
addhook("movetile","_movetile")
function _movetile(id,tilex,tiley)
	if string.sub(tostring(entity(tilex,tiley,"name")),1,5)=="speed" then
		local speed=string.sub(tostring(entity(tilex,tiley,"name")),6,10)
		parse("speedmod "..id.." "..speed)
	end
end

place any entity(for example "trigger_start") and name it "speed 50", then place one nearby with name "speed 0". So anytime you step on them you'll be set different speed.
IMG:https://i.imgur.com/egwvwvM.png
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview