
Dynamic Script Usage Questions
Can't wait to see your contest map, your ideas seem pretty interesting and I'm sure I'll like it !
Re: Dynamic Script Usage
Hello, is there a way to setup 'teams' using dynamic script such that you can use chat to team feature. Situation is like this: when you setup teams in lobby, all works perfectly, you can chat to team only. But: when you setup alliances using script (e.g. on mission start), you cannot chat to allies (chat to team is not present, since no player had selected team, not sure how it works when teams are selected in lobby and alliances messed up by script). I have no idea how 'teams' are implemented, since I am too lazy to search source for it, but if you use Actions.PlayerWin with TeamVictory set to true, all your allies are also set to victorious (I repeat, your 'allies', not your teammates as set in lobby), (again, not sure if teammates as set in lobby are victorious despite being your enemies).
So to reformulate it: ally and teammate are not the same when it comes to chat, but when it comes to proclaiming victorious the team victory applies not only to teammates but also allies.
My problem arises when I want to setup alliances automatically, so that players don't have to pick teams, but in that case they are not able to 'chat to team only'.
Three obvious solutions are present: (1) to have chat to allies option, (2) to manage teams with dynamic script, (3) just setup manually
I understand that my problem is really low priority, but I would like to know what is difference between ally and teammate (apart from shared fog). I assume there could be done some fancy twists with script changing alliances, but team chat would then be broken... (if this was already asked somewhere then sorry, I didn't searched forums very thoroughly)
So to reformulate it: ally and teammate are not the same when it comes to chat, but when it comes to proclaiming victorious the team victory applies not only to teammates but also allies.
My problem arises when I want to setup alliances automatically, so that players don't have to pick teams, but in that case they are not able to 'chat to team only'.
Three obvious solutions are present: (1) to have chat to allies option, (2) to manage teams with dynamic script, (3) just setup manually

I understand that my problem is really low priority, but I would like to know what is difference between ally and teammate (apart from shared fog). I assume there could be done some fancy twists with script changing alliances, but team chat would then be broken... (if this was already asked somewhere then sorry, I didn't searched forums very thoroughly)
Re: Dynamic Script Usage
nvm wrong topic
Last edited by Tef on 30 Aug 2013, 17:26, edited 1 time in total.
Re: Dynamic Script Usage
nvm wrong topic
Re: Dynamic Script Usage
im thinking about ' States.KaMRandomI '. I use this OnStartMission and in single this is always predictable, even if i restart game. So my question is: it is predictable too in multiplayer?
Im making tournament script and need to randomize 4 players vs 4 players
Im making tournament script and need to randomize 4 players vs 4 players


Posts: 3822
Joined: 16 Sep 2007, 22:00
KaM Skill Level: Skilled
ICQ: 269127056
Website: http://lewin.hodgman.id.au
Yahoo Messenger: lewinlewinhodgman
Location: Australia
Re: Dynamic Script Usage
Yes, in the current release random numbers are predictable (under the same conditions the numbers will be the same). Once the mission has been running for a while you'll find that it's unpredictable because the players have influenced how many times random numbers were used. We are going to change this in the next release so it's not predictable even in OnMissionStart. More information here:
viewtopic.php?f=22&t=1805
viewtopic.php?f=22&t=1805
Re: Dynamic Script Usage
thanks Lewin 

Re: Dynamic Script Usage
Yes, in the current release random numbers are predictable (under the same conditions the numbers will be the same). Once the mission has been running for a while you'll find that it's unpredictable because the players have influenced how many times random numbers were used. We are going to change this in the next release so it's not predictable even in OnMissionStart. More information here:
viewtopic.php?f=22&t=1805

Love the Bomb!
Campaign http://knightsandmerchants.net/forum/vi ... f=5&t=1749
MultiplayerMaps http://knightsandmerchants.net/forum/vi ... f=5&t=2302
AutoComplete http://knightsandmerchants.net/forum/vi ... =32&t=2722
Campaign http://knightsandmerchants.net/forum/vi ... f=5&t=1749
MultiplayerMaps http://knightsandmerchants.net/forum/vi ... f=5&t=2302
AutoComplete http://knightsandmerchants.net/forum/vi ... =32&t=2722

Former Site Admin
Posts: 3814
Joined: 08 Jan 2009, 23:00
Location: California - Pacific Time (UTC -8/-7 Summer Time)
Re: Dynamic Script Usage
Is there, currently, a state that can detect how many blueprints a player has?
I used to spam this forum so much...
Re: Dynamic Script Usage
Hi guys,
I started learning dynamic scripts and I dont know where is problem here:
Thanks for answers!
I started learning dynamic scripts and I dont know where is problem here:
- Code:
var Warehouse02: Boolean; var School01: Boolean; var Inn01: Boolean; var Barracks01: Boolean; procedure OnMissionStart; begin //Warehouse, wares, School (Player 3) Actions.GiveHouse (2, 11, 109, 108); Actions.GiveWares (2, 1, 5000); Actions.GiveWares (2, 2, 5000); Actions.GiveWares (2, 7, 5000); Actions.GiveWares (2, 8, 5000); Actions.GiveWares (2, 10, 5000); Actions.GiveWares (2, 13, 5000); Actions.GiveWares (2, 27, 5000); Actions.PlanAddRoad (2, 107, 110); Actions.PlanAddRoad (2, 106, 110); Actions.PlanAddRoad (2, 105, 110); Actions.PlanAddRoad (2, 104, 110); School01:= Actions.PlanAddHouse(2, 27, 104, 109); end; procedure OnTick; begin //Inn (Player 3) if States.HouseIsComplete (School01) then begin Actions.PlanAddRoad (2, 107, 109); Actions.PlanAddRoad (2, 107, 108); Actions.PlanAddRoad (2, 107, 107); Actions.PlanAddRoad (2, 107, 106); Actions.PlanAddRoad (2, 106, 106); Actions.PlanAddRoad (2, 106, 105); Actions.PlanAddRoad (2, 106, 104); Actions.PlanAddRoad (2, 105, 104); Actions.PlanAddRoad (2, 104, 104); Actions.PlanAddRoad (2, 103, 104); Actions.PlanAddRoad (2, 103, 103); Actions.PlanAddRoad (2, 102, 103); Inn01:= Actions.PlanAddHouse (2, 13, 102, 102); end; //Barracks (Player 3) if States.HouseIsComplete (Inn01) begin Actions.PlanAddRoad (2, 106, 103); Actions.PlanAddRoad (2, 107, 103); Actions.PlanAddRoad (2, 107, 102); Actions.PlanAddRoad (2, 108, 102); Actions.PlanAddRoad (2, 108, 101); Barracks01:= Actions.PlanAddHouse (2, 21, 108, 100); //Weapons (Player 3) if States.HouseIsComplete (Barracks01) Actions.GiveWeapons (2, 19, 5000); Actions.GiveWeapons (2, 21, 5000); Actions.GiveWeapons (2, 17, 5000); Actions.GiveWeapons (2, 25, 5000); end; end;
Last edited by Vatrix on 13 Sep 2021, 14:15, edited 2 times in total.
Reason: Code box
Reason: Code box
I fixed The Shattered Kingdom and The Peasants Rebellion here!
Re: Dynamic Script Usage
@Vatrix: What is the problem with your script?
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
Re: Dynamic Script Usage
Oh I forgot to say 
I want to order AI to build a Inn after school is finished, but validator says me [Error] (28:39): Type mismatch
Where I have mistake?
I think 28=line, 39=letter, but I dont know what means Type mismatch.

I want to order AI to build a Inn after school is finished, but validator says me [Error] (28:39): Type mismatch
Where I have mistake?
I think 28=line, 39=letter, but I dont know what means Type mismatch.
I fixed The Shattered Kingdom and The Peasants Rebellion here!
Re: Dynamic Script Usage
This means that you are using the wrong type on line 28, letter 93. Look at that location, there you call a function with a variable School01. function description says it needs an Integer, but your variable is a Boolean - hence the type mismatch.
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
Re: Dynamic Script Usage
Yay, thank you 

I fixed The Shattered Kingdom and The Peasants Rebellion here!
Re: Dynamic Script Usage
hello,
i'm new to scripting and i have two question.
Is there a way to set this script(see below) repeats itself every 20sec??? or have i copy/paste the script(whitout the top line) and change the time?
also doesn't i get the items into my barracks.(not getting an error) am i doing something wrong or is it just an type-error??
i'm new to scripting and i have two question.
Is there a way to set this script(see below) repeats itself every 20sec??? or have i copy/paste the script(whitout the top line) and change the time?
also doesn't i get the items into my barracks.(not getting an error) am i doing something wrong or is it just an type-error??
Who is online
Users browsing this forum: Google [Bot] and 9 guests