Jump to content
six_ten

[WIP] Black Powder mod

Recommended Posts

Theory:  hide anchor, spawn new anchor, rope attach sloop to anchor, gravity takes anchor down.     testing now...

Love finding stuff like this:  setting up the weight of my anchor, and lo and behold someone's written a thesis that tells just how to calculate that:  The History and Development of Old English Anchors  http://nautarch.tamu.edu/pdf-files/Jobling-MA1993.pdf

 

Edit:  well it works so far with    myRope = ropeCreate [sloop1, "RopeStarAnchor", anchor1, "RopeTie", 20]

now to hide the anchor on ship and spawn the new one, get the distance to seafloor to determine length of rope (it should be distance straight down plus a third more or so I think, there should be some slack in it) then attach the rope.  Then to figure out how to get the anchor back aboard...  And how to raise one from the seabed if the rope is cut or shot away...

 

KnMj0IF.jpg

 

The sloop drags its anchor.  How do I prevent that and make the anchor stay where it drops?   disable simulation ?

  • Like 5

Share this post


Link to post
Share on other sites

I like your project, your work is very high quality, but is it possible to get bigger images? the pic of cannon is quite small

 

cheers  ;)

 

also props for keeping the release content acheivable rather than the mods that start too ambitious with "we will have 10 factions, 100 ships and weapons"

 

As for using bayonet and switching back to rifle, make it a rifle attatchment like side slot or muzzle slot then you can PROBABLY code it in to firemode the same way you do in model.cfg

 

like in model.cfg you would have

 

class muzzleflash_hide
                        {
                                type="hide";
                                source="hasSuppressor";
                                selection="zasleh";
                                minValue = 0.0;
                                maxvalue = 0.25;
                                hideValue = 0.01;
                        };
 
 
 
where that would hide the muzzle flash if you have a muzzle attatchment,
maybe you could code that config.cpp into a new firemode to add a new "attack" option like how a gun can be semi auto or full auto, only for stabbing
 
Hope you can figure something out
  • Like 1

Share this post


Link to post
Share on other sites

Deltahawk, what do you have working on your ship so far and what questions do you have?

 

Not a lot honestly.  I tested out making the side hull ladders work.  Made a working concept for loading and off loading the ship's boats.  Tested moving the yards a little.  Figured out how to avoid the over size model visibility issue.  But besides that nothing.  My ship doesn't move because I don't know how to make the config for it :(

 

Does your sloop move just like a normal boat or have you scripted its movement?

Share this post


Link to post
Share on other sites

Not a lot honestly.  I tested out making the side hull ladders work.  Made a working concept for loading and off loading the ship's boats.  Tested moving the yards a little.  Figured out how to avoid the over size model visibility issue.  But besides that nothing.  My ship doesn't move because I don't know how to make the config for it :(

 

Does your sloop move just like a normal boat or have you scripted its movement?

 

I suggest the following:  copy the Samples_F sample mod into your P drive and get it to work with your custom name and graphics.  Then copy the Samples_F\Test_Boat_01 into your mod and get it to work (as is it won't work, so just getting them to run without errors is a good challenge).  Once they both run, copy them onto your desktop and start messing around with the sample boat -- remove parts of it and replace them with your model.  When (not if) stuff breaks, you have the working copy on your desktop to use to fix errors.  Proceed like that and you'll be able to drive your boat.  Try to skip this stuff and you'll remain frustrated. 

 

My sloop started as the test boat, as described above and still largely is.

Share this post


Link to post
Share on other sites

Okay so back to business -- I need to animate a weathervane aboard ship -- for now all I want is to get an arrow to point the direction the wind is blowing. 

 

I have an arrow model on the sloop, an axis for it, and its defined in model.cfg

Basically I want it to function like a compass needle but for wind direction.

 

Thought I could just modify the Compass but that doesn't work.  How do I translate the wind direction into a source that the weathervane can use?

Maybe an event handler in the ship's init...

Share this post


Link to post
Share on other sites

Just had an idea I'm testing now -- cutting up my Geometry Buoyancy LOD and making the sections named, to see if by shooting them I can get them to hide, and thereby put shots in at the waterline and put an enemy ship low in the water.  It might not work but if it does it will be cool (and really affect how sea battles go).

 

Edit:  was able to get the LOD cut up and assigned, the boat worked, but couldn't get it to sink the way I had in mind.  I'll put this aside for now.  I just found this line in the Samples_F\Test_Boat  

"    // Note animation sources cannot impact the mass with sea vehicles, this is just as example
    mass = 0; // If the phase is 1, the given mass will be added, otherwise, it will be subtracted"

 

I still would like to find a way to have the ship list when hit near the waterline.  Maybe dampers like on a car wheel?

  • Like 1

Share this post


Link to post
Share on other sites

Managed to get the ships to sail with the wind!  No engine required. 

 

Also have an idea for (haven't tested this part yet) getting the AI to sail similarly though using normal driving.  Refining now.  If I can get some help getting the windDir to animate my weathervane I'll be well along.  Also run into a problem where if I have more than one ship on the map the math gets confused and reports their direction instead of mine...

Share this post


Link to post
Share on other sites

Hey not sure if you still need help with the rope but this was good for me. (the deeper the water the more extra line at the bottom but it works pretty well).

This is just the lower rope action, I'll post the rest of the script if you want. Hope it helps!

_boat addAction ["Lower Rope",
{
	_boat = _this select 0;
	_id = _this select 2;
	_boat removeAction _id;
	_ropes = ropes _boat;
	{
		_ropeLength = ropeLength _x;
		_boatPos = getPosATL _boat;
		_seaFloor = _boatPos select 2;
		_newLength = (_seaFloor * 1.25) - _ropeLength;
		ropeUnwind [_x, 5, _newLength];
	} forEach _ropes;
}];
  • Like 1

Share this post


Link to post
Share on other sites

 

Hey not sure if you still need help with the rope but this was good for me. (the deeper the water the more extra line at the bottom but it works pretty well).

This is just the lower rope action, I'll post the rest of the script if you want. Hope it helps!

_boat addAction ["Lower Rope",
{
	_boat = _this select 0;
	_id = _this select 2;
	_boat removeAction _id;
	_ropes = ropes _boat;
	{
		_ropeLength = ropeLength _x;
		_boatPos = getPosATL _boat;
		_seaFloor = _boatPos select 2;
		_newLength = (_seaFloor * 1.25) - _ropeLength;
		ropeUnwind [_x, 5, _newLength];
	} forEach _ropes;
}];

 

Please post it  Thanks!  I still haven't figured out how to make the rope not stretch and snap but making progress.

Share this post


Link to post
Share on other sites

I ran into the same problem with stretching and breaking. Could raise the box up but would break if I drove too fast with it attached. I think the last thing I tried was the setmass command but I'm pretty sure it didn't work :(

 

Boat I used - B_Boat_Armed_01_minigun_F  ~ init -  this addaction ["Rope","rope.sqf",false]; ~

 

Box to lift - Land_CargoBox_V1_F  ~ name - cargo1 ~

 

rope.sqf (was still testing so excuse the inefficient coding)


	_boat = _this select 0;
	_plr = _this select 1;
	_id = _this select 2;
	_rope1 = ropeCreate [_boat, [0,-5,-2.5],2];
	_rope2 = ropeCreate [_boat, [0,-5,-2.5],2];
	_rope3 = ropeCreate [_boat, [0,-5,-2.5],2];
	_rope4 = ropeCreate [_boat, [0,-5,-2.5],2];
	_ropes = ropes _boat;
	_boat removeAction _id;

_boat addAction ["Destroy Rope",
{
	_boat = _this select 0;
	_id = _this select 2;
	_boat removeAction _id;
	_ropes = ropes _boat;
	{ropeDestroy _x;} forEach _ropes;
	_boat addAction ["Rope","rope.sqf"];
}];
_boat addAction ["Raise To Top",
{
	_boat = _this select 0;
	_id = _this select 2;
	_boat removeAction _id;
	_ropes = ropes _boat;
	{ropeUnwind [_x, 5, 2];} forEach _ropes;
}];
_boat addAction ["Lower Rope",
{
	_boat = _this select 0;
	_id = _this select 2;
	_boat removeAction _id;
	_ropes = ropes _boat;
	{
		_ropeLength = ropeLength _x;
		_boatPos = getPosATL _boat;
		_seaFloor = _boatPos select 2;
		_newLength = (_seaFloor * 1.25) - _ropeLength;
		ropeUnwind [_x, 5, _newLength];
	} forEach _ropes;
}];
_boat addAction ["Attach Rope",
{
	_boat = _this select 0;
	_id = _this select 2;
	_boat removeAction _id;
	_rope1 = (ropes _boat) select 0;
	_rope2 = (ropes _boat) select 1;
	_rope3 = (ropes _boat) select 2; 
	_rope4 = (ropes _boat) select 3; 
	[cargo1,[0.75,0.75,0.75],[0,0,-1]] ropeAttachTo _rope1;
	[cargo1,[0.75,-0.75,0.75],[0,0,-1]] ropeAttachTo _rope2;
	[cargo1,[-0.75,0.75,0.75],[0,0,-1]] ropeAttachTo _rope3;
	[cargo1,[-0.75,-0.75,0.75],[0,0,-1]] ropeAttachTo _rope4;
}];
  • Like 1

Share this post


Link to post
Share on other sites

Cool.  I'll mess around with it and let you know what I find out.  As for your messy coding, I'm so novice that I wouldn't notice. Working hard to learn though.

Share this post


Link to post
Share on other sites

Also run into a problem where if I have more than one ship on the map the math gets confused and reports their direction instead of mine...

I can't be sure since I don't have your code in front of me, but this sounds like a global variable problem.

My guess is that one of your script uses a global variable ("myVariable"), wich is a unique variable you can retrieve or override from another script. You should use a local variable ("_myVariable"), it will only exist in the thread it was created in and will remain local to each unit calling your script/function.

 

But then again it is hard to guess without seeing the code.

Share this post


Link to post
Share on other sites

I can't be sure since I don't have your code in front of me, but this sounds like a global variable problem.

My guess is that one of your script uses a global variable ("myVariable"), wich is a unique variable you can retrieve or override from another script. You should use a local variable ("_myVariable"), it will only exist in the thread it was created in and will remain local to each unit calling your script/function.

 

But then again it is hard to guess without seeing the code.

 

I appreciate that, thanks.  I'll post the code here in a bit, testing something now.

Share this post


Link to post
Share on other sites

Here's my code.  currently running this as a mission script so I can test fast, I want to figure out how to make it a part of the mod when I get it working.  Most of it is comments, I'm learning by trial and error (and a lot of reading the wiki etc) so I make notes as I go

 

init.sqf

Wind.sqf

Share this post


Link to post
Share on other sites

Just ran a big battle, looks cool as hell,. but sailing is a mess since the ships are getting each other's relative position to the wind.  But it sure looks good.

Share this post


Link to post
Share on other sites

I can't be sure since I don't have your code in front of me, but this sounds like a global variable problem.

My guess is that one of your script uses a global variable ("myVariable"), wich is a unique variable you can retrieve or override from another script. You should use a local variable ("_myVariable"), it will only exist in the thread it was created in and will remain local to each unit calling your script/function.

 

But then again it is hard to guess without seeing the code.

 

I've posted the updated code.  It works, but still gets confused when there are more ships afloat.

Share this post


Link to post
Share on other sites

I have to look at your OFP mods-horses and melee?! This I have to see for myself!

 

Prof Tournesol -- can we get them get them to work in ARMA 3?  I'd like to add a horse -- as of now, my cannon limbers drive like cars, very silly looking.

Share this post


Link to post
Share on other sites

I've posted the updated code.  It works, but still gets confused when there are more ships afloat.

Do you your ships still have trouble sailing?

Your updated code looks all right (besides a few tiny errors) - well, as far as I can tell, my maths suck! ^^

Share this post


Link to post
Share on other sites

Do you your ships still have trouble sailing?

Your updated code looks all right (besides a few tiny errors) - well, as far as I can tell, my maths suck! ^^

 

I'll check right now (spent the morning upgrading the gunboat and sails)  just about to test -- I tried last night and it still was reading the other ships' positions.  I'll let you know in a few minutes.

 

Edit:  Yes it is still reading all the boats instead of just the one I am in.  I wonder if running the script for the boat as it loads instead of as a mission script would fix it?

Share this post


Link to post
Share on other sites

Edit:  Yes it is still reading all the boats instead of just the one I am in.  I wonder if running the script for the boat as it loads instead of as a mission script would fix it?

No, that shouldn't make any difference.

I'm under the impression that part of your issue is that your debug hints aren't limited to the player, making it impossible to know what you're reading.

I took the liberty to change your code - moved a few things from the loop and limited the hint feedback to player :

_SailingVessel = _this select 0;
setWind [0, 10, true];
#define numQuarters 8

while {true} do {

	_VesselAzimuth = getDir _SailingVessel;
	_WindAzimuth = windDir;
	_QuarterAzimuth = (_WindAzimuth) - (_VesselAzimuth),
		
	_Quarter = round(_QuarterAzimuth / (360/numQuarters)) + 1;
	if (_Quarter < 1) then {
	      _Quarter = _Quarter + numQuarters;
	};
	if (_Quarter > numQuarters) then {
	      _Quarter = _Quarter - numQuarters;
	};

	sleep 1;

	_QuarterModifier = 1.00;
	if(_Quarter == 1) then {
		_QuarterModifier = 0.75;
		_SailingVessel animate ["Boom", 1.00];
		_SailingVessel animate ["Gaff", 1.00];
	};
	if(_Quarter == 2) then {
		_QuarterModifier = 0.80;
		_SailingVessel animate ["Boom", 0.75];
		_SailingVessel animate ["Gaff", 0.75];
	};
	if(_Quarter == 3) then {
		_QuarterModifier = 1.00;
		_SailingVessel animate ["Boom", 0.50];
		_SailingVessel animate ["Gaff", 0.50];
	};
	if(_Quarter == 4) then {
		_QuarterModifier = 0.90;
		_SailingVessel animate ["Boom", 0.25];
		_SailingVessel animate ["Gaff", 0.25];		
	};	
	if(_Quarter == 5) then {
		_QuarterModifier = 0.45;
		_SailingVessel animate ["Boom", 0.00];
		_SailingVessel animate ["Gaff", 0.00];
	};
	if(_Quarter == 6) then {
		_QuarterModifier = 0.90;
		_SailingVessel animate ["Boom", -0.25];
		_SailingVessel animate ["Gaff", -0.25];
	};
	if(_Quarter == 7) then {
		_QuarterModifier = 1.00;
		_SailingVessel animate ["Boom", -0.50];
		_SailingVessel animate ["Gaff", -0.50];
	};
	if(_Quarter == 8) then {
		_QuarterModifier = 0.80;
		_SailingVessel animate ["Boom", -0.75];
		_SailingVessel animate ["Boom", 0.75];
	};
	
	if (_SailingVessel == vehicle player) then {
		_hintText = "";
		switch (_Quarter) do {
			case 1 : {_hintText = "Right Before the Wind"};
			case 2 : {_hintText = "Wind on the Larboard Quarter"};
			case 3 : {_hintText = "Wind on the Larboard Beam"};
			case 4 : {_hintText = "Close Hauled to Larboard"};
			case 5 : {_hintText = "In Irons"};
			case 6 : {_hintText = "Close Hauled to Starboard"};
			case 7 : {_hintText = "Wind on the Starboard Beam"};
			case 8 : {_hintText = "Wind on the Starboard Quarter"};
		};
		hint _hintText;
	};
	
	sleep 1;

	_VesselHeading = direction _SailingVessel;//by the way, this should be the same as _VesselAzimuth
	_SailTotal = 0.9;
	_vel = velocity _SailingVessel;
	_WindForce = wind;

	_SailingVessel setVelocity [
		((_vel select 0) + (sin _VesselHeading * _SailTotal)) * _QuarterModifier, 
		((_vel select 1) + (cos _VesselHeading * _SailTotal)) * _QuarterModifier, 
		(_vel select 2)
	];
};

Maybe the above will help you having a clearer picture. ;)

Note that I didn't test it, but it should run just fine.

  • Like 1

Share this post


Link to post
Share on other sites

I'll check that out -- thanks!  

Nice that you should notice that -- I just came on to post to you that I am starting to think that just the hints are wrong; I set an AI sailing in a sloop and I sailed a gunboat.  My sails and speed were correct, even though the hints were reporting the AI directions.  I'll try your code and see what happens.

 

Edit:  your script works fine!  Very nice.

Share this post


Link to post
Share on other sites

Do you get intense lag when you have two sloops close together?  I get a lot of lag when I have two of my ships together.  I'm pretty sure it's because of the amount of geometry objects.

Share this post


Link to post
Share on other sites

Do you get intense lag when you have two sloops close together?  I get a lot of lag when I have two of my ships together.  I'm pretty sure it's because of the amount of geometry objects.

 

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.

Share this post


Link to post
Share on other sites

Maybe the above will help you having a clearer picture. ;)

Note that I didn't test it, but it should run just fine.

 

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

Share this post


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

×