NathanKell
...
Now, _today's_ post.
And in the first few weeks in session, too! Fingers crossed here for ya JMV.
iamthejarha: I think it also has something to do with the position of the mast; further forward and she's a sloop, more in the middle and she's a cutter. But JMV is the expert and I await his post on it too. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid="
" border="0" alt="smile.gif" />
Re: `nation-stat` gen: what I mean is:
Let's take, say, Yacht.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> makeref(refShip,ShipsTypes[n]);
n++;
refShip.Name = "Yacht1";
// see below: refShip.Nation = FRANCE;
// ditto refShip.id = refShip.Name + "_" + refShip.Nation;
// ditto curid = refShip.id; ShipLookupTable.id.(curid) = `n-1`; // PS
// <snip extra properties>
MakeMultiNation(sti(refship.index));<!--c2--></div><!--ec2-->
And then:
Finally finished it, cross your fingers that it works.
What it's supposed to do is:
At the top of ships_init is an object that has one set of attributes for each nation, with the attributes for each nation being the multiplier to each base ship stat for that nation (i.e. England: 1.05x speed, turn; 0.95x max crew, 1.05x min crew).
The function, MakeMultiNation, will:
1. Make a copy of the ship's attributes (we'll be overwriting the original so we need the copy)
2. Check to see if it should be run (if ship has attribute skipmultinat, we stop the function, but first make sure the ship has an ID).
3. Generate a list of nations the ship will be copied for; if the ship has attribute(s) refShip.skipnat(nationnum) = true, we skip that nation number, i.e. if refship.skipnat0 = true we skip England.
4. We loop once for each nation (skipping those nations we found to skip).
A. Copy the original attributes into the current slot.
B. Go through all attributes in the shipstats.(current nation) and multiply each original ship's attribute by the one in shipstats.(current nation). I.e. origship.speedrate = 10.0; shipstats.n0.speedrate = 1.05; so refship.speedrate = 10.5;
C. Handle MaxCaliber separately because it's not a straight multiplier and it has a cap.
D. Detect if attribute should be an int or float (hardcoded for now, only speedrate and turnrate are treated as floats). If it should be int, round it.
E. Handle models
i. delete all models in refship.
ii. Go through origship's list of models. If the model has no nation assigned, and has no skipnation assigned, copy it. If it has skipnation assigned AND current nation is skipnation, or if it has nation assigned and current nation is NOT that, skip.
iii. If no models found for current nation copy origship model 0 over.
F. Assign refship.id (based on origship.id if there, else origship.name) and refship.nation (based on current nation).
G. increment ship slot and begin loop again
H. Return next slot so we can deal with the _next_ ship.
Extra attributes:
First, determine if ship has ID. If not, do not add ID, let makemultinat autogenerate it.
(Mostly we _will_ be giving rather than autogenerating IDs, since we will be using multiple models).
Then, _do not add nation attribute_. Well, you can, but it'll be overwritten. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid="
" border="0" alt="smile.gif" />
Then, if some nations do not get the ship, add refShip.skipnatX = true for each nation that doesn't get it.
Then, you add the models tree.
refShip.models.mX = modelname
And, if `nation-specific`, refShip.models.mX.nation = nationnumber.
And, if `nation-specific` all but one, refShip.models.mX.nation = nationnumber to skip.
However, if two or more (but not all and not `all-but`-one) nations get the model, you have to add each manually.
Lastly, add refship.models.qty = number of models.
Example:
Lugger
refShip.models.m0 = "Lugger1";
refShip.models.m1 = "Lugger2";
refShip.models.m2 = "LuggerPirate";
refShip.models.m2.nation = PIRATE;
refship.models.m3 = "LuggerNavy";
refShip.models.m3.skipnation = PIRATE;
refship.models.m4 = "LuggerEngFra"; //for Britain and France.
refShip.models.m4.nation = ENGLAND;
refship.models.m5 = "LuggerEngFra"; //for Britain and France.
refShip.models.m5.nation = FRANCE;
refship.models.qty = 6;
And in the first few weeks in session, too! Fingers crossed here for ya JMV.
iamthejarha: I think it also has something to do with the position of the mast; further forward and she's a sloop, more in the middle and she's a cutter. But JMV is the expert and I await his post on it too. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid="

