Map Database  •  FAQ  •  RSS  •  Login

Dynamic Script Usage Questions

<<

Shadaoe

Knight

Posts: 584

Joined: 28 Jul 2011, 22:00

Website: https://www.youtube.com/user/KaMRemake

Post 21 Aug 2013, 05:12

Re: Dynamic Script Usage

Nice work, exploding vagabonds, now this, what's next ? :P
Oh, so much more! (H) (H) (H) This and that are two examples of other (already finished) dynamic scripting stuff :) I hope Ben is starting to get ready because I'm currently putting it al in here!
Can't wait to see your contest map, your ideas seem pretty interesting and I'm sure I'll like it !
<<

Duke Valennius

User avatar

Militia

Posts: 44

Joined: 10 Jul 2013, 11:01

KaM Skill Level: Average

Post 25 Aug 2013, 13:48

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

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

Tef

User avatar

Lance Carrier

Posts: 64

Joined: 15 Apr 2013, 15:12

KaM Skill Level: Skilled

Post 30 Aug 2013, 10:14

Re: Dynamic Script Usage

nvm wrong topic
true... *cut* without paste
Last edited by Tef on 30 Aug 2013, 17:26, edited 1 time in total.
<<

WollongongWolf

Lance Carrier

Posts: 65

Joined: 09 Jun 2013, 19:26

KaM Skill Level: Fair

Post 30 Aug 2013, 15:18

Re: Dynamic Script Usage

nvm wrong topic
<<

RandomLyrics

User avatar

Sword Fighter

Posts: 298

Joined: 21 Jul 2013, 02:15

KaM Skill Level: Fair

Post 12 Sep 2013, 00:51

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

Lewin

User avatar

KaM Remake Developer

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

Post 12 Sep 2013, 01:15

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

RandomLyrics

User avatar

Sword Fighter

Posts: 298

Joined: 21 Jul 2013, 02:15

KaM Skill Level: Fair

Post 12 Sep 2013, 14:20

Re: Dynamic Script Usage

thanks Lewin :)
<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 12 Sep 2013, 14:27

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
Thanks lewin! This was drivin' me nutz. :P
<<

Ben

User avatar

Former Site Admin

Posts: 3814

Joined: 08 Jan 2009, 23:00

Location: California - Pacific Time (UTC -8/-7 Summer Time)

Post 18 Sep 2013, 16:37

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

Vatrix

User avatar

Council Member

Posts: 410

Joined: 19 Apr 2013, 20:30

KaM Skill Level: Veteran

Location: Czech Republic

Post 25 Sep 2013, 11:56

Re: Dynamic Script Usage

Hi guys,
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;
Thanks for answers!
Last edited by Vatrix on 13 Sep 2021, 14:15, edited 2 times in total.
Reason: Code box
I fixed The Shattered Kingdom and The Peasants Rebellion here!
<<

Krom

User avatar

Knights Province Developer

Posts: 3281

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 25 Sep 2013, 12:09

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

Vatrix

User avatar

Council Member

Posts: 410

Joined: 19 Apr 2013, 20:30

KaM Skill Level: Veteran

Location: Czech Republic

Post 25 Sep 2013, 12:28

Re: Dynamic Script Usage

Oh I forgot to say :D
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!
<<

Krom

User avatar

Knights Province Developer

Posts: 3281

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 25 Sep 2013, 13:25

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

Vatrix

User avatar

Council Member

Posts: 410

Joined: 19 Apr 2013, 20:30

KaM Skill Level: Veteran

Location: Czech Republic

Post 25 Sep 2013, 13:30

Re: Dynamic Script Usage

Yay, thank you :mrgreen:
I fixed The Shattered Kingdom and The Peasants Rebellion here!
<<

gold1

Blacksmith

Posts: 26

Joined: 05 Jan 2014, 20:24

KaM Skill Level: Average

Post 15 Jan 2014, 15:58

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??
  Code:
procedure ontick; begin if states.gametime = 10 then begin actions.givegroup(8,22,20,20,0,15,5); actions.givegroup(8,22,30,10,0,15,5); actions.givegroup(8,22,30,10,0,15,5); end; if states.gametime = 500 then begin actions.HouseAddWaresTo(21,17,100); end; end;

Return to “Dynamic Scripting”

Who is online

Users browsing this forum: No registered users and 4 guests