Jump to content
Sign in to follow this  
franze

Troubleshooting klink's "proxy" missile tutorial

Recommended Posts

Well, just one issue really - when a vehicle reloads at a ammo truck, the "proxies" dont come back. I tried making it so that when the ammo count is at the max, they "show" again, but that didnt work. How do I pull this off?

Also are there any other ways to do multiple missile proxies? Basically my problem is I have 16 missiles that are not tube launched, and four that are tube launched. If I use the default proxy system and model the 16, then that means a single missile wont disappear until 2 missiles have been fired from either group. So, Klink's way is the only way of doing it AFAIK - just need to fix the reloading thing.

P.S. Just want to thank Klink for everything hes done!

Share this post


Link to post
Share on other sites

Is there a "reload" event handler? If not, then you could just

have a polling script (started by init) that continuously

checks the ammo state (with ammocount) and draws the

missiles in as they are added - something like (sorry if the

syntax isn't right, I haven't got comref in front of me):

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

_oldmiscount = _vehicle ammocount "YourMissileClassName"

#Loop

_miscount = _vehicle ammocount "YourMissileClassName"

~0.05

; Wait for the ammo count to change

?(_miscount == _oldmiscount): goto "Loop"

; Update the current count

_oldmiscount = _miscount

; Draw in the first

?(miscount == 1) : goto "DrawMis1"

; Draw in the first and second

?(miscount == 2) : goto "DrawMis2"

; Draw in the first and second and third

?(miscount == 3) : goto "DrawMis3"

goto "Loop"

#DrawMis1

_vehicle setobjecttexture[0, "\boing\missiletex.pac"]

goto "Loop"

#DrawMis2

_vehicle setobjecttexture[1, "\boing\missiletex.pac"]

goto "DrawMis1"

#DrawMis3

_vehicle setobjecttexture[2, "\boing\missiletex.pac"]

goto "DrawMis2"

(ie adapt Klink's drawmissiles.sqs)

Are the 4 and 16 different weapons? or is it an ammo load of

20 where you can only see 4 at a time?

Share this post


Link to post
Share on other sites

Well, its a AH-64D with a 16 Hellfire armanent and the four defensive Stinger missiles on the wingtips. When I try to make a line in the script that says when the Hellfires are at their max count, it'll reset the hellfire textures. It didn't work because after the last hellfire was fired, all the missiles reappeared without reloading. I don't know if there's anyway to detect when the helicopter is close to a ammo truck or has reloaded the ammo.

It's a small bug IMO, but it looks awful damn wierd to reload all those missiles and not have them reappear on the racks. It looks like other people have gotten around this (the Corsair addon for example) somehow.

As I see it, if the missile count changes, Klink's script will hide a missile. The question is how to make it so that if the ammo amount increases, the texture for a missile comes back. I'm sure theres a way to do it...

Share this post


Link to post
Share on other sites

Ok, got a very crude way of doing it - some bugs with it, but it beats nothing. Basically, after the last missile has been fired, it goes back to this part:

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

? _ah64 ammo "fz_lbhf" == 0 : goto "reloading"

? _ah64 ammo "fz_lbhf" == 1 : _ah64 setobjecttexture [0,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 2 : _ah64 setobjecttexture [1,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 3 : _ah64 setobjecttexture [2,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 4 : _ah64 setobjecttexture [3,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 5 : _ah64 setobjecttexture [4,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 6 : _ah64 setobjecttexture [5,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 7 : _ah64 setobjecttexture [6,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 8 : _ah64 setobjecttexture [7,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 9 : _ah64 setobjecttexture [8,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 10 : _ah64 setobjecttexture [9,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 11 : _ah64 setobjecttexture [10,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 12 : _ah64 setobjecttexture [11,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 13 : _ah64 setobjecttexture [12,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 14 : _ah64 setobjecttexture [13,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 15 : _ah64 setobjecttexture [14,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

? _ah64 ammo "fz_lbhf" == 16 : _ah64 setobjecttexture [15,"\fz_ah64d\agm114_1.paa"] and goto "reloading"

goto "chk_Weapon_status"

The bugs: if you fire missiles at ANY time during reloading, it causes problems. So you have to wait until you're finished reloading to have the "proxies" appear correctly. But hey, its a step in the right direction...

Share this post


Link to post
Share on other sites

Ok, that didn't work out so well - when I use the cannon after *all* missiles are spent, it lags out the game for some reason. It was due to the reloading part for some reason.

Share this post


Link to post
Share on other sites

I use the fake proxy idea, altho mine was in use before Klinks tutorial.

I know exactly what problem you are having, I have mine finally worked out ,just not complete in the released Beta Corsair

I use fired event handler to blank out the fired ones (it actually does count and correct any undrawn ones at that time)

But what I have done is this:

I have a manager running that keeps track of the ammo,when the ammo increases,I call my ammoman.sqs (same script I use with fired eventhandler) and it corrects any undrawn missiles

Share this post


Link to post
Share on other sites

This is really a confusing problem... In order to check the ammo count, you have to loop it. If you loop it, it gets VERY choppy if you fire other weapons on the vehicle, if the ammo for your weapon is empty. crazy_o.gif

Ah I don't know what I'm doing....

Share this post


Link to post
Share on other sites

You could try a little delay like:

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

#reloading

~0.1

? _ah64 ammo "fz_lbhf" == 0 : goto "reloading"

This will allow the game to ignore the script for a few

milliseconds and do the other things it needs to do.

Share this post


Link to post
Share on other sites

Ok, what I've done now is swapped the code around a bunch so that now it detects both positive and negative changes to the ammo load. It now will reset the textures. The catch: you have to fire a weapon to get the textures to change. Maybe if I try executing the script in the init field, it will work. I'll also try that delay thing, too.

Share this post


Link to post
Share on other sites

Success! What I did was, in my initialization script, was add this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_ammocnt = (_ah64d ammo "fz_lbhfeight")

~.1

? _ammocnt > 7 : _ah64d setobjecttexture [0,"\fz_ah64d\agm114_1.paa"] and _ah64d setobjecttexture [8,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnt > 6 : _ah64d setobjecttexture [1,"\fz_ah64d\agm114_1.paa"] and _ah64d setobjecttexture [9,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnt > 5 : _ah64d setobjecttexture [2,"\fz_ah64d\agm114_1.paa"] and _ah64d setobjecttexture [10,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnt > 4 : _ah64d setobjecttexture [3,"\fz_ah64d\agm114_1.paa"] and _ah64d setobjecttexture [11,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnt > 3 : _ah64d setobjecttexture [4,"\fz_ah64d\agm114_1.paa"] and _ah64d setobjecttexture [12,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnt > 2 : _ah64d setobjecttexture [5,"\fz_ah64d\agm114_1.paa"] and _ah64d setobjecttexture [13,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnt > 1 : _ah64d setobjecttexture [6,"\fz_ah64d\agm114_1.paa"] and _ah64d setobjecttexture [14,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnt > 0 : _ah64d setobjecttexture [7,"\fz_ah64d\agm114_1.paa"] and _ah64d setobjecttexture [15,"\fz_ah64d\ah64_hf1.paa"]

_ammocnts = (_ah64d ammo "fz_aim92")

~.1

? _ammocnts > 3 : _ah64d setobjecttexture [16,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnts > 2 : _ah64d setobjecttexture [17,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnts > 1 : _ah64d setobjecttexture [18,"\fz_ah64d\ah64_hf1.paa"]

? _ammocnts > 0 : _ah64d setobjecttexture [19,"\fz_ah64d\ah64_hf1.paa"]

Using the delay Footmunch told me to try - without the delay it gets all laggy, but with it, it works like a dream! Next phase will be to test it in multiplayer. The code above is in the main loop (which also checks for damage, etc.), so that every time it loops back, it checks the ammunition loads.

Thanks for everything guys!

Share this post


Link to post
Share on other sites

unfortunately setobjecttexture will have to run on every machine in mp

Share this post


Link to post
Share on other sites

So change it to public variable?

Also isn't it the point to have setobjtexture run on every machine?

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  

×