Jump to content
Sign in to follow this  
AfrographX

Dotarget gamelogic problem

Recommended Posts

Hi,

I've a chopper that's piloted by a player and I want the gunner to point his gun always directly on the ground. Therefore I'm creating an invisible guy who's setpos beneath the chopper (only x and y position, no height). Than I ordered the heli to doTarget this guy:

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

...

_dir = (getdir _ch47 - 270)

_posx = (getpos _ch47 select 0)+(-1 * cos _dir)

_posy = (getpos _ch47 select 1) -(-1 * sin _dir)

_InvisT = "AFR_Invisible" createvehicle [0,0,0]

_InvisT setpos [_posx,_posy,0]

_ch47 doTarget _InvisT

...

The problem is ingame I get the yellow targetbox on the invisible guy but the gunner doesn't aim for the guy himself. Only when I rightclick the yellow box he targets the guy.

My question is...

...how can I make the gunner of the heli target the invisible guy automatically when the pilot is a player?

...is there a way to prevent the player from un-targeting the invisble guy again?

...I've heard that I could do the same thing I'm doing with my invisible guy with a gamelogic. I've searched the forums but couldn't find how exactly I've to proceed. Could you give me a hint?

Share this post


Link to post
Share on other sites

i can kinda see what your after, but to be honest its not my best subject, but seeing as no one else replied ,i will try to give my ideas :0.

because you said that he dosent target until told to, is the invisible guy revealed ? as in {gunner reveal invisibleguy} because it seems the gunner dont see him until the pilot reveals him.

also what is the rating of invisible guy ? addrating - 2001 ? could help ?

just my ideas ,its always hard unless i see it in editor > hope i aint made it worse ,gl

Share this post


Link to post
Share on other sites

I had more luck using:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Gunner CommandWatch _Pos

Than I did trying to target an object. But I've only ever used it with single crew vehicles, where the gunner is also the commander and there is no Player commanding the group.

I understand what your trying to do, but even if you got that side working I'm sure you would hit other problems. The gunner will try and react to whats going on around him. Although in your case you could probably disable his AI.

You could get the same effect using other methods, If you get the chance try and take a look at CSJ's hueghy's.

The MedEvac version has a litter you can raise and lower beneath the chopper. But it works on a similar principle, as your loading an injured guy into the litters cargo position.

Share this post


Link to post
Share on other sites

Isn't there any way of configuring your turret in a way that it's always facing the ground? Like

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">minElev=-180; maxElev=-180;

minTurn=0; maxTurn=0;

?

Share this post


Link to post
Share on other sites

yes I could do that, but then the gun would always be orthogonal to the chopper and wouldn't react to the pitch of the chopper.

Share this post


Link to post
Share on other sites

AI seems to look in the direction of unrecognized units (unknown, 10 oclock, 800...) when they are detected, regardless of what you tell them to target. This might be your problem. I had to use disableAI to get them to look where I wanted them to.

Share this post


Link to post
Share on other sites
Quote[/b] ]Therefore I'm creating an invisible guy who's setpos beneath the chopper (only x and y position, no height). Than I ordered the heli to doTarget this guy

If you could get the gun to reliable point in the correct direction. It would reduce the amount of scripting required for this kind of thing. But if you have to setpos a guy, to use as a target. Then your not really saving any CPU time.

You could just as easily have the cargo as a seperate object thats setposed. At least that way it will remain vertical?

Share this post


Link to post
Share on other sites

jep I think I'll return to doing that.

What I tried with the gun thingie is to actually have the cargo attached to the hook. Because with the normal cargo scripts like the one from BAS for instance (which uses setpos) the transported vehicle doesn't follow the heli's pitch in a realistic manner. Try it out to see what I mean, it just doesn't look like the real thing. Especially when the heli flies banks.

I guess we'll have to wait for Armed Assault or Game 2 to simulate realistic helicopter cargo transport.

Btw this is what the wip version looked like:

cargo_sys_A.jpg

cargo_sys_B.jpg

cargo_sys_C.jpg

Share this post


Link to post
Share on other sites

If you can get the load to sway naturaly using the gunner, then I'm sure it looks great compared to the rigid setpos commnd. It certainly looks good in the screen shots.

I take it, CommandWatch XYZ did not help?

What exactly is the problem? Will the gunner turn to a target half though the misison. Or is it impossible to get the AI to point the gun at the ground, in the first place?

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  

×