1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Seeking Rockets other then players

Discussion in 'Programming' started by **Monarch**, Mar 4, 2002.

  1. **Monarch**

    **Monarch** New Member

    Nov 29, 2001
    Likes Received:
    Hi all

    I'm trying to make a weapon that would fire rockets that would seek another projectile to destroy instead of a player is this possible?

    I've looked a the code for the eightball and the seeking rocket and tried adding projectile instead of enemy and a few other things which havent worked.

    Any Ideas ?
  2. TURY

    TURY SAS Lead Coder

    Nov 4, 2001
    Likes Received:
    it would definately help to post the code. But in the code somewhere there must be a

    if(other IsA('playerpawn')

    or something along that line... change it to what ever you want to seek. anyway, im just shooting blindly here, post the code :)
  3. Brood_of_Evil

    Brood_of_Evil Selene's martyr

    Nov 3, 2001
    Likes Received:

    If you're making a subclass of UT_SeekingRocket then all you would have to do is set the Seeking variable, to the projectile you want to seek. You could do an foreach iterator every Tick() or Timer() to look for the closest non friendly projectile, then when the proj is found, set it's value to Seeking. Of couse you would have to make the rocket faster so it can catch it's target.
  4. LedZep

    LedZep k last title kinda gay :p

    Jan 23, 2002
    Likes Received:
    i think you can do that:

    //in your weapon class type this:

    local seekingrocket sr;

    sr = spawn(class'seekingrocket'); // dont forget to specify where
    sr.seeking = [whatever you want it to look for];

    oh and if you want your rocket to seek the projectile closest to you, you can:

    local projectile pr, closestpr;

    foreach radiusactors(class'projectile', pr, [max distance from you], [your location])
    if (pr.owner != [your bot or weapon, i dont remember])
    if (closestpt == none)
    closestpr = pr;
    if (vsize([your location] - pr.location) < vsize([your location] - closestpr.location))
    closestpr = pr;

    closestpr is now the closest projectile to you that is not owned by you.
    i'm not completely sure since im pulling this off the top of my head.
  5. FrAgEdFragEd

    FrAgEdFragEd New Member

    Mar 4, 2002
    Likes Received:
    What to do??

    Alright its another late night and my head is pounding from the constant beating angainst my desk searching for the right code.

    I figure Monarch and I have one of two options:

    1. To have two projectiles for the primary fire one that seeks and one that does not. (Example UT_Eightball).

    2. or maybe one projectile and in the script for the one projectile would be a condition that must be met inorder for the projectile to seek.

    You guys tell me cause I am not a coder! I only do it cause I have to in order to finish this mod.

    I am going to try and sum up the situation to get you guys involved and maybe even help us out. We have a flying projectile that has unbalanced the game. And what we did is created a weapon that 'Seeks & Destroys' the unbalanced flying projectile. But now we have a new problem it seeks players just the same as the unbalanced flying projectile. So we want the new weapons projectile to act like a RocketMK2 with players, but if the unbalanced flying projectile gets into the picture the new weapons projectile should change to a seeking projectile after the unbalanced projectile.. .. .. I hope thats understandable?! I can post the code of either the projectile or the weapon let me know. But lets first figure out the best course of action to take. Maybe there is a better way to do this so please don't hesitate to make any suggestions or what ever.. I check the post tomorrow and see what you guys come up with.
    Thanks again!

    "With out the facts you are just another person with an opinion."
  6. Papapishu

    Papapishu 我是康

    Jun 18, 2001
    Likes Received:
    The RL uses another rocket when ti's been locked on target.
    It's called 'seekingrocket' or something.
    You should find it in the code.
    the RL searches for any pawn that is visible, and enemy, and within range, and tells the seeking rocket to target him.
    what you want to do is alter this check so that it looks for projectiles instead, exchange pawn for projectile.
    Check how it works and if it locks on to projectiles.
    If it does, you would also check if the projectile's owner is on the same team (not an enemy) and in that case, don't lock on.
    This check is done after a second or two, but if you do it immediatley when the weapon is idle, and you keep track of the closest enemy projectile, in front of you, you'll have pretty much what you want.
    Do this in a timer set to, say 10 times a second
    You should do the weapon first fire, like this, that when you shoot it, it locks on to the nearest enemy projectile.
    altfire could be something like slower but more accurate anti-projectiles

    Remember that this won't work with tracefire weapons like sniperrifle, shockrifle and enforcer, unless you make it support that kind of weapon.
    You could do something like this:
    when the weapon out-prioritises the projectiles in any way, like if there arent any within range, it can look for scanhit weapons, and tries to place themselves between the weapon and the player who shot them (some advanced vector math needed).
    That'd be hard but it'd sure look cool when your projectiles cover the view of that sniper over there, traveling towards him, threatening to kill him

    Also make sure that the projectiledont change target all the time.
    It must stick to the given target, or it'll act confused when there's more than one hostile projectile...

Share This Page