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

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

Serf

Posts: 5

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

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

Serf

Posts: 5

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

kilominata

Serf

Posts: 5

Joined: 27 Mar 2019, 14:13

KaM Skill Level: Skilled

Post 14 Mar 2020, 11:59

Re: Few questions about KaM editor

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

grayter

Barbarian

Posts: 107

Joined: 18 Aug 2014, 12:06

Location: Poland

KaM Skill Level: Skilled

Post 14 Mar 2020, 15:42

Re: Few questions about KaM editor

Could you share your code?
<<

kilominata

Serf

Posts: 5

Joined: 27 Mar 2019, 14:13

KaM Skill Level: Skilled

Post 14 Mar 2020, 19:21

Re: Few questions about KaM editor

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

grayter

Barbarian

Posts: 107

Joined: 18 Aug 2014, 12:06

Location: Poland

KaM Skill Level: Skilled

Post 15 Mar 2020, 08:17

Re: Few questions about KaM editor

Again - Could you share your code?
<<

kilominata

Serf

Posts: 5

Joined: 27 Mar 2019, 14:13

KaM Skill Level: Skilled

Post 15 Mar 2020, 09:43

Re: Few questions about KaM editor

Ach I forgot, I will be home today's evening/tomorrow morning and I will paste it sorry

Return to Dynamic Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron