Map Database  •  FAQ  •  RSS  •  Register  •  Login

Few questions about KaM editor

<<

kilominata

Post 27 Mar 2019, 14:12

Few questions about KaM editor

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

Esthlos

User avatar

Knight

Posts: 663

Joined: 23 Jun 2013, 16:02

KaM Skill Level: Beginner

Post 27 Mar 2019, 15:20

Re: Few questions about KaM editor

Dynamic Scripting is the "yes to all" to your questions. :P

https://github.com/Kromster80/kam_remak ... icTutorial
Just when you think you know something, you have to look at it in another way, even though it may seem silly or wrong. You must try! - John Keating, "Dead Poets Society"
<<

kilominata

Peasant

Posts: 2

Joined: 27 Mar 2019, 14:13

KaM Skill Level: Skilled

Post 27 Mar 2019, 17:27

Re: Few questions about KaM editor

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

Esthlos

User avatar

Knight

Posts: 663

Joined: 23 Jun 2013, 16:02

KaM Skill Level: Beginner

Post 27 Mar 2019, 17:57

Re: Few questions about KaM editor

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"
Just when you think you know something, you have to look at it in another way, even though it may seem silly or wrong. You must try! - John Keating, "Dead Poets Society"
<<

kilominata

Peasant

Posts: 2

Joined: 27 Mar 2019, 14:13

KaM Skill Level: Skilled

Post 27 Mar 2019, 20:43

Re: Few questions about KaM editor

I see... that would be really good, yet no warrior units will be possible by other means, that's great help man! Thanks!

Return to Dynamic Scripting

Who is online

Users browsing this forum: grayter and 3 guests