[ian-reeds-games] Re: Plans for the coming school year!

  • From: Richard Claridge <richard.claridge68@xxxxxxxxxxxxxx>
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Sun, 25 Aug 2013 15:10:43 +0100

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

Other related posts: