SWIFT88 0 Posted June 29, 2005 I wont lie i was working on a Multiple gun script for a vehicle and used Col. Klinks scripts to add it in... However..... I ran into a problem Any suggestions? Share this post Link to post Share on other sites
Footmunch 0 Posted June 29, 2005 I wont lie i was working on a Multiple gun script for a vehicle and used Col. Klinks scripts to add it in... However.....I ran into a problem Any suggestions? One of _browning, _posx, _posy or _posz are not what you think they are. Try putting the line: player globalchat format["%1, %2, %3, %4", _browning, _posx, _posy, _posz] just before the line giving you the error. Share this post Link to post Share on other sites
Footmunch 0 Posted June 29, 2005 no good mate..... What happened? The error should have been the same, but it should've flashed up something like: West(Alpha:1), 42423, 21342, 23 At the bottom... Share this post Link to post Share on other sites
UNN 0 Posted June 29, 2005 Quote[/b] ]no good mate..... Footmunch means your script is probably going wrong elsewhere. If your making a multi turreted boat then don't copy Col. Klinks scripts exactly. There is lots of code that just is'nt needed. Post the entire script, that way it will be easier tacking down any problems. Share this post Link to post Share on other sites
SWIFT88 0 Posted June 30, 2005 basically i have a Init running the one Script to bring the Weapon onto the Vehicle <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _vehicle = _this select 0 _gunner = gunner _vehicle ;only build on server ?!local _vehicle: exit _GPMG = "UKF_WMIKGUN" createvehicle [0,0,0] ;[_GPMG] join _vehicle _Commander = driver _vehicle _group = group _Commander "SoldierW" createunit [getpos _vehicle, _group,"", 0.5, "PRIVATE"] _aunits = units _group _j = count(_aunits) ?(_j<=1): goto "loop" _x=_x+2 #Repeat (_aunits select _x) moveincargo _vehicle _x=_x+1 ?( _x <=_J-1):goto "Repeat" _x=0 _x=_x+2 #Repeat2 (_aunits select _x) moveingunner _GPMG _x=_x+1 ?( _x <=_J-1):goto "Repeat2" #loop ~0.001 ?(not alive _vehicle): goto "die" _dir = (getdir _vehicle) _velo = (velocity _vehicle) _posx = (getpos  _vehicle select 0) _posy = (getpos _vehicle select 1) _posz = (getpos _vehicle select 2)+1.5 _GPMG setvelocity _velo _GPMG setdir (getdir _vehicle) ;?(player in _vehicle): goto "miss" #miss _GPMG setpos [_posx,_posy,_posz] goto "loop" #die _gunner = gunner _GPMG _gunner setdammage 1 ;_GPMG setpos [0,0,0] _GPMG setdammage 100 deletevehicle _GPMG Share this post Link to post Share on other sites
UNN 0 Posted June 30, 2005 I think it's these lines: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_posx = (getpos  _vehicle select 0) _posy = (getpos _vehicle select 1) _posz = (getpos _vehicle select 2)+1.5 try <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _Pos=getpos  _vehicle _posx = _Pos select 0 _posy = _Pos select 1 _posz = (_Pos Select 2)+1.5 Something like this might work better? I think it responds to movments along the hull better. Depends on how far out from the centre, the second gun is. You would have to alter you object and adjust the CamSetRelPos command parameters until you get the object in the right place. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Vehicle=_This Select 0 _Camera="Camera" CamCreate (GetPos _Vehicle) _GPMG = "UKF_WMIKGUN" createvehicle [0,0,0] _Camera CamSetTarget _Vehicle #L _Camera CamSetRelPos [2,4,1.5] _Camera CamCommit 0 _GPMG SetDir (GetDir _Vehicle) _GPMG SetPos (GetPos _Camera) @True If (Alive _Vehicle) Then {goto "L"} But if your initial method looks ok, use that. Less processing going on. Share this post Link to post Share on other sites
SWIFT88 0 Posted June 30, 2005 erm... how can i restrict the radius the setpos works at, as its kinda spining all over the show atm..... like over the bonnet etc Share this post Link to post Share on other sites
UNN 0 Posted June 30, 2005 sa8gecko made a sample addon, to test the thoery for land vehicles: M1 Machine Gun Turret Perhaps that might help? But for land vehicles the method does not work very well. As soon as you move up a slope, it all goes wrong. Share this post Link to post Share on other sites
SWIFT88 0 Posted June 30, 2005 tbh this script is fine.....as it does what it has been set to do..plus ive added a line in the config which allows the gun to go up and down with the vehicle itself Share this post Link to post Share on other sites
SWIFT88 0 Posted June 30, 2005 ill pm you some pics of it Share this post Link to post Share on other sites
SWIFT88 0 Posted June 30, 2005 sa8gecko made a sample addon, to test the thoery for land vehicles:M1 Machine Gun Turret Perhaps that might help? But for land vehicles the method does not work very well. As soon as you move up a slope, it all goes wrong. tbh that didnt help me one bit..... ive sorted the gun as i say, it goes up and down on the terrain! just need to prevent the gun from going in massive radius's around the model when i spin the vehicle for instance Share this post Link to post Share on other sites
UNN 0 Posted June 30, 2005 It's hard to say exactly what might cause that, without more info. I posted the link to the M1A1 as an example, makes any comparison easier. In this pic I've circled the centre point of the M1A1 MG. This point sits just above the top of the turret, so no collision displacment e.t.c with the rest of the tank. Do you have your MG centering on the vehicle itself? Using the CamSetRelPos you can position objects this way, but it only really works with boats. For land vehicles I would have used a reserved, game logic position to get the same result. But that might interfear with your gun aligning to the terrain. At least it did when I messed with our version of the M1A1. But I did not change anything in the config, so I'm not sure if the same thing is happening for you. What about the gemoetry LOD? The M1A1 MG had adjusted Gemoetry so as not to collide with the tank. We could get the MG to stay in the correct position, just not align with the terrain. I did try a few other combinations of LOD's, but again it was position at the expense of alignment or vice versa. Share this post Link to post Share on other sites
SWIFT88 0 Posted June 30, 2005 type autocentre=0; in the config and give that a go for the machine gun that abrams script didnt work...i must of been doing some-thing wrong Share this post Link to post Share on other sites
SWIFT88 0 Posted July 1, 2005 in the idiots guide to Swift..... how do you put the M2 on the M1 Share this post Link to post Share on other sites