Map Database  •  FAQ  •  RSS  •  Login

Help with scripting

<<

FatheriatorCZ

Serf

Posts: 8

Joined: 22 Apr 2016, 19:09

KaM Skill Level: Fair

Post 21 May 2016, 16:51

Help with scripting

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

tomasara413

Peasant

Posts: 4

Joined: 06 Jun 2014, 12:33

KaM Skill Level: Fair

Post 30 Jun 2016, 18:23

Re: Help with scripting

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.

Return to “Dynamic Scripting”

Who is online

Users browsing this forum: No registered users and 8 guests