1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

HOW TO automatically spawn blobs (rooms, boulders, lanterns, zombies, etc.) per Map

Discussion in 'Modding [KAG Classic]' started by Strathos, Dec 12, 2012.

  1. VanHuek

    VanHuek KAG Guard Tester

    Messages:
    751
    Any idea why my portal only spawns zombies when I hit it rather than go near it
     
  2. Zer0Striker

    Zer0Striker Shipwright

    Messages:
    139
    Try checking the difficulty settings in the portal config.
     
  3. VanHuek

    VanHuek KAG Guard Tester

    Messages:
    751
    What should the difficulty ideally be? And do you mean portal config or Director config?
     
  4. kaizokuroof

    kaizokuroof Agkubuk|'Kaizokuroof' Cilobakil, Roofpointy Global Moderator Forum Moderator Donator Tester
    1. PumpkinStars - [Pk#] - Inactive

    Messages:
    909
    I am only assuming here, but I think he means in the file(For windows 7, installed on C drive): C:\Users\%username%\KAG\Base\Entities\Rooms\Portal.cfg

    I couldn't find anything about difficulty though.
     
  5. VanHuek

    VanHuek KAG Guard Tester

    Messages:
    751
    Yeah difficulty is only in Director
     
  6. Zer0Striker

    Zer0Striker Shipwright

    Messages:
    139
    I think it is the director config, idk if this is how its supposed to work, but whenever you deal damage to the portal the difficulty increases, and that might be why zombies spawn when you hit it.
     
  7. PainGiver

    PainGiver Arsonist

    Messages:
    78
    I want to make a loop to kick bots every 5 or 10 seconds, how would I format this to make it loop?


    Code:
    kick("BOT BOT");
    BOT BOT is the bots names, since I changed them in the name config. Not sure how to code with this gamemonkey engine, but is that the right command and format to kick a specific player?
     
  8. Zer0Striker

    Zer0Striker Shipwright

    Messages:
    139
    Simply make a variable, I am going to use Variable nLoop as an example.
    Code:
    global nLoop = 1;
    while (nLoop == 1)
    {
    sleep(30.0);
    kick("BOT BOT");
    }
    The sleep isn't needed, but it is used as a delay for the kick process(So it won't cause lag, not sure if it will though). This loop will kick the bots in a game every 30 seconds. Hope this helped.
    Edit: Also the global part before the nLoop variable isn't needed either unless you plan on using multiple gms that use that variable.
     
    PainGiver likes this.
  9. PainGiver

    PainGiver Arsonist

    Messages:
    78
    Thank you so much. :D
     
  10. SDFS

    SDFS Horde Gibber

    Messages:
    5
    oh,i want use /msg in the .gm.But it return error.Do you know how to use /msg in the .gm?
    sorry,my English is poor
     
  11. VanHuek

    VanHuek KAG Guard Tester

    Messages:
    751
    serverMessage("2. New Life Rule- You remember nothing from your past life");
     
  12. SDFS

    SDFS Horde Gibber

    Messages:
    5
    OH thanks,and I found it in wiki.
     
  13. Zer0Striker

    Zer0Striker Shipwright

    Messages:
    139
    Meteor shower function I made with the spawner function(Tips are including for .gm script newbies):
    Code:
    global storm = 0;
    global meteorshower = function(amount){
        if (shower == 0){ //If a meteor shower isn't accuring at the moment initiate the operation.
          shower = 1; //Tells the script that a meteor shower has/is activated.
          print( "Message" ); //Replace "Message" with a message that tells the user that the function initiated successfully.
          serverMessage( `First Warning Message` ); //Replace "First Warning Message" with a message that tells the players that a meteor shower is coming.
          sleep(10.0); //10 seconds is the default amount of time. Feel free to change it to whatever you like.
          serverMessage( "Last Warning Message" ); //Replace "Last Warning Message" with a message that tells the players that the meteor shower has arrived.
          spawner(1,1,mapWidth - 1,1,`boulder`,`Entities/Items/Boulder.cfg`, number, 3); //Meteors(Boulders) are spawned with the spawner function.
          shower = 0; //Tells the script that the meteor shower has stopped.
        } else { //If a meteor shower is accuring already, display this message.
          print( "Error: A meteor shower is in progress." ); //You can replace this with anything you would like to replace it with.
        }
    };
    I recommend that you make a custom boulder for this function as the classic boulders won't do much damage(If any.) and has a very low chance of hitting a player.

    Edit: Here's a more advanced/improved version(I will add more tips later, I just don't feel like doing it right now. Disclaimer: This is pulled out from my .gm files themself, so some variables may be undeclared. Please tell me if there are any that I missed.), it uses a lot more variables than the one above, making it more complicated, but at the same time easier and quicker to customize:
    Code:
    //Meteorshower Function
    global storm = 0; //Declares the storm variable with a value of 0 or false in boolean terms.
    global meteorshower = function(numberRequested){
        amountSpawned = 0;
        x = 1; //These variables are used for the custom spawner function declared below.
        y = 1;
        if (storm == 0){ //If a storm isn't activated proceed.
          storm = 1;
          print( `Message` );
          serverMessage( "First Warning Message" );
          sleep(10.0);
          serverMessage( "Last Warning Message" );
          while(amountSpawned < numberRequested){ //This while statement spawns the meteors.
              meteorType = randint(1, 2); //This makes that amount of each meteor type random. If you want more meteor types, simply change 2 to the number of types you want and add another else if statement to the ones below.
              width = mapWidth - 1;
              height = 3;
              rX = randint(x, x + width + 1);
              rY = randint(y, y + height + 1);
              if(meteorType == 1){
                addBlob(`keg`,`Entities/Items/MeteorActivater.cfg`,rX*8,(rY+4)*8,4); //This makes the meteor explode on impact(Disclaimer: Doesn't work 100% of the time, but it gets the job done.)
                addBlob(`keg`,`Entities/Items/MeteorType1.cfg`,rX*8,rY*8,3); //I recommend you make the meteor types have different textures.
                sleep(1.0);
              } else if(meteorType == 2){
                addBlob(`keg`,`Entities/Items/MeteorActivater.cfg`,rX*8,(rY+4)*8,4);
                addBlob(`keg`,`Entities/Items/MeteorType2.cfg`,rX*8,rY*8,3);
                sleep(1.5);
              }
              amountSpawned = amountSpawned + 1;
          }
              storm = 0;
        } else { //If a storm is activated display this warning message to the admin(s).
          print( "Error: A storm is already activated, aborting the meteor shower function." );
        }
    };
     
  14. SDFS

    SDFS Horde Gibber

    Messages:
    5
    ROOM::addBlob(`room`,`Entities/Rooms/TunnelRoomExample`, (X-2)*8+4 , (Y-2)*8+4, Team);
     
  15. PixelatedHero

    PixelatedHero Catapult Fodder

    Messages:
    29
    It would be kind of like mobs spawning in terraria if you did it only with zombies. e.o
     
  16. sinnertie

    sinnertie Ministry of Hatred Forum Moderator Donator Tester
    1. PumpkinStars - [Pk#] - Inactive

    Messages:
    252
    You made this necro post just to add that? Please look at topic's last post date next time.
     
    Last edited: Sep 26, 2013
    Guitarman likes this.
  17. FunATuns

    FunATuns Builder Carry Donator

    Messages:
    114
    Could I add outposts with this method?