Forum

> > CS2D > Scripts > custom upgrade price
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch custom upgrade price

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt custom upgrade price

Zurak
User Off Offline

Zitieren
im trying to make my first script and it requires a custom building upgrade price but i could not find anything, idk if it can be changed with lua but im thinking of something like giving the player x amount of money every time he tries to upgrade/heal a building can this be done?
(i accidently double posted)

alt Re: custom upgrade price

DC
Admin Off Offline

Zitieren
Try cs2d cmd mp_building_price for the upgraded building versions like "Turret II" and "Turret III". I think their price value = upgrade costs. But I'm not sure and too lazy to check it.

alt Re: custom upgrade price

Zurak
User Off Offline

Zitieren
ik it was accident.
@DC that was the first thing that i tried but it did not work so i tried to make a script like that of katemire's
1
2
3
4
5
addhook("objectupgrade","repair")
function repair(id,p,progress,total)
	setmoney(p,player(p,"money")+100)
	return 0
end
this seems to work for upgrades but it first takes away 100 and then adds 100, i didnt figure out how to do it the other way around yet.
2× editiert, zuletzt 22.06.12 00:42:00

alt Re: custom upgrade price

Apache uwu
User Off Offline

Zitieren
Well after you give back 100, you can then take away your custom price.

You should also put a check for money before and return 1 if they don't have enough.

alt Re: custom upgrade price

Zurak
User Off Offline

Zitieren
money check doesn't work because if u test then u will see that the hook is on the upgrade when its been done not on the attempt on the upgrade. But another question, since this only works for repair price is there a hook that works for repairing a building, i'm trying to find one but i cant

alt Re: custom upgrade price

Zurak
User Off Offline

Zitieren
oh, i must have missed it thanks.
but here is 1 more question still for the newbie:

1
2
addhook("hit","upgrade_attempt")
function upgrade_attempt(id,[<-can this be somehow edited with the id of an object? or is this limited to player id's only?]
i'm asking this because the hit function would theoretically be better for setting custom upgrade price because it is done on attempt (like the buildattempt hook) but for upgrade/repair instead of building something.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht