Jump to content

  •  

Photo

Monster query


  • Please log in to reply
2 replies to this topic

#1 MikZ

MikZ

    Advanced Member

  • Members
  • PipPipPip
  • 183 posts

Posted 11 April 2016 - 02:13 PM

Hello!

Please help me with this script, im new in sql query.
what i wanted to do is to summon different monster per level in devil square.
like 

level 1 :
 

        set .monsterset, query_sql("SELECT id, iname, hp FROM `mob_db` where LV <= 30 and LV >= 50 and hp < 500000 and MEXP = 0 and not iName='Treasure Chest' ORDER BY RAND() LIMIT 100", .monsterid, .monstername$, .monsterhp);
        for (set .@x,0; .@x<getmapusers("ordeal_1-1"); set .@x, .@x+1){
				set .monstercount,15;
                for (set .@y,0; .@y<.monstercount; set .@y, .@y+1 ) {
						set .monster, rand(0,.monsterset-1);
                        monster "ordeal_1-1",149,149,"[DS] "+.monstername$[.monster],.monsterid[.monster],.monstercount,strnpcinfo(0)+"::OnDevilDead";         
                        set .mob, .mob+.monstercount;
                }
        }

Level 2:
 

        set .monsterset, query_sql("SELECT id, iname, hp FROM `mob_db` where LV <= 51 and LV >= 70 and hp < 500000 and MEXP = 0 and not iName='Treasure Chest' ORDER BY RAND() LIMIT 100", .monsterid, .monstername$, .monsterhp);
        for (set .@x,0; .@x<getmapusers("ordeal_1-1"); set .@x, .@x+1){
				set .monstercount,15;
                for (set .@y,0; .@y<.monstercount; set .@y, .@y+1 ) {
						set .monster, rand(0,.monsterset-1);
                        monster "ordeal_1-1",149,149,"[DS] "+.monstername$[.monster],.monsterid[.monster],.monstercount,strnpcinfo(0)+"::OnDevilDead";         
                        set .mob, .mob+.monstercount;
                }
        }


Somehow I get error. debug 

 

[SQL]: DB error - Can't create/write to file '\tmp\#sql_2180_0.MYI' (Errcode: 2)
[Debug]: at Hercules\src\map\script.c:15851 - SELECT id, iname, hp FROM `mob_db` where LV <= 30 and LV >= 50 and hp < 500000 and MEXP = 0 and not iName='Treasure Chest' ORDER BY RAND() LIMIT 100
[Debug]: Source (NPC): MVP Grave at prontera (170,181)
 
Please help me fix this. thank you!


#2 MikZ

MikZ

    Advanced Member

  • Members
  • PipPipPip
  • 183 posts

Posted 13 April 2016 - 11:07 AM

Care to help? 


Edited by MikZ, 21 April 2016 - 11:54 AM.


#3 Cretino

Cretino

    Advanced Member

  • Members
  • PipPipPip
  • 50 posts

Posted 19 April 2016 - 03:57 AM

Hey, try it.

 

Spoiler






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


This topic has been visited by 34 user(s)