Forum

> > CS2D > General > Construction Related Settings
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Construction Related Settings

12 replies
To the start Previous 1 Next To the start

old Construction Related Settings

Deas
User Off Offline

Quote
hi, can anyone list all Construction related settings?
such as building limit (already know this one thu)
how fast they build, ect

thank you!

old Re: Construction Related Settings

Happy Camper
User Off Offline

Quote
Ok, here's a list. I have probably missed some, though.

mp_building_health
mp_building_limit
mp_building_price
mp_dispenser_health
mp_dispenser_money
mp_killbuildingmoney
mp_killbuildings
mp_killteambuildings
mp_turretdamage
mp_unbuildable

old Re: Construction Related Settings

Deas
User Off Offline

Quote
thanks

but what about how close to each-other they can be and how fast you build them? I've seen a few servers that had no building time or how close dispenser could be to each-other, is that all with scripting?

old Re: Construction Related Settings

Happy Camper
User Off Offline

Quote
Sure. It's not so complicated. First I add a buildattempthook. If someone is trying to build something, the hook will be called. The hook checks if the building is a turret. If it is, it opens a new menu where the builder can select to build a single, double or triple turret. The script then checks if the player has enough money to build. If he has, it deducts the cost from his money and spawns the building. Spawning a building is an instant operation.

old Re: Construction Related Settings

Deas
User Off Offline

Quote
Happy Camper has written
Sure. It's not so complicated. First I add a buildattempthook. If someone is trying to build something, the hook will be called. The hook checks if the building is a turret. If it is, it opens a new menu where the builder can select to build a single, double or triple turret. The script then checks if the player has enough money to build. If he has, it deducts the cost from his money and spawns the building. Spawning a building is an instant operation.


oh, so you basically rewrite the building function?

old Re: Construction Related Settings

Happy Camper
User Off Offline

Quote
I guess you can say that. The build function is designed to be slow while spawnobject creates a building instantly. Beware, it's easy to build a lot of triple turrets with this script and that could cause your server to lag (and your head to ache).

old Re: Construction Related Settings

Deas
User Off Offline

Quote
Happy Camper has written
Beware, it's easy to build a lot of triple turrets with this script and that could cause your server to lag (and your head to ache).


hmm, i see.

any suggestions on how i make a timer or limit how many someone can build (before i try to make one)?

i'd prefer if i could use some sort of setting like mp_building_limit

old Re: Construction Related Settings

Happy Camper
User Off Offline

Quote
You could use the Lua call object(0,"table") to get a list of all dynamic objects (including buildings). Then loop through all of them to check if the player has already reached the limit for that type of building. If so, don't let him build.

If you want a delay between the builds you could store the time when the player builds something. Next time, check the time against the previous build time. If they are too close, refuse the build. The drawback with this is that the player will probably be frustrated.

A better solution is to start a timer (use the Lua function timer(time,"func",["p"],[c])) at each build attempt. When the timer expires, you spawn the building. You should also refuse all build attempts until the timer has expired to prevent a player from starting multiple build attempts.
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview