Announcement

Collapse
No announcement yet.

Help what code is needed?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help what code is needed?

    Hey there people!
    Because of the lack of replies to my initial post I'm reposting!

    I've created this boss monster that when he dies I want him to trigger the deaths of all the other monsters in the map.

    I've had a good read of all the reference material from the UDN, but I can't find a command (that compiles) to do this.

    this is what I've done so far, reclassed the warlord using the dying state from the monster class and stuck in some code called killSwitch but it doesn't compile!

    class BossWarLord extends WarLord
    placeable;

    State Dying
    {
    ignores AnimEnd, Trigger, Bump, HitWall, HeadVolumeChange, PhysicsVolumeChange, Falling, BreathTimer;

    function Landed(vector HitNormal)
    {
    SetPhysics(PHYS_None);
    if ( !IsAnimating(0) )
    LandThump();
    Super.Landed(HitNormal);
    }

    simulated function Timer()
    {
    if ( !PlayerCanSeeMe() )
    Destroy();
    else if ( LifeSpan <= DeResTime && bDeRes == false )
    StartDeRes();
    else
    SetTimer(1.0, false);
    }

    function KillSwitch(Monster P) //my wonderful,wonderful code...
    {
    killall.P;
    }
    }

    What code would I need to pull this off!

    I've looked at using Destroy,KillAll and KillBots, maybe I'm not getting the syntax right (I'm not a programmer).

    ANY help would be greatly appreciated!:cry: :cry: :cry:

    #2
    I'm not sure about the kill all/kill switch stuff you've got, but this is what I would do instead. In the timer method where the boss is derez'ing or just getting destroyed based on visibility, this is basically what you want for the other people too.. so I would rewrite the timer as such:

    (I haven't tried testing this, but off the top of my head this is the general way I would do it. It may require some tweaking/testing to get the proper effect)

    Hope this helps!

    simulated function Timer()
    {
    local Monster m;
    if ( !PlayerCanSeeMe() )
    {
    Destroy();
    foreach AllActors(class'Monster', m)
    {
    m.Destroy();
    }
    }
    else if ( LifeSpan <= DeResTime && bDeRes == false )
    {
    StartDeRes();
    foreach AllActors(class'Monster', m)
    {
    m.StartDeRes();
    }
    }
    else
    SetTimer(1.0, false);
    }

    Comment


      #3
      Hey Thanks for the response!

      Will this code that you've kindly provided need to be stuck into all the other monsters timers as well, or will it function correctly if its held only in the boss monster alone?







      Comment


        #4
        It should work in just the boss code, but its important to know what you're attempting to do if you're coding (even if you're not a coder). What this does is it has the boss iterate through each of the monsters and call the appropriate destruction method (derez if the boss is visible, simple destruction if not). Thus, as long as those Destroy() and StartDeRes() are methods in the Monster class (or derived from one of its superclasses), it should work without any additional effort. There is actually some changes you should/could do which would make this better. That is to leave the original code for the boss's timer and instead of just having all the other enemy's get destroyed in the same manner as the boss, have them deres or destroy based on their own visibility. I leave this to you to explore further.

        Comment


          #5
          Hey muchas gracias!

          Hey that works a treat thanks VERY much Kevinvee!

          Comment


            #6
            How do I make a wave wait for my custom monsters to die before moving ahead?

            Comment


              #7
              you necro'd a 4 year old topic? lol...

              Comment

              Working...
              X