Re: `nation-stat` gen: what I mean is:
Let's take, say, Yacht.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> makeref(refShip,ShipsTypes[n]);
n++;
refShip.Name = "Yacht1";
// see below: refShip.Nation = FRANCE;
// ditto refShip.id = refShip.Name + "_" + refShip.Nation;
// ditto curid = refShip.id; ShipLookupTable.id.(curid) = `n-1`; // PS
// <snip extra properties>
MakeMultiNation(sti(refship.index));<!--c2--></div><!--ec2-->
And then:
Finally finished it, cross your fingers that it works.
What it's supposed to do is:
At the top of ships_init is an object that has one set of attributes for each nation, with the attributes for each nation being the multiplier to each base ship stat for that nation (i.e. England: 1.05x speed, turn; 0.95x max crew, 1.05x min crew).
The function, MakeMultiNation, will:
1. Make a copy of the ship's attributes (we'll be overwriting the original so we need the copy)
2. Check to see if it should be run (if ship has attribute skipmultinat, we stop the function, but first make sure the ship has an ID).
3. Generate a list of nations the ship will be copied for; if the ship has attribute(s) refShip.skipnat(nationnum) = true, we skip that nation number, i.e. if refship.skipnat0 = true we skip England.
4. We loop once for each nation (skipping those nations we found to skip).
A. Copy the original attributes into the current slot.
B. Go through all attributes in the shipstats.(current nation) and multiply each original ship's attribute by the one in shipstats.(current nation). I.e. origship.speedrate = 10.0; shipstats.n0.speedrate = 1.05; so refship.speedrate = 10.5;
C. Handle MaxCaliber separately because it's not a straight multiplier and it has a cap.
D. Detect if attribute should be an int or float (hardcoded for now, only speedrate and turnrate are treated as floats). If it should be int, round it.
E. Handle models
i. delete all models in refship.
ii. Go through origship's list of models. If the model has no nation assigned, and has no skipnation assigned, copy it. If it has skipnation assigned AND current nation is skipnation, or if it has nation assigned and current nation is NOT that, skip.
iii. If no models found for current nation copy origship model 0 over.
F. Assign refship.id (based on origship.id if there, else origship.name) and refship.nation (based on current nation).
G. increment ship slot and begin loop again
H. Return next slot so we can deal with the _next_ ship.
Extra attributes:
First, determine if ship has ID. If not, do not add ID, let makemultinat autogenerate it.
(Mostly we _will_ be giving rather than autogenerating IDs, since we will be using multiple models).
Then, _do not add nation attribute_. Well, you can, but it'll be overwritten. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid="

Then, if some nations do not get the ship, add refShip.skipnatX = true for each nation that doesn't get it.
Then, you add the models tree.
refShip.models.mX = modelname
And, if `nation-specific`, refShip.models.mX.nation = nationnumber.
And, if `nation-specific` all but one, refShip.models.mX.nation = nationnumber to skip.
However, if two or more (but not all and not `all-but`-one) nations get the model, you have to add each manually.
Lastly, add refship.models.qty = number of models.
Example:
Lugger
refShip.models.m0 = "Lugger1";
refShip.models.m1 = "Lugger2";
refShip.models.m2 = "LuggerPirate";
refShip.models.m2.nation = PIRATE;
refship.models.m3 = "LuggerNavy";
refShip.models.m3.skipnation = PIRATE;
refship.models.m4 = "LuggerEngFra"; //for Britain and France.
refShip.models.m4.nation = ENGLAND;
refship.models.m5 = "LuggerEngFra"; //for Britain and France.
refShip.models.m5.nation = FRANCE;
refship.models.qty = 6;