Well, if you're going to have different randomisations for every map in the pack, then I think you can put the event in the specific map file, as in the file for the map in the maps folder. Sorry about confusing you with the scripts folder thing, it does work if you're using the same randomisation for all your maps, but it could cause problems if you have another map that uses my scripts. I forgot, as I'm just using one map for testing everything so it didn't make any difference to me. Hope that clears things up.
Abi-----Original Message----- From: Richard Claridge
Sent: Thursday, August 29, 2013 9:22 AM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! No, sorry still not with you totally. I understand what I need to put, but its where that I don't get. As the randomisation of units is going to be specific to individual maps where do I put it? Why am I not putting the @ sign in, and is this the only difference? If I put the file in the scripts folder like you said then its not going to be linked to my map at all. And if I put it in the map settings folder then if it does work, it will work for all the maps. Confused! Richard On 8/28/13, abigail prescott <abigail.prescott@xxxxxxxxxxx> wrote:
Well, apparently, the after_map_load event is part of the map, though Ididn't know about it before. It might be a new event in the latest version.What I meant by putting the arguments in the braces as usual, was that you would do the same as you did before when you were using the function with the after_perform event. The difference is that in this new version of TB, instead of writing after_map_load=randomise_unit_positions@, you can just write after_map_load randomise_unit_positions. I think you could also putthe event in the default map flags file or in the file for a specific map ifyou don't want to use it for every map in the map pack. So for example, you would write: after_map_load randomise_unit_positions { startunit: "troop transport", unit: "commando", minunit: 1, maxunit: 2, rangex: 2, rangey: 2 } Make sense?Don't paste that example. If you're going to use it, you'll have to type itout. My quotes seem to get messed up in email, and there could be other problems like that too. Abi -----Original Message----- From: Richard Claridge Sent: Wednesday, August 28, 2013 8:11 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! I don't think I get this, sorry. What do you mean put all the arguments in the brackets? If this isn't in the map pack itself then how will it work with the maps? Or am I missing something? On 8/28/13, abigail prescott <abigail.prescott@xxxxxxxxxxx> wrote:You may already know this, but I only realised recently, so I thought I'd tell you just in case. You can set events to happen when the map loads. This is useful for the randomise_unit_positions function because then you can have the map randomised at the start instead of having a skill to do it. Just create a new folder in the abigail prescott folder and call it Non script files. Then create a text file in that folder called event subscriptions. In that file, type the following: Event subscriptions 1 // parser version |events after_map_load randomise_unit_positions { } Just put the arguments in the braces as usual. Unfortunately, the map file hasn't been updated to the new parser version, but when it is, I've already got this script converted to work with flags instead of events. If anyone wants any of the other scripts updated, then I'll start on that one. I'll do all of them anyway, at some point, but if there are any specific ones people want, I can do that one first. Abi -----Original Message----- From: abigail prescott Sent: Monday, August 26, 2013 7:11 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! I'm glad you worked it out. Don't worry, I do stuff like that sometimes and it makes me feel quite stupid too, like when I was writing that naming units thing for Al, and made it so all units would be called bowmen... Abi -----Original Message----- From: Richard Claridge Sent: Monday, August 26, 2013 7:03 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! Hi Abi. It was me being stupid. I am so used to using flags in TB that I forgot I didn't need to use an underscore in the name, I could just use a space instead. So the script was looking for a troop_transport where on the map was a troop transport. Simple mistake I guess but I feel like a complete fool for not noticing it earlier. Oh well. Thanks for all your help. The script now works great, and it solves a problem for a map I wanted to create but wasn't really going to be able to, which should finish off my map pack nicely. Just need to wait for my sound guy to get me all the sounds I need and I'll be ready to go. But he does take his time. Thanks again. Rich On 8/25/13, abigail prescott <abigail.prescott@xxxxxxxxxxx> wrote:It seems to work for me when I use my units. There is a troop_transport already on the map isn't there? The function doesn't create the start unit, though I might be able to make it do that if you wanted it to. If you don't mind, could you send the skill file and both unit files? That way I can test exactly what you did on my map, and if there is an error in the file then I can fix that and send it back to you. Abi -----Original Message----- From: abigail prescott Sent: Sunday, August 25, 2013 10:00 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! Alright, I'll check that out now. Thanks for testing. Abi -----Original Message----- From: Richard Claridge Sent: Sunday, August 25, 2013 9:37 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! Hi Abi. Ian pointed out the extra comma, and I took it out but found the same result. The issue is definitely with the startunit. It works fine if I use starttilex and starttiley. Thanks for looking at this. Richard Sent from my iPhone On 25 Aug 2013, at 21:10, abigail prescott <abigail.prescott@xxxxxxxxxxx> wrote:There's a comma after the rangey: 2. The last argument doesn't need a comma after it, they're used for separation but if you put one at the end it might confuse the game because it thinks there should be another argument. Try getting rid of that last comma and see if that works. Abi -----Original Message----- From: abigail prescott Sent: Sunday, August 25, 2013 9:01 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! Sorry, you were right about the startunit, for some reason when I read it it sounded like you put in two unit parameters rather than a startunit and unit. I think the range should work without quotes, and I thought I had the startunit thing sorted, but clearly not. I'll test your script and see what happens. Abi -----Original Message----- From: Richard Claridge Sent: Sunday, August 25, 2013 8:25 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! Hi Abi. Thanks for your reply. I was only trying to have the commando appear randomly. The troop transport was down as the startunit, which I thought meant a point where the area would be centralised from. Have I misunderstood that? And what about what Ian was saying about the quotes around the numbers? is this necessary or have I done it right? Thanks Richard P.S. I've just tried it using a starttilex and starttiley instead of the startunit and it worked fine. So could it be something to do with using a unit instead of a point? On 8/25/13, abigail prescott <abigail.prescott@xxxxxxxxxxx> wrote:The event can only have one unit parameter set. If you want to have two units placed randomly with the same skill, you need to have another after_perform event for that unit. So you would have one event for the troop_transport, and then another for the comando. I'm pretty sure that's the problem but if not, I'll give it a closer look. Abi -----Original Message----- From: Ian Reed Sent: Sunday, August 25, 2013 6:33 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! Hi Richard, I haven't looked at Abi's scripts so she would probably answer this better, but I'll throw out what I see initially. The rangey: 2, should not have a comma at the end. The error you got is the engine complaining that Abi called the calculate method and passed in a string that didn't look like something it was supposed to calculate. This might be because the rangex and rangey arguments do not have quotes around the numbers. But again I haven't looked at her scripts so it could also be something different. Ian Reed On 8/25/2013 8:10 AM, Richard Claridge wrote:Hi Abi. I've just tried to use your randomise units script but with no luck. I'm sure its me doing something wrong but I thought I'd check with you. I've copied your script into a folder named after you in the TB scripts folder. I've then created the appropriate skill and put the following into it. after_perform=randomise_unit_positions@ { startunit: "troop_transport", minunit: 1, maxunit: 2, unit: "commando", rangex: 2, rangey: 2, } When my unit uses the script I get the following error and nothing happens. Error in script. Calling Context: randomise_unit_positions Filename: random unit positions.js Line: 43 Column: 11, 12 Input string was not in a correct format. Noesis.Javascript.JavascriptException: Input string was not in a correct format. ---> System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Int32.Parse(String s) at Game.CalculatedInt.ParseWithoutErrorChecking(String s) in C:\Data\Recent\TacticalRPG\TacticalRPG\CustomPoint.cs:line 490 at Game.SharedStateBase.Calculate(String s) in C:\Data\Recent\TacticalRPG\TacticalRPG\SharedState.cs:line 124 --- End of inner exception stack trace --- at Noesis.Javascript.JavascriptContext.Run(String iScript, String iScriptResourceName) at Game.JS.Run(String script, String callingContext) in C:\Data\Recent\TacticalRPG\TacticalRPG\JS.cs:line 106 Any ideas about this? Thanks Richard On 8/24/13, abigail prescott <abigail.prescott@xxxxxxxxxxx> wrote:That's fine, sometimes I forget that just because I know something it doesn't mean everyone else will get it. In the data for tb folder, there is a scripts folder. Make a new folder in that folder and put the randomise_unit_positions file into it. Then it depends on whether you want to have a skill randomise the map, or just make it happen when the player hits a key, (though I don't recomend that, as they could do it at any point of the game and I can't think of many situations where you would want that option to be available). Unfortunately, if there is a way to just make it happen as soon as the map was created, I don't know it. To make a skill that will randomly place units, make the skill file as usual and then add this line at the bottom: after_perform=randomise_unit_positions@ { } Then you put the parameters in the braces like this: after_perform=randomise_unit_positions@ { unit: "type of unit" } Does that make sense? Abi -----Original Message----- From: Richard Claridge Sent: Saturday, August 24, 2013 1:50 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! Hi Abi. I sort of understand this but not totally. Sorry :). What file does this randomise_unit_positions bit go in? Is it in the map file or what? Also do I follow the randomise_unit_positions with a : and then put the various other bits inside { }? Sorry for not being totally sure, I think this will make loads of map packs really interesting if it works. And I look forward to using it in my stuff. Thanks Richard On 8/23/13, abigail prescott <abigail.prescott@xxxxxxxxxxx> wrote:Here’s the link to a randomising function I wrote. All you have to do is make a new folder in the scripts folder and put this file in. Then you can use the randomise_unit_positions function in whatever event you want. The things you can set in the event are: starttilex and starttiley: for when you want to set the area starting from a certain tile. As tiles actually start at 0:0, not 1:1, you should subtract 1 from both numbers. startunit: For when you want to set the area around a certain unit, like the flag. Just write the name of the unit file in quotes. minunit and maxunit: the minimum number of units you want to spawn in this area and the maximum. A random number will be chosen ranging between these numbers. unit: the unit that you want to be generated in the area. Like the startunit value, just write the name of the unit file in quotes. rangex and rangey: the number of tiles you want the area to extend to, starting at the starting tile or startunit. I think that’s all of them. Don’t set the starttile values in the same event, the script just finds the first unit of the specified type if you set a startunit. I don’t know if this will cause problems, but I’m guessing you would only want the units to spawn around one unit and you would only have one flag. If you don’t set any starttile values or a startunit, then the unit will be randomly placed around the whole map. If anyone wants to use it to randomly place units around all the units of a specific type (e.g around every city on the map) instead of just the first one, then just find the break; line in the function and delete it. I think that’ll do it. https://dl.dropboxusercontent.com/u/94819755/randomise_unit_positions.txt From: abigail prescott Sent: Thursday, August 22, 2013 11:25 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! Yes, but they don’t need to be specified by the player. They could be set through the event or the script. Event might be better, because then other people who might want randomised maps can use it too. Technically, if a player did want to change the boundaries and they were set in the event, they could just edit the file with the event, but it’s still not the same as offering them the opportunity to restrict the enemy to a certain area where it’ll be easier to predict where they’ll be. Maybe it could work out a certain fraction of the map, that way the area would expand to fit the size of the map, and players would have to know how to script to change it. My idea was that you would set the starting point at the flag (because it makes sense for the units to spawn around the thing they’re protecting) and then four random numbers would be generated with set boundaries of highest and lowest possible numbers. These numbers would be the range of the area to the right, the range to the left, the range upwards and the range downwards. The problem is getting units to spawn, though I think if there was only a few types, you could set that in the event. Sorry if that doesn’t make much sense, but I’m writing things as I think of them and I really should get some sleep. Tomorrow I’ll think about it more and it’ll make more sense then. Abi From: Carlos Macintosh Sent: Thursday, August 22, 2013 11:06 PM To: ian-reeds-games@xxxxxxxxxxxxx Subject: [ian-reeds-games] Re: Plans for the coming school year! I need to define boundaries though. I couldn’t just hav the units all over the place.