Page 1 of 1

Help with scripting

PostPosted: 21 May 2016, 16:51
by FatheriatorCZ
Hi it is me again i am realy bad with scripting and i am geting bored of old maps.
I need somebody to help me script.
Now i Would like a script that spawns units (or does other things) when building (on some coordinates is destroyed).
And second i´d like a script that does something when only certain number of buildings/ units remain for one player.
Thank you for help.

Re: Help with scripting

PostPosted: 30 Jun 2016, 18:23
by tomasara413
Well, answer is kinda easy. Have you ever tried to script? It's nothing hard really. Of course it's matter of complexity though. But this should do the trick:
  Code:
procedure OnHouseDestroyed(aHouseId: Integer; aDestroyer: Integer); begin //this summons group of units upon destruction of buildng on specifiend x and y if (States.HousePositionX(aHouseId) = x_coord_of_house_that_needs_to_be_destroyed) and (States.HousePositionY(aHouseId) = y_coord_of_house_that_needs_to_be_destroyed) then begin Actions.GiveGroup(player_int,type,where_to_summon_x,where_to_summon_y,which_direction_will_they_be_looking(int),count,units_per_row); end; end; procedure OnTick(); begin if (lenght(States.PlayerGetAllUnits(player_id(int)) <= number_of_units_you_require) then begin //something you need to happen end; end;
If you're going to use this code, please remove all (int)s I only wrote them to signalize what type of var you have to insert.