Jump to content
six_ten

[WIP] Black Powder mod

Recommended Posts

So now that this works I have another question.  I have two kedge anchors at the bow.  Currently you can walk to them and heave them over the side.  (They're basically Door animations.)  What I'd like to happen is that when they're dropped, I introduce to the above calculations an _AnchoredOrNot variable that multiplies the velocity by 0.01 to just about stop the ship (I'd prefer using Ropes but they keep stretching and breaking, so for now I will just bring it to a halt).  I could add to the door animation script but how do I make that variable get read by the Wind script to stop the ship?

 

Anchor_DropAnchor.sqf

// _this select 0		object pointer
// _this select 1		door animation
(_this select 0) animate [(_this select 1), 1];  //anchor drops off the side of vessel
_AnchoredOrNot = 1.0;	//default velocity multiplier so there's no effect when anchor is aboard ship -- I want this to be used by the main Wind.sqf
while {true} do {
	_AnchoredOrNot = 0.01
];
sleep .01;

Anchor_WeighAnchor.sqf

// _this select 0		object pointer
// _this select 1		door animation
(_this select 0) animate [(_this select 1), 0];
_AnchoredOrNot = 0.01	//default velocity multiplier so ship is stopped when anchor is dropped
while {true} do {
_AnchoredOrNot = 1
];
sleep .01;

And then in the main Wind.sqf that powers the boats add

//all the other stuff from earlier plus
_VesselHeading = direction _SailingVessel;//by the way, this should be the same as _VesselAzimuth
_SailTotal = 0.9;
_vel = velocity _SailingVessel;
_WindForce = wind;
_AnchoredOrNot = 1
	
_SailingVessel setVelocity [
(((_vel select 0) + (sin _VesselHeading * _SailTotal)) * _QuarterModifier)*_AnchoredOrNot, 
(((_vel select 1) + (cos _VesselHeading * _SailTotal)) * _QuarterModifier)*_AnchoredOrNot,
(_vel select 2)
	];
};

How do I get that new variable from the Anchor script to the main wind script?  (I also want to use this to get a sail damage multiplier).

 

What I usually do for this is to assign a variable to the unit.

 

Anchor_DropAnchor.sqf would look like this :

(_this select 0) animate [(_this select 1), 1];  //anchor drops off the side of vessel
(_this select 0) setVariable ["AnchorSpeedCoef", 0.01];

You don't need a "while {true}" loop for this, variables don't change by themselves.

 

Anchor_WeighAnchor.sqf :

(_this select 0) animate [(_this select 1), 0];
(_this select 0) setVariable ["AnchorSpeedCoef", 1];

And then you only need to fetch that variable in your formula :

//all the other stuff from earlier plus
_VesselHeading = direction _SailingVessel;
_SailTotal = 0.9;
_vel = velocity _SailingVessel;
_WindForce = wind;
_AnchoredOrNot = _SailingVessel getVariable ["AnchorSpeedCoef", 1];//if "AnchorSpeedCoef" hasn't been created already, the default value is 1
	
_SailingVessel setVelocity [
(((_vel select 0) + (sin _VesselHeading * _SailTotal)) * _QuarterModifier)*_AnchoredOrNot, 
(((_vel select 1) + (cos _VesselHeading * _SailTotal)) * _QuarterModifier)*_AnchoredOrNot,
(_vel select 2)
	];
};

Another thing worth noting : (_this select 0) setVariable ["AnchorSpeedCoef", 0.01, true] will broadcast the variable across the network, but you probably won't need it if your code runs on the client rather than the server.

Broadcasting too many public variables can also impact performances.

  • Like 1

Share this post


Link to post
Share on other sites

Testing it now (thanks!).  It works!

 

I have to add an addAction to the driver since the boat kills him if he tries to run to the anchor while its moving...  searching google gives mission type results, is there a simple way to do it in the ship config instead of using the memory point trigger on the anchor?

 

I can see already that once I get all this set up it is going to require tuning; vehicle motion is a little jerky.  I'm going to first try reducing the sleep times, maybe that will smooth things out.

  • Like 1

Share this post


Link to post
Share on other sites

Testing it now (thanks!).  It works!

 

I have to add an addAction to the driver since the boat kills him if he tries to run to the anchor while its moving...  searching google gives mission type results, is there a simple way to do it in the ship config instead of using the memory point trigger on the anchor?

 

I can see already that once I get all this set up it is going to require tuning; vehicle motion is a little jerky.  I'm going to first try reducing the sleep times, maybe that will smooth things out.

My experience with vehicle configs is rather limited, but I think the CUP team managed to pull this of for their flight tanker - I also remember something like this for an AC130 (maybe the RHS one?).

Your best bet would be to contact someone from their team.

  • Like 1

Share this post


Link to post
Share on other sites

Now learning about createvehicle so I can have two anchors drop when the ship's anchor goes over the side (at the moment I'm doing one at a time til I figure it out).

 

Also need a solution to the sails -- the boom and gaff turn with the wind, but the sails get weird; tried using vertex painting in O2 with a translate axis, but they ignore the weighting; guess that would require an rtm (which I'm woefully ignorant of still (and I say woefully since I have to animate the manual of arms for my soldiers...))  -- really wish I could figure out the cfgCloth and get the sails to behave like flags do...

 

So here's my Anchor_DropAnchor script so far:

It works, except for the rope part, and it drops the anchor below the player instead of below the anchor.  (and I want also to change teh action from going up to the anchor and using the action, to haveing the dfriver do it)  Can I specify a position relative to the built-in anchor?  It would look cooler if it dropped straight from there and splashed into the water.  I put a memory point called "RopeTie" into the ring atop the anchor, and one in the sloop's starboard bow called RopeStarAnchor.  I think the script doesn't know how to connect them. (the rope script worked when I used the debug box and just placed named sloop and anchor in editor, but of course I want this to work for any player...

 https://community.bistudio.com/wiki/createVehicle

 

I think what I have to do is make another variable that adds some distance from the ship and throws the new anchors there.  Since in this mod I'm trying to stick close to history I want this:  http://www.hnsa.org/resources/manuals-documents/age-of-sail/the-elements-and-practice-of-rigging-and-seamanship/illustration-of-all-the-courses-which-a-ship-can-sail-with-a-given-wind/

 

HL1XQe4.jpg

 

and what I have so far is:

 

Mx3vdSRl.jpg

(_this select 0) animate [(_this select 1), 1];  //anchor drops off the side of vessel
(_this select 0) setVariable ["AnchorSpeedCoef", 0.00];

_DroppingAnchor = "Land_US_Cont_Anchor" createVehicle (position player);

myRope = ropeCreate [_this, "RopeStarAnchor", _DroppingAnchor, "RopeTie", 20]
  • Like 1

Share this post


Link to post
Share on other sites

I don't notice any lag at all even with a couple of dozen ships fighting (but of course that's a subjective opinion).  I've been careful in my modeling and texturing to make them efficient.  What are the stats on your models?  How many polys?  what size textures?  How many unique textures and shaders per model?  I'd like to see a screenshot too please.

 

I'm pretty sure it has something to do with the geo LOD.  My ship is a 6th rate frigate so the geo lod is large and has a lot of objects.  When I put two of my ships right next to each other, the lag is insane.  If they are some distance apart like 50 meters, there's no lag.  Playing around with my geo LOD confirm my suspicion when I removed every geo lod object except for the hull.  I'm looking for a way to mitigate this issue.  Maybe I can make a separate object with the internal geo LOD and attach it to the ship.

 

Update

I solved my intense lag issue.  I have a object I attach to my ship for certain functions like ladders.  I added all of the internal geo LOD to that object instead of my ship.  No more intense lag.

  • Like 2

Share this post


Link to post
Share on other sites

Trying to use a script to attach an object to a memory point on my sloop.  I keep getting an error:  "undefined variable in expression _vehicle."  How do I let the script know that the ship its triggered by is the one to attach to?  I don't get why it doesn't work; I use a similar method to attach rigging and guns to the ships when they load...

	_vehicle = (_this select 0);
	_ListingToPort = "Land_US_Water_Handicap" createvehicle[0,0,0];
	_ListingToPort attachto [_vehicle,[0,0,1],"P4Gun"];

Share this post


Link to post
Share on other sites

That error means that _this select 0 doesn't refer to anything in your script : something might be wrong with the way you execute/call your script (either you forgot to pass an argument, or didn't do it properly).

Share this post


Link to post
Share on other sites

Working on getting anchors to be cool...

Share this post


Link to post
Share on other sites

 i can disassemble the cannons and pick up theri parts, but the original cannon doesnt disappear like it should, and i cant assemble anything with the parts

edit:  fixing now...

Share this post


Link to post
Share on other sites

(fully working) tents config -- i can disassemble, carry, and reerect any of the tents or build them from parts.  Starting to think it would be nice to have them able to function as respawn points.  In large set piece battles the camps could then function as a secondary target -- if your team can capture the enemy camp you stop his reinforcements in that area... no idea how respawn works, and this is just something that's been turning over in my mind.   Really won't know how any of this works til I get it into a MP game and see how people use it as opposed to how I've been thinking about it.

 

I need a real crafting system instead of this method...

 

Edit -- I've made versions of the Wall and Wedge tents that can function as infantry respawn points.

Share this post


Link to post
Share on other sites

hi six, did it work? Curious if it really was the inheritance tree : )

Share this post


Link to post
Share on other sites

hi six, did it work? Curious if it really was the inheritance tree : )

 

It did work, but I don't know why.  Its weird, I do have custom inheritance on the tents and on the field fortifications, but they worked okay.  I'll have to do more testing to find out.

Share this post


Link to post
Share on other sites

I'm sure I'm missing something simple here but I can't see what..  Currently when a ship is sunk I have a killed EH that creates a bunch of bales and barrels full of gear, ammo, etc.  (in future I'd like for these to be filled by getting a percentage of what the player had in the ship's inventory (so there's an advantage in capturing rather than sinking the enemy) but for now they're pre-filled.)

 

These bales and barrels float around above the wreck and I want to make it so other players can sail up near the wreckage and collect the booty.

 

I still haven't figured out how to get the cargo on board (I'd like to haul it up and attach it to the deck I think then the player can open the bale or barrel and put the stuff in his ship's hold.  Not sure.  Anyone have any ideas?

  • Like 2

Share this post


Link to post
Share on other sites

Overhauling the wind system at the moment.

Share this post


Link to post
Share on other sites

Testers PM me for the updated dl link -- there's a new version as of this morning.

can i be a tester, please.

Share this post


Link to post
Share on other sites

I would also like to be a tester. I'm a military history enthusiast and I play Arma all day anyway.

Share this post


Link to post
Share on other sites

Piracy just became possible in Black Powder. 

 

The ships don't use engines, they're sail-powered.  I've just successfully tested a sail-damage modifier on the Bermuda Sloop and it works perfectly.   I'm sailing along at 16 knots -- wind is on the beam (thats the best angle for the sloop) -- I entered SailingVessel setHitPointDamage ["HitMainSail", 0.25];   and it slows the ship to to 12 knots.  setting damage to .5  slows me to 8 and a half knots.     damage at .75 slows me to 5 knots.

 

So a loaded merchant sloop is hauling cargo from Rum Point to Fishbone Island.  You spot him and angle to intercept but he's too fast?  Shoot his sails down and take that cargo!

 

Now to figure out how to make chain and bar shot ammo so they do more sail and rigging damage than ordinary cannonballs.  Anyone have any ideas how to make one particular kind of ammunition more effective against a certain kind of target?
 

  • Like 4

Share this post


Link to post
Share on other sites

All above sounds absolutely fantastic!

 

 

 

Now to figure out how to make chain and bar shot ammo so they do more sail and rigging damage than ordinary cannonballs.  Anyone have any ideas how to make one particular kind of ammunition more effective against a certain kind of target?
 

Could you use Hit or Hitpart eventhandlers and check what kind of ammo was used perhaps and give them some sort of damage modifier?

Or maybe run a script in the bullet when it hits something to check what it hit and apply damage that way? Now I might remember wrong but I think it could be possible through hiteffect.

  • Like 1

Share this post


Link to post
Share on other sites

All above sounds absolutely fantastic!

 

Could you use Hit or Hitpart eventhandlers and check what kind of ammo was used perhaps and give them some sort of damage modifier?

Or maybe run a script in the bullet when it hits something to check what it hit and apply damage that way? Now I might remember wrong but I think it could be possible through hiteffect.

 

You know, hiteffect sounds like it might work -- after all the engine must check surfaces for the effects.  I'll dig into it.  Thanks!

Share this post


Link to post
Share on other sites

I've been trying to fix this for days and just can't see why its not working -- can anyone spot why my gunner getin memory points arent working -- I have this long list (12) of turrets in the useraction menu, which I also want to remove -- i only want players to get in the turrets by walking up to the guns on deck and getting the option for that gun.

 

Here's a labelled overhead view of the gundeck. 

1.  How do I activate the gunnergetIn points (as far as I can tell they're all correctly set and yes they exist in the memory LOD)

2.  How do I get rid of the useraction text menu -- I only want players to access the cannons directly through the getIn points.

 

MhKAVZn.jpg

  • Like 1

Share this post


Link to post
Share on other sites

just thinking out loud here... I wonder if it is possible to move the AI aim target memory point in the ship via script -- something like if _SailDamageCoef < 0.5 then  ... and move the point to be near the sail hitpoints, then when the _SailDamageCoef is bad enough to have slowed the enemy ship down significantly, move the point to the hull and crew, and switch ammo accordingly from bar or chain shot to ball and grape...

Share this post


Link to post
Share on other sites

Is the problem that all the getin  commands are active in the useraction menu at the same time? or that you can jump from gun to gun? or both?

This might be useful, though the description indicates it might not work for this issue. It migh work that if you set it really low, only the memorypoints are then accessible if the circular action area is not in the way.

This would help with the later if its an issue, all the guns could have only one compartment, or guns next to each other could share compartments so you could jump from gun to the next, but not just any gun.

One way could also be get rid of all get in actions and create custom get in commands via the class useraction and script them as you want. 

Share this post


Link to post
Share on other sites

Is the problem that all the getin  commands are active in the useraction menu at the same time? or that you can jump from gun to gun? or both?

This might be useful, though the description indicates it might not work for this issue. It migh work that if you set it really low, only the memorypoints are then accessible if the circular action area is not in the way.

This would help with the later if its an issue, all the guns could have only one compartment, or guns next to each other could share compartments so you could jump from gun to the next, but not just any gun.

One way could also be get rid of all get in actions and create custom get in commands via the class useraction and script them as you want. 

 

"Is the problem that all the getin  commands are active in the useraction menu at the same time? or that you can jump from gun to gun? or both?"

Yep.  There's a list of all guns in the user menu, and also you cannot access the cannons from their getIn points.  The only way to access any guns is to get in as driver or other cargo in vehicle, then move to a gun.  From any gun you also get the full list of guns.  When you eject or get out of a gun you land on the correct point, so I think some of it is working at least.

 

" It might work that if you set it really low, only the memorypoints are then accessible if the circular action area is not in the way.

Okay thanks!  you've helped solve part of it -- I followed your suggestion, lowered the radius of the getIn points and they are now accessible!  Now all that remains is to get rid of the list in the menu.

Share this post


Link to post
Share on other sites

The gunboat using her brand new bow gun -- a mighty 12-pounder - to shred the sails of and bring her quarry to heel offshore from Tangier.

  • Like 1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×