User Tag List

Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 33

Thread: Mystery Dungeon Script ;p [help wanted]

  1. #1
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.22%

    Mystery Dungeon Script ;p [help wanted]

    Wouldn't it be neat to have randomly generated dungeons, enemies, and screen layouts? Heck yeah! Well i'm currently trying my hand at the second one any ways...who knows, the rest may not be far off. Then youd have a ZC quest that's different every time through! Sweet.

    ...Anyways on to my script idea;

    Code:
    import "std.zh"
    
    //============================================================================
    // Creates 8 random enemies in ADDITION to current screen enemies. ;p hehe..
    // D0-D7 Enemies to be spawned
    // D0 being the weakest and    
    // D7 the strongest 
    //============================================================================
    ffc script random_enemy_generator{
    
        void run (int enemy1, int enemy2, int enemy3, int enemy4, 
                  int enemy5, int enemy6, int enemy7, int enemy8){
            int x;
            int y;
            int enemy_ticker = 8;         
            int RandNum = Rand(8);
            npc spawnee;
    
            while(true){
     
            for (int enemy_ticker = 8; enemy_ticker > 0; enemy_ticker -= 1) {
             
                 if (RandNum == 7){                  
                       npc spawnee = Screen->CreateNPC(enemy8);
                       spawnee->X = is_walkable(x);          
    		   spawnee->Y = is_walkable(y);
                       RandNum = Rand(7);          
               } if (RandNum == 6){            
                       npc spawnee = Screen->CreateNPC(enemy7);
                       spawnee->X = is_walkable(x);          
    		   spawnee->Y = is_walkable(y);
                       RandNum = Rand(7);
               } if (RandNum == 5){            
                       npc spawnee = Screen->CreateNPC(enemy6);
                       spawnee->X = is_walkable(x);          
    		   spawnee->Y = is_walkable(y);
                       RandNum = Rand(7);
               } if (RandNum == 4){            
                       npc spawnee = Screen->CreateNPC(enemy5);
                       spawnee->X = is_walkable(x);          
    		   spawnee->Y = is_walkable(y);
                       RandNum = Rand(7);
               } if (RandNum == 3){            
                       npc spawnee = Screen->CreateNPC(enemy4);
                       spawnee->X = is_walkable(x);          
    		   spawnee->Y = is_walkable(y);
                       RandNum = Rand(7);
               } if (RandNum == 2){            
                       npc spawnee = Screen->CreateNPC(enemy3);
                       spawnee->X = is_walkable(x);          
    		   spawnee->Y = is_walkable(y);
                       RandNum = Rand(7);
               } if (RandNum == 1){            
                       npc spawnee = Screen->CreateNPC(enemy2);
                       spawnee->X = is_walkable(x);          
    		   spawnee->Y = is_walkable(y);
                       RandNum = Rand(7);
               } if (RandNum == 0){            
                       npc spawnee = Screen->CreateNPC(enemy1);
                       spawnee->X = is_walkable(x);          
    		   spawnee->Y = is_walkable(y);
                       RandNum = Rand(7);           
    
                   } enemy_ticker = enemy_ticker - 1;
    
                } if (enemy_ticker < 1){
                  Quit();
                }
            }
        }
            bool is_walkable (int x, int y){
    
    	if(x<0 || x>240 || y<0 || y>160){
    		return false;
    	}
            return Screen->ComboS[y+(x>>4)]==0;
            }
    }
    OK, here is the next revision. It still doesn't work though. Something about bool(float) 23 error can't compile...It's out of my hands now, I could use some help.

    Comments, suggestions, help?
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  2. #2
    Developer
    ZC Developer

    Join Date
    Aug 2006
    Location
    Australia
    Age
    37
    Posts
    2,777
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    6,851
    Level
    25
    vBActivity - Bars
    Lv. Percent
    37.73%

    Re: Mystery Dungeon Script ;p [help wanted]

    Quote Originally Posted by Gleeok View Post
    Wouldn't it be neat to have randomly generated dungeons, enemies, and screen layouts? Heck yeah! Then youd have a ZC quest that's different every time through! Sweet.
    It's funny that you mention that...

  3. #3
    Wizrobe
    Join Date
    Dec 2006
    Age
    29
    Posts
    3,693
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    8,936
    Level
    28
    vBActivity - Bars
    Lv. Percent
    42.98%

    Re: Mystery Dungeon Script ;p [help wanted]

    Randomly generated dungeons, huh? So you made a script for random enemies, and bigjoe made a script for random screens. Now all we need is multiplayer and we basiclly have Zelda Four Swords. It's a good idea (then random enemy, not the multiplayer). The only thing is you should be able to say the enemies have to be within this catagory, so they are not completly random.
    Quote Originally Posted by rock_nog View Post
    Well of course eveything's closed for Easter - don't you know of the great Easter tradition of people barricading themselves up to protect themselves from the return of Zombie Christ?


  4. #4
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.22%

    Re: Mystery Dungeon Script ;p [help wanted]

    Quote Originally Posted by _L_ View Post
    It's funny that you mention that...
    You know, usually when you say "It's funny that you mention that", it's followed by a reference that would explain some connection to a related topic....


    The only thing is you should be able to say the enemies have to be within this catagory, so they are not completly random.
    Well, what I was trying to do is have the script choose random enemies from a pool of 8.(D0-D7)
    Although note that it's currently not in working condition yet.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  5. #5
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,506
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.29%

    Re: Mystery Dungeon Script ;p [help wanted]

    Need to be able to spawn randomly on walkable tiles.
    This simple function will do the job (I dunno who wrote it but it works good)
    Code:
    bool is_walkable(int x, int y)
    {
    	if(x<0 || x>240 || y<0 || y>160)
    	{
    		return false;
    	}
    return Screen->ComboS[y+(x>>4)]==0;
    }
    Call the function like so:
    if (is_walkable(ene->X,ene->Y)) {//its okay to spawn here;}


    Code:
    if (enemy_ticker >=1){
    might I suggest
    Code:
    for (int enemy_ticker = 8; enemy_ticker > 0;enemy_ticker -= 1) {
    They way you are doing it is not wrong, i just find it neater, and easier to keep track of a for loop.
    Code:
    enemy_ticker = enemy_ticker -= 1
    You'll want to change to:
    Code:
    enemy_ticker -= 1
    you can also do:
    Code:
    enemy_ticker = enemy_ticker -1
    (not -=)
    They both do the same thing.

    Besides those minor things your script looks good to me

    oh and btw, _L_ do you enjoy driveing ppl nutz with your cryptic remarks? :p

  6. #6
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.22%

    Re: Mystery Dungeon Script ;p [help wanted]

    Sweet, i'll use that and try to get a revision that works.
    } else { :mad:

    I got another update to add also.

    import "std.zh"


    Code:
    //------------------------------------------------------
    // Creates a closed shutter in a random direction as 
    // long as there is a wall.-
    // Once the enemies have been killed the shutter will open.
    // This will not overwrite essential doors added for specific
    // dungeon map layouts :)
    // Not used yet/ -random locked doors, boss doors, open doors-
    //------------------------------------------------------
    
    ffc script random_door_generator{   //ver1.0
    
          void run(){
    
          int RandNum = Rand(4);
          
              if (RandNum == 0 && Screen->Door[DIR_DOWN] == D_WALL){
                      Screen->Door[DIR_DOWN] = D_SHUTTER;
            } if (RandNum == 1 && Screen->Door[DIR_UP] == D_WALL){
                      Screen->Door[DIR_UP] = D_SHUTTER;
            } if (RandNum == 2 && Screen->Door[DIR_LEFT] == D_WALL){
                      Screen->Door[DIR_LEFT] = D_SHUTTER;
            } if (RandNum == 3 && Screen->Door[DIR_RIGHT] == D_WALL){
                      Screen->Door[DIR_RIGHT] = D_SHUTTER;
            }
        }
    }
    One small problem though....IT WONT CARRY-OVER!! Aaargh...

    I guess the reason it's not carrying over is because it runs once then stops, i'm not really sure how to stick in inside a loop that is always running without it messing up the original simple design. ..(Other than that, it works super good though :) )
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  7. #7
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,506
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.29%

    Re: Mystery Dungeon Script ;p [help wanted]

    Carryovers are glitchy, well mabye just touchy there are rules to how they work (I think C-Dawg is the 'daddy' of figureing those out)
    Stuff like your door script, are the kind of things that I personally would use a Global script for instead of an FFC script (but that is just me) You could also just put the FFC on every screen you want the script on (we have paste special-->FFC y'know)
    But if you are intent on the carryover thing look around the ZScript forum the laws of carryovers are in there somewhere

  8. #8
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.22%

    Re: Mystery Dungeon Script ;p [help wanted]

    OK, i'm working now on various changes to those, but the ffc paste special isn't pasting the script along with everything else, very annoying. Is it supposed too? Is there a bug in 579? I also couldn't find anything on carryover....hmm.

    Stuff like your door script, are the kind of things that I personally would use a Global script for instead of an FFC script
    Yeah but I was only intending it to be used for bonus/mini dungeons. Not for the whole game....although after I finish this quest I do intend to make a completely (half anyway) random dungeon spanning at least 15 maps/Dmaps.
    I've put my zc wizardry4 project on hold untill I can get all the item, and mystery dungeon scripts together.




    EDIT: I updated and made some changes to the initial script in post 1 but it not yet in working order...if you see what's wrong with it don't be shy.


    It's like C- said, "it's always easier to understand a script you wrote rather than a script someone else wrote."...
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  9. #9
    I shall exalt myself over all Armagedddon Games bigjoe's Avatar
    Join Date
    Apr 2000
    Age
    39
    Posts
    5,621
    Mentioned
    87 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,573
    Level
    24
    vBActivity - Bars
    Lv. Percent
    93.54%

    Re: Mystery Dungeon Script ;p [help wanted]

    Quote Originally Posted by russadwan View Post
    and bigjoe made a script for random screens. .
    My script hardly deserves recognition, as it primitive and lacks certain functions I'd like it to have. This is primarily because I don't know how to do certain things, like read from the FFC arguments and whatnot. I'll post the latest version of it anyway though.

    Code:
    ffc script randwarp_level1
    {
    void run ()
    {
    if(Game->Counter[CR_SBOMBS] == 32){
    Link->PitWarp(1,32);
    }
    else{
    Game->Counter[CR_SBOMBS]++;
    Link->PitWarp(1,Rand(31));
    }
    }
    }
    What this does is warps you to a random screen from 0 to 1E if you have less than 32 super bombs.(In the quest Im working on, I use the super bomb counter as a screen counter.)

    It is very important to note that the PitWarp function ignores dmap parameters, so if you use this script how it is, you will have to draw OFF of the dmap.

    If you have amassed 32 "screens", it warps you to the second boss room. From there, you are warped to the next "floor",using a screen that has a checker script:

    Code:
    ffc script check_level1
    {
    void run ()
    {
    if (Game->Counter[CR_SBOMBS] <= 15){
    Link->PitWarp(1,0);
    }
    else{
    Link->PitWarp(2,0);
    }
    }
    }
    IF anyone would like to improve upon these horrendously primitive scripts, then, by all means. By the way, Gleeok, I've already started on a random dungeon quest.

    Here are some shots.







    This is also a plug for 4matsy(a.k.a. Hypercrash) Those are his tiles.


  10. #10
    Octorok
    Join Date
    May 2007
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,506
    Level
    13
    vBActivity - Bars
    Lv. Percent
    11.29%

    Re: Mystery Dungeon Script ;p [help wanted]

    This is primarily because I don't know how to do certain things, like read from the FFC arguments and whatnot
    Useing the FFC args is simple, just define vars in run, like so:

    void run (int arg1, int arg2, int arg3)

    then you can use them in the FFC script just like any other var.

    If you ever have any script questions please feel free to ask in this forum (I know I asked some really newbish questions when I was learning ZScript, but DD and C-Dawg were very helpful) :)

    There really does need to be more good tuts on ZScript

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social