resetting a mg's angle after rotation

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Re: test

Post by wacko »

tltrude wrote:I think your problem is that you are not resetting the guns "pitch" and "roll", so it uses the old values. The old values can be read by printing the gun's "angles" when it is not in use. If you print the platform's "angles", The pitch and roll (first and last numbers) should be 0 all the time. The center number of "angles" is the yaw (left, right).
Sorry, don't get it :? Isn't 'pitch' the angle determining whether it looks up or down and 'roll' umm for a plane when it's wings go up or down.
I do print the $mg.angle and additionally $mg.angles, like I did above, no value of angles is equal to angle. Have u tried the example map?

@Fungus, the yawcenter is in fact the only thing I CAN update properly, dunno why...

@Lizardkid, as angle[1] depend not just on the rotation but also on where I dropped the mg (which would give an offset) and as angles[0] depends on whether I hold the mg or where I aim to...

omg my brains start smokin... would u give it a try?
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

:cry: no help here...
this makes a whole map idea die, too bad :(
tnx to those who tried, nevertheless
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Don't give up so soon m8 :wink: who said you have to use the buggy TurretGuns in mohaa? You could also just use a script_model or so and script it to aim with the player and fire when he's holding fire... just another option you might want to try :)
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

sure, i'll try that. But it sounds like a huge task for a scripting noob like I am. Is there any map/script where I could study something similar? Doing it 'from scratch' seems impossible for me :oops:
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

How about bdbodger's 88s?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Rookie One wrote:How about bdbodger's 88s?
if u were talking about his flakfire.scr, I'd be too stupid to adapt it :oops:

@jv, could u give me a little piece of a script i could play with? pleeease :wink:
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Yeah, that's what I meant. Basically, what you need to do that is to trace what the player's looking at and fire while (local.player.fireheld). :P

<EDIT>Here's the piece of code I use in my artillery support mod (a bit altered from Bjarne's scout mod) - self is the player here:

Code: Select all

local.fwd_vec = angles_toforward self.viewangles
			local.start = self gettagposition "Bip01 Head"
			local.hit_location = trace (local.start + local.fwd_vec * 64) (local.start + local.fwd_vec * level.ffe_sight_max) 0
</EDIT>
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Thanks. I can see that this is somehow doing what I'd need, but I'm far from understanding how it does :oops:
Rookie One wrote:...what you need to do that is to trace what the player's looking at...
huh??? is this what ur piece of code does? and then, how can i make the script_model turn to that errrm location? and would a simple script_model with model:statweapons/mg42_gun.tik know about commands like startfiring? and so on...hundreds of questions... oooh, m8, this is way too much for my little brains :?
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

$turret.angle = $player.angle

i think that would work. (how many times have i said this?)
oooh, m8, this is way too much for my little brains
nah, your little brains are too much for it, and they're getting bored because they're so underexerted :P
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

lizardkid wrote:$turret.angle = $player.angle
what for should I use the whole vector stuff, then? if it was that simple
lizardkid wrote:nah, your little brains are too much for it, and they're getting bored because they're so underexerted :P
nice of u to say so, but in this case :roll:
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

That wouldn't work as it would only change the $turret.angles[1] value. And that's right, script_model doesn't know the startfiring command. :(

Come to think of it, I reckon it would be easier to sort it out the way you tried at first...
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Rookie One wrote:Come to think of it, I reckon it would be easier to sort it out the way you tried at first...
As u might have heard behind my wailing, I miserably failed in doing so. But if u gave it a try, this would be more than welcome
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

I sorted it out. :D Well, kind of. :P If you do it like this:

Code: Select all

prep:
$mg glue $bipod
$bipod bind $platform
$platform rotateY 5
end
The only problem is that it snaps into an upright position... But I guess that's better than having it fly everywhere around? ;)

BTW I noticed that the MG seems to try to "reach" the platform in rotation, I mean, the more time you hold the MG the faster it will rotate when it snaps to the position. Kind of weird. :?

<EDIT>It's better to have a while loop setting the yawCenter of the MG because the player might slowly start slipping off the platform. ;)</EDIT>
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

wahooooo :D it's working perfectly, even in the map where I actually need it :D
imagining how much time i wasted because of binding instead of glueing that bastard makes me sick, but hey what the heck, it's working :roll:
thank you so much, m8. u'll get a plate of honor next to that mg in my crappy map :wink:
the problems u mentioned are no problems at all. upright position is perfect and the 'platform' isn't much rotating so that's fine, too.

hey, i'm feeling so much better now, u can't imagine 8-)
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Wow... :shock: Well, always glad to help. 8-)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply