Jump to content
Sign in to follow this  
selfcommander

make tanks fire at empty building

Recommended Posts

I want to have an AI OPFOR tank drive up to BLUEFOR HQ warfare building and fire a shot at it destroying it. For the life of me I can't make it do that. I've tried searching google, wiki and forum. I have tried dofire, dotarget, dowatch, and doreveal. I have added "Destroy" and SAD waypoints to the building. I've tried dofire and dotarget on invisible BLUEFOR target (BMP vehicle with hideObject) that stand right before HQ (I guess tank can't see hideObject target, it fires on it if I remove hideObject) Nothing works. Tank will fire on BLUEFOR barracks while on the way to SAD waypoint but it just looks at HQ and doesn't fire. HELP!!!

Share this post


Link to post
Share on other sites

name the BLUFOR HQ something like HQ_West and put in the following:

_handle = this fireAtTarget [HQ_West ,"D81"];

this fires the Maingun of the T-72 at the target with the given name

Share this post


Link to post
Share on other sites
name the BLUFOR HQ something like HQ_West and put in the following:

_handle = this fireAtTarget [HQ_West ,"D81"];

this fires the Maingun of the T-72 at the target with the given name

I am using t-90 btw, but I don't think that matter much. Same main gun.

actually I noticed it works the same as doTarget - doesn't work by itself. The only string I noticed that works is this

doTarget HQ2; waitUntil {hui aimedAtTarget [HQ_West] > 0}; this doFire HQ_West;

that way it waits until it actually sees it then fires. But only once, it doesn't destroy the building. Do you know how to make it fire multiple times?

On the other hand it just seem to hate barracks, fires machine gun at them first then couple shots with cannon - killing them ( on SAD waypoint mode) do you know why that is?

Share this post


Link to post
Share on other sites

Well, you can do this pretty easily in the mission editor with a simple object.

  1. You are going to need to turn on object IDs in the mission editor. Some info on this can be found on the wiki page for the mission editor (I would direct link but I dont have enough posts :( ). Just search for Show IDs.
  2. Next, place a game logic on the map realtively close to the building. Make sure to set its class as an object.
  3. Then in the init field of this game logic, you need to set it to the following line:
    building_hq =position this nearestObject 81666


    NOTE: You need to change the number at the end to the ID of the building you are trying to destroy! The name "building_hq" can be whatever you want.

  4. Finally you can alter your existing code to fire at the building until it "dies"
    doTarget HQ2; waitUntil {hui aimedAtTarget [HQ_West] > 0}; while (not alive building_hq) do {this doFire HQ_West;};


Share this post


Link to post
Share on other sites

Thanks a lot. I am sure your solution would work. But I actually opted out for using barracks as a building that must be destroyed. When tanks get near it they shoot at it right away without any commands, but they ignore HQ for some reason, maybe there is some variable somewhere that changes that or something like that.

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  

×