Forum

> > CS2D > Scripts > Speedmod on Tile
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Speedmod on Tile

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: Speedmod on Tile

Rainoth
Moderator Off Offline

Zitieren
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

alt Re: Speedmod on Tile

Mora
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht