Jump to content
Sign in to follow this  
colonel_klink

Multi Gun Positions

Recommended Posts

Klink, make the weapons boat class, give them the same water contact points as the ship its going on, but move the actual weapon to its position on the ship, then mix setvelocity and setpos (setvelocity to give you the correct yaw/pitch - setpos to make sure the weapon doesnt get out of sync with the boat)

If my ideas do not work, at least take them and alter them, im sure its a way to work the pitch and yaw out.

-ZiRo

Hi ZiRo

I've used the boat class for the guns, which is rather cool caos you get a bigger water spray. Setpos and setvelocity are at work too, but they don't seem to effect the pitch when used by script. However I am experimenting with dschulle's getpitch function to see if I can get the boat movement and translate that to a change in the height position of the guns. Going to tak a bit of math as the function returns as degrees. Alternatively I might pivot the guns from the pivot point of the boat and set the angles with the animate command. Once again it will take some math, but I think it will work.

Share this post


Link to post
Share on other sites

Optimistic news ,were waiting with anticipation. wink_o.gif

Share this post


Link to post
Share on other sites
Optimistic news ,were waiting with anticipation.  wink_o.gif

Using an animation point is totally a waste of time as the engine does not support animations upon animations execpt for weapons. So with the help of Dsculle's getpitch function I have worked out the angle of the boat as it moves, and now traslating that to an up/down movemnet of the guns. Fingers crossed and we'll be in luck biggrin_o.gif

Share this post


Link to post
Share on other sites

ok....*like in the oprahs* GO KLINK GO KLINK< U DO SKULL< U CAN DO IT!! GO>>>>KLINK!!!!

Ah....now to take a break crazy_o.gif

Share this post


Link to post
Share on other sites

Another possibility was:

You create points in your ship's memory LOD, exactly at the positions of the turrets. Name them "turret1", "turret2", ... Then you need one looping script and for each turret another script.

The looping script should look like following:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_ship = _this select 0

#loop

drop["cl_basic","","Billboard",0.01,0.001,"turret1",[0,0,0],0,1,0.7843,0,[0.1],[[0,0,0,0]],[0],0,0,"","\PBO_NAME\setTurret1.sqs",_ship]

drop["cl_basic","","Billboard",0.01,0.001,"turret2",[0,0,0],0,1,0.7843,0,[0.1],[[0,0,0,0]],[0],0,0,"","\PBO_NAME\setTurret2.sqs",_ship]

;; repeat this line for each turret, change the values "turret2" and "\PBO_NAME\setTurret2.sqs" for each turret

turret1 setDir getDir _ship

;; repeat

~0.1

? (alive _ship) : goto "loop"

exit

This script creates particles at the points you defined in the memory LOD before. These particles have a very short life time and call a script when they are destroyed. This script sets the position of the turret to the position of the particle, which is given in the _this variable.

An example for setTurret1.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;; _this = [x,y,z] - position of the particle

turret1 setPos _this

You had to change that slightly, since I think it wasn't good to use globals for the turrets. Also I don't know how this method hits on the performance, but I think not more than one with lots of maths.

-----------------------

Second possibility that comes to my mind:

Already tried to define LandContact points exactly on the bottom of the turrets, so they "stand" on the ship? Of course you'd need a RoadWay LOD on the ship. Now you had to set the height of the turrets once so they stand on the ship.

As the script is going you only set the x and y position, means

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_turret1 setpos [newx, newy, getpos _turret1 select 2]

I think that could work, since the turret would always stand on the ship, and would also move with it.

Share this post


Link to post
Share on other sites

Go Klink , Go Kliiink , you can do it ,Go klink.  biggrin_o.gif

Ad thx Hardrock for giving Klink extra hints.  wink_o.gif

Share this post


Link to post
Share on other sites

A little progress being made. Will do some more after a good sleep.

Anyway thanks to hardrock's drop snippet above, I have been able to accurately place spent cartridges and wing vapour trails drop points to some of my helos and aircraft. Thanks buddy. Don't yo just love these forums? (was scratching my head over that for ages)

Share this post


Link to post
Share on other sites
Anyway thanks to hardrock's drop snippet above, I have been able to accurately place spent cartridges and wing vapour trails drop points to some of my helos and aircraft. Thanks buddy. Don't yo just love these forums? (was scratching my head over that for ages)

wink_o.gif

Thats the same I use them for biggrin_o.gif

Share this post


Link to post
Share on other sites

klink this is awsome news. one question remains, will u relese this is a single addon? a part of ur otopia island or do we have to whait for the falklands mod? (notised the bofors) wink_o.gif

anyways klink keep up the awsome work biggrin_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]Another possibility was:

You create points in your ship's memory LOD, exactly at the positions of the turrets. Name them "turret1", "turret2", ... Then you need one looping script and for each turret another script.

Nice one, thats a much cleaner way of geting the positions. And pretty much covers getting the pitch and bank e.t.c of just about all vehicle types.

A couple of questions:

It does not have to be in a loop does it? I mean I understand why Col Klink needs the loop for updating turret positions. But if you just wanted the particals position once in a while. You could just remove the loop and call the script once?

How much of a hit in performance is it compared with getting the position of a cargo proxy?

Do the particals stray much from there point of creation, before you get there position?

And is there height returned as the usual OFP Z pos, relative to the ground rather than Height Above Sea Level?

Cheers

Hmm....probably dumb questions but I've nerver used the drop command.

Share this post


Link to post
Share on other sites
A couple of questions:

It does not have to be in a loop does it? I mean I understand why Col Klink needs the loop for updating turret positions. But if you just wanted the particals position once in a while. You could just remove the loop and call the script once?

How much of a hit in performance is it compared with getting the position of a cargo proxy?

Do the particals stray much from there point of creation, before you get there position?

And is there height returned as the usual OFP Z pos, relative to the ground rather than Height Above Sea Level?

It only has to be in a loop if you want to set the position of something steadily. You don't want the turrets to be set once and then they never move again. But if you need only the position, simply use the drop command or write yourself a script that you call once in a while.

I think the hit of the performance is not very big. If you'd use the cargo proxy only to get a certain position, then I think it's easier to use this method. Also I think that the cargo proxy would need more CPU since it has always to be set on it's position by the game.

No the particals don't stray much, since my example above is a particle that is basically pending, furthermore the lifeTime is very short so it's destroyed after 0.001 seconds, in this time it doesn't even have a chance to move.

I don't know the last one, you had to try it.

Share this post


Link to post
Share on other sites
Quote[/b] ]Posted on July 11 2004,08:03

--------------------------------------------------------------------------------

klink this is awsome news. one question remains, will u relese this is a single addon? a part of ur otopia island or do we have to whait for the falklands mod? (notised the bofors)

anyways klink keep up the awsome work

Will be released separate from Utopia. Bofors will be replaced possibly by a 30mm canno that was used on some PT boats

Quote[/b] ]Posted on July 11 2004,12:24

--------------------------------------------------------------------------------

and... do you can make a tut like the pseudo-proxyes tut ? pleaseeee

Thinking about it smile_o.gif

Quote[/b] ]It does not have to be in a loop does it? I mean I understand why Col Klink needs the loop for updating turret positions. But if you just wanted the particals position once in a while. You could just remove the loop and call the script once?

How much of a hit in performance is it compared with getting the position of a cargo proxy?

With the code continually accessing another script in the loop I am finding the guns don't update as quickly, therefore I am getting a bit of lag. If there was a means of grabbing the particle position within the script where the drop command is used then I think this lag would be eliminated.

Share this post


Link to post
Share on other sites
I have been able to accurately place spent cartridges and wing vapour trails drop points to some of my helos and aircraft

if only the memory point would move with turrets... but no sad_o.gif

Maybe it would help the lag if the particle was going the same velocity as the ship? add this to the loop:

_vel = (speed _ship) / 3.7

in the dropped particle's velocity array, put this:

[0, _vel, 0]

this should make the particle go the same speed as the boat, maybe it will make a difference.

Share this post


Link to post
Share on other sites
So with the help of Dsculle's getpitch function I have worked out the angle of the boat as it moves, and now traslating that to an up/down movemnet of the guns.

Would this happen to work on a tank?

Share this post


Link to post
Share on other sites

there's techniques for getting all the angles and pitches that you want I believe.... possibly even the direction a cars wheels are turned (haven't tested that yet) but the rest is possible...

Share this post


Link to post
Share on other sites

Klink ,any new progress?

Anyway ,keep it up ,we know you can do it. wink_o.gif

Share this post


Link to post
Share on other sites

Texturing the pt boats now. Have a seqential number system that works.

Still have a little rear gun bobbing, but at least all the guns will attack anything from a guy on the beach to most aircraft.

Had to boost up the ammo but it was needed otherwise the brownings would only attack men and trucks. Now they will shoot anything that moves.

Oh does anybody know how to switch off targeting your own men when using the mouse?

Share this post


Link to post
Share on other sites

Dont think you can do that...not sure though, never heard of not being able to target your own men lol

~Bmg

Ps. unless you don't want to target them ever!

Share this post


Link to post
Share on other sites

Nice to know youre making solid progress. wink_o.gif

Quote[/b] ]Oh does anybody know how to switch off targeting your own men when using the mouse?

You mean direct targetting or targetting by officer comando?

You can target youre own men with tank for ex. ,left click on man if you wanna target ,left click again on an empty spot ingame will deselect him.

When using commands ,you can use the target command and then a number for man to target ,and giving the no target order should deselect that ,or otherwise giving a target that is valid will work to.

But i guess this is all to obvious and not really what you wanna know....

Share this post


Link to post
Share on other sites
Dont think you can do that...not sure though, never heard of not being able to target your own men lol

~Bmg

Ps. unless you don't want to target them ever!

yes u can target ur own men biggrin_o.gif choose one of ur soldiers (lets say u have 12) press the F2 key to select the second soldier, go to the command menu while having the 2nd soldier selected, choose target / more, then select the soldier u wanna target (bobby burning for example) tounge_o.gif then he will target that guy, go to engage the press fire, there ya go he will now kill that person in ur squad smile_o.gif

pretty useless, but good if u wanna punsh someone in ur squad when he has done something u dont like, then u dont have to do the dirty work tounge_o.gif j/k

Share this post


Link to post
Share on other sites

because the PT boat entails the use of more than one model (ie separate ones for each gun as well as the boat) when targetting (as player) quite often the target reticule goes over one of the gunners.. of course the gunner on the forward deck of the pt boat turns to face the selected gunner and will fire. So the question is, can this be prevented?

Share this post


Link to post
Share on other sites

If I get it right yes this can be prevented.

Give the gunner like example 60 degrees fire point so he can't turn 180 degrees and other gunner too than they wont turn 180 degrees wink_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×