Forum

> > CS2D > Scripts > Fast build and Turret
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Fast build and Turret

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Fast build and Turret

francis007
BANNED Off Offline

Zitieren
Hey us!

Can somebody make that this script doesn't working for turrets?

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
local pie = {}
pie[1]  = { price = 300 }
pie[2]  = { price = 500 }
pie[3]  = { price = 1000 }
pie[4]  = { price = 2000 }
pie[5]  = { price = 3000 }
pie[6]  = { price = 1500 }
pie[7]  = { price = 5000 }
pie[8]  = pie[7]
pie[9]  = pie[7]
pie[13] = pie[5]
pie[14] = pie[5]

function build_hook(id, type, x, y)
  if not pie[type] then
    return 0
  end

  parse("spawnobject " ..type.. " " ..x.. " " ..y.. " 90 1 " ..player(id, "team").. " " ..id)

  local capitalism = player(id,"money") - pie[type]["price"]
  parse("setmoney " ..id.. " " ..capitalism)

  return 1
end

addhook("build","build_hook")

Thanks!

alt Re: Fast build and Turret

DC
Admin Off Offline

Zitieren
Not sure what you mean. Do you want to make turrets unbuildable via script?

Based on your script take a look at
cs2d lua hook build and http://www.cs2d.com/img/ref_dynamicobjects.png

(level 1) turrets have the type 8.
Your script returns 0 for every building type which is not in the table
pie
. Returning 0 in the build hook cancels building.

So it should be enough to simple remove line 9 (
pie[8]  = pie[7]
) from your script.

alt Re: Fast build and Turret

Mami Tomoe
User Off Offline

Zitieren
Maybe this is what you want:

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
local pie = {}
pie[1]  = { price = 300 }
pie[2]  = { price = 500 }
pie[3]  = { price = 1000 }
pie[4]  = { price = 2000 }
pie[5]  = { price = 3000 }
pie[6]  = { price = 1500 }
pie[7]  = { price = 5000 }
pie[8]  = pie[7]
pie[9]  = pie[7]
pie[13] = pie[5]
pie[14] = pie[5]

addhook("build","build_hook")
function build_hook(id, type, x, y)
	if not type == 8 and not type == 11 and not type == 12 then
		if not pie[type] then
			return 0
		end
		parse("spawnobject " ..type.. " " ..x.. " " ..y.. " 90 1 " ..player(id, "team").. " " ..id)
		local capitalism = player(id,"money") - pie[type]["price"]
		parse("setmoney " ..id.. " " ..capitalism)
		return 1
	end
end
1× editiert, zuletzt 13.12.16 18:55:08

alt Re: Fast build and Turret

DC
Admin Off Offline

Zitieren
What does the fastbuild script look like? I assume that both are using the cs2d lua hook build hook. It's probably a priority / return value thing.

alt Re: Fast build and Turret

GeoB99
Moderator Off Offline

Zitieren
Just use cs2d cmd mp_building_limit and set the value limit for turret building as 0. Less hassle and no scripts involved in this.
mp_building_limit "Turret" 0

As soon as you add this setting under // More title through server.cfg and save the file, the changes will take effect.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht