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

Re: Few questions about KaM editor

PostPosted: 14 Mar 2020, 11:59
by kilominata
Hello Once more, I know it's pretty old but the project is still on, but I found a problem, I can't properly set up a Victory Condition as: Collect X amount of a material, probably I just fucked up something/can't find a proper solution, could somebody help with a script where your Win Condition is to collect x amount of any resource?

Re: Few questions about KaM editor

PostPosted: 14 Mar 2020, 15:42
by grayter
Could you share your code?

Re: Few questions about KaM editor

PostPosted: 14 Mar 2020, 19:21
by kilominata
I tried to do it via "GetWaresCount" (so it should show up on screen) but Idk what else, I am 100% Noob to scripts and well barely got anything working (via help of people) :s

Re: Few questions about KaM editor

PostPosted: 15 Mar 2020, 08:17
by grayter
Again - Could you share your code?

Re: Few questions about KaM editor

PostPosted: 15 Mar 2020, 09:43
by kilominata
Ach I forgot, I will be home today's evening/tomorrow morning and I will paste it sorry