Map Database  •  FAQ  •  RSS  •  Register  •  Login

My problems with dynamic scripts

Post a reply

Smilies
:arrow: (H) :'( :O :@ (!) :( :idea: :lol: :mad: :mrgreen: :| (?) :P :$ :rolleyes: (6) :D :) :o :? :wink:
View more smilies
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: My problems with dynamic scripts

Post by memerion2 » 21 Feb 2019, 14:20

Re: My problems with dynamic scripts

Can I change unit speed by scripts?
To make unit slower than normal.

Post by cmowla » 30 Dec 2018, 04:05

Re: My problems with dynamic scripts

memerion2 wrote:Hello Again!

Can someone tell me how to do immortal unit?
I mean soldier "k" can't be killed by other soldier or tower.
Maybe see this thread?

Post by memerion2 » 29 Dec 2018, 20:22

Re: My problems with dynamic scripts

Hello Again!

Can someone tell me how to do immortal unit?
I mean soldier "k" can't be killed by other soldier or tower.

Post by memerion2 » 23 Mar 2018, 12:58

Re: My problems with dynamic scripts

How can I do this army missing?

eg. missing: 12 swordmans

Post by Rey » 22 Mar 2018, 14:11

Re: My problems with dynamic scripts

I use Pascal, as its pascalscript.

Also @Strangelove's notepad++ plugin is quite usefull, check it out: http://knightsandmerchants.net/forum/vi ... =32&t=2722

Post by memerion2 » 22 Mar 2018, 13:48

Re: My problems with dynamic scripts

What syntax you use in Notepad++

Post by Esthlos » 22 Mar 2018, 07:45

Re: My problems with dynamic scripts

memerion2 wrote:Thanks for help:)

Now I want to do:You need 300 gold
And in msg write how much missing to 300 gold.

it will be better if you explain it to me.


procedure OnTick;
var
  iPlayer: Byte;
  iGoldMissing, i: Integer;
  aHouses: array of Integer;
begin
  iPlayer := 0; //What player is this for; it's always 1 less than the in-game number (example: "0" here is player 1)

//Get the Gold count
  aHouses := States.PlayerGetAllHouses(iPlayer);
  iGoldMissing := 300; //300 is the target quantity

  for i := 0 to Length(aHouses)-1 do if States.HouseType(aHouses[i]) = 11 then //Storehouses only
    iGoldMissing := iGoldMissing-States.HouseResourceAmount(aHouses[i], 7);

//Make sure that it doesn't go negative when the player has more than the target quantity
  if iGoldMissing < 0 then iGoldMissing := 0;

//Let's now add the text; use OverlayTextAppendFormatted if you're adding a new line instead of refreshing the whole text
  Actions.OverlayTextSetFormatted(iPlayer, '%s : %s Gold missing', [States.PlayerName(iPlayer), IntToStr(iGoldMissing)]);
end;

Post by memerion2 » 22 Mar 2018, 06:10

Re: My problems with dynamic scripts

Thanks for help:)

Now I want to do:You need 300 gold
And in msg write how much missing to 300 gold.

it will be better if you explain it to me.

Post by Esthlos » 21 Mar 2018, 18:23

Re: My problems with dynamic scripts

memerion2 wrote:I don't know what is wrong with this script.

You need to group them in a begin...end block, or else the program won't know that they are together.

  Code:
If (States.UnitPositionX(k) = 123) and (States.UnitPositionY(k) = 53) then begin
  Actions.UnitKill((k),true);
  Brama3;
end;

Post by memerion2 » 21 Mar 2018, 16:22

My problems with dynamic scripts

Hi! I have problem with this script:
If (States.UnitPositionX(k) = 123) and (States.UnitPositionY(k) = 53) then
Actions.UnitKill((k),true);
Brama3;

I want to: if unit "k" is at this coordinates (123,53) then do procedure Brama3 and kill unit"k"

I don't know what is wrong with this script.

Top