Page 19 of 26

Re: Dynamic Script Usage

PostPosted: 21 Aug 2013, 05:12
by Shadaoe
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 !

Re: Dynamic Script Usage

PostPosted: 25 Aug 2013, 13:48
by Duke Valennius
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)

Re: Dynamic Script Usage

PostPosted: 30 Aug 2013, 10:14
by Tef
nvm wrong topic
true... *cut* without paste

Re: Dynamic Script Usage

PostPosted: 30 Aug 2013, 15:18
by WollongongWolf
nvm wrong topic

Re: Dynamic Script Usage

PostPosted: 12 Sep 2013, 00:51
by RandomLyrics
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 :)

Re: Dynamic Script Usage

PostPosted: 12 Sep 2013, 01:15
by Lewin
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

Re: Dynamic Script Usage

PostPosted: 12 Sep 2013, 14:20
by RandomLyrics
thanks Lewin :)

Re: Dynamic Script Usage

PostPosted: 12 Sep 2013, 14:27
by Strangelove
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

Re: Dynamic Script Usage

PostPosted: 18 Sep 2013, 16:37
by Ben
Is there, currently, a state that can detect how many blueprints a player has?

Re: Dynamic Script Usage

PostPosted: 25 Sep 2013, 11:56
by Vatrix
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!

Re: Dynamic Script Usage

PostPosted: 25 Sep 2013, 12:09
by Krom
@Vatrix: What is the problem with your script?

Re: Dynamic Script Usage

PostPosted: 25 Sep 2013, 12:28
by Vatrix
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.

Re: Dynamic Script Usage

PostPosted: 25 Sep 2013, 13:25
by Krom
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.

Re: Dynamic Script Usage

PostPosted: 25 Sep 2013, 13:30
by Vatrix
Yay, thank you :mrgreen:

Re: Dynamic Script Usage

PostPosted: 15 Jan 2014, 15:58
by gold1
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;