Forum

> > CS2D > Scripts > custom upgrade price
Forums overviewCS2D overview Scripts overviewLog in to reply

English custom upgrade price

7 replies
To the start Previous 1 Next To the start

old custom upgrade price

Zurak
User Off Offline

Quote
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)

old Re: custom upgrade price

DC
Admin Off Offline

Quote
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.

old Re: custom upgrade price

Zurak
User Off Offline

Quote
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.
edited 2×, last 22.06.12 12:42:00 am

old Re: custom upgrade price

Apache uwu
User Off Offline

Quote
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.

old Re: custom upgrade price

Zurak
User Off Offline

Quote
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

old Re: custom upgrade price

Zurak
User Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview