Page 1 of 1

Few questions about KaM editor

PostPosted: 27 Mar 2019, 14:12
by kilominata
Hello Everybody! I hope you are all okay but here comes my few quesions about a project that I am determined to do... but Idk if the editor has some features:
-Is there a way to set a winning challenge that if you will collect "x" amount of resource in your storage you will win mission?
-Is there a way to set a massages in game that telling you for example "food is low" when your wine/loaf/sausages/fish being down to a certain amount?
-Is there a way to set a losing/winning challenge about killing certain unit? (for example, you lose if your only 1 barbarian die (but exactly this one) and same about enemy?)

Thanks in advance for answering and helping me to find anyway to set those up because I would like to use some of those in my new campaign

Re: Few questions about KaM editor

PostPosted: 27 Mar 2019, 15:20
by Esthlos
Dynamic Scripting is the "yes to all" to your questions. :P

https://github.com/Kromster80/kam_remak ... icTutorial

Re: Few questions about KaM editor

PostPosted: 27 Mar 2019, 17:27
by kilominata
ouch thanks! I think I will have to learn much before starting the actual working things, anyway, let me say that I wanted (and I am motivated to) create a campaign with 21 missions not exactly 1:1 but nearly same as the good old game called "Stronghold" for that I wanted to know if there is a way about the exact unit killed/lost as they would indicate being a "Lord" of the town, thanks mate!

Re: Few questions about KaM editor

PostPosted: 27 Mar 2019, 17:57
by Esthlos
kilominata wrote:there is a way about the exact unit killed/lost


Sure!
If the lord is a Warrior unit (the armored Barbarian) and the human is player 1, then this code should be able to handle that:

  Code:
procedure OnUnitDied(aUnit: Integer; aKillerOwner: Integer);
begin
  if (States.UnitType(aUnit) = 26) AND (States.UnitOwner(aUnit) = 0) then Actions.PlayerDefeat(0);
end;


Explanation:
  • OnUnitDied is the event that procs whenever someone dies
  • 26 is the unit type of the Warrior
  • 0 is the player id of player 1 (it's always 1 less than the player number - player 2's id is 1, player 4's is 3, etc)
  • PlayerDefeat(0) declares the player 1 (whose id is 0) defeated

This script essentially translates into "when a unit dies, if it was a Warrior and was owned by player 1, then player 1 is defeated"

Re: Few questions about KaM editor

PostPosted: 27 Mar 2019, 20:43
by kilominata
I see... that would be really good, yet no warrior units will be possible by other means, that's great help man! Thanks!