Jump to content
  • 0

Error announce


hardelite

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  44
  • Reputation:   2
  • Joined:  01/09/18
  • Last Seen:  

Hi guys, how are you?
I have a small error in the script.

Script original: https://nopaste.xyz/?b1c061751d45c168#m9OdnvK/5Uqw1UZq7ym4zhc6vNAwQtEMtDS4bM7zO1A=

1. I want to remove other maps. I just want the prontera map. Is that correct?

Spoiler

//============================================================ 
//= Controls on the production of bugs
//============================================================ 

-    script    rent_bichos    -1,{
    end;

OnInit:
    set $@GTB, 0;
    initnpctimer;
    end;

OnTimer7200000:
    // Respawn of bugs in the house
    for (set .@j, 1; .@j < 23; set .@j, .@j + 1) {
        callfunc "rent_spawnbug","a" + .@j + "";
        callfunc "rent_spawnbug","c" + .@j + "";
        callfunc "rent_spawnbug","d" + .@j + "";
        callfunc "rent_spawnbug","e" + .@j + "";
        callfunc "rent_spawnbug","f" + .@j + "";
        callfunc "rent_spawnbug","g" + .@j + "";
    }
    // Villas Prontera
    for (set .@j, 1; .@j < 28; set .@j, .@j + 1) {
        callfunc "rent_spawnbug","b" + .@j + "";
    }
    
    if (rand(1,10000) <= 100 && $@GTB == 0) {
        // Respawn of GTB
        switch (rand(1,1)) {
            case 1:
                set .@j, rand(1,27);
                monster "rentinb" + .@j + ".gat",0,0,"Golden Thief Bug",1086,1,"rent_bichos::OnGTB";
                announce "Uh-oh! It seems that we have a plague in the Prontera Villas, house" + .@j + ".",0,0x99CCFF;
            break;
        }
        set $@GTB, 1; // Active GTB
    }
    stopnpctimer;
    initnpctimer;
    end;

OnGTB:
    set $@GTB, 0;
    end;
}

Error 2. Once the house is invaded by insects, the script always announces the wrong house ...

Please, can anyone help me?

(Ps: Sorry for my English)

Edited by hardelite
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  80
  • Reputation:   1
  • Joined:  10/08/13
  • Last Seen:  

If the Prontera map file is the only one you have then yes. You will remove:

"Villas Geffen",L_VGeffen,"Villas Morroc",L_VMorroc,"Villas Payon",L_VPayon,"Villas Alberta",L_VAlberta,"Villas Izlude",L_VIzlude,"Villas Aldebaran",L_VAldebaran,

and 

L_VGeffen:    set Zeny, Zeny - 2000; mes "[Real Estate Agent]"; mes "Have nice trip!!"; close2; warp "rent_md.gat",49,92; end;
L_VMorroc:    set Zeny, Zeny - 2000; mes "[Real Estate Agent]"; mes "Have nice trip!!"; close2; warp "rent_mc.gat",49,92; end;
L_VPayon:     set Zeny, Zeny - 2000; mes "[Real Estate Agent]"; mes "Have nice trip!!"; close2; warp "rent_ma.gat",49,92; end;
L_VAlberta:   set Zeny, Zeny - 2000; mes "[Real Estate Agent]"; mes "Have nice trip!!"; close2; warp "rent_me.gat",49,92; end;
L_VIzlude:    set Zeny, Zeny - 2000; mes "[Real Estate Agent]"; mes "Have nice trip!!"; close2; warp "rent_mf.gat",49,92; end;
L_VAldebaran: set Zeny, Zeny - 2000; mes "[Real Estate Agent]"; mes "Have nice trip!!"; close2; warp "rent_mg.gat",49,92; end;

from the script. But that is assuming you have the rent_mb.gat map file.

 

In your code you can remove this block:

    // Respawn of bugs in the house
    for (set .@j, 1; .@j < 23; set .@j, .@j + 1) {
        callfunc "rent_spawnbug","a" + .@j + "";
        callfunc "rent_spawnbug","c" + .@j + "";
        callfunc "rent_spawnbug","d" + .@j + "";
        callfunc "rent_spawnbug","e" + .@j + "";
        callfunc "rent_spawnbug","f" + .@j + "";
        callfunc "rent_spawnbug","g" + .@j + "";
    }

You're not using the other maps so you don't need it in there.

 

Try removing these lines: 

 switch (rand(1,1)) {
            case 1:
break;
        }

My server isn't online so I can't test it but when you're only using the prontera map you don't need the switch statement in the code.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  44
  • Reputation:   2
  • Joined:  01/09/18
  • Last Seen:  

@Oceanid thank you.

Got it! I made the removal successfully, no error was displayed.
But it's not announcing the right house. 
For example: I occupied house number 1, but when it was invaded by insects the script announced a random house, house number 13 or any other. Which in the case, is not occupied. 

Spoiler

//============================================================ 
//= Controls on the production of bugs
//============================================================ 

-    script    rent_bichos    -1,{
    end;

OnInit:
    set $@GTB, 0;
    initnpctimer;
    end;

OnTimer720:
    // Villas Prontera
    for (set .@j, 1; .@j < 28; set .@j, .@j + 1) {
        callfunc "rent_spawnbug","b" + .@j + "";
    }
    
    if (rand(1,10000) <= 100 && $@GTB == 0) {
        // Respawn of GTB

                set .@j, rand(1,27);
                monster "rentinb" + .@j + ".gat",0,0,"Golden Thief Bug",1086,1,"rent_bichos::OnGTB";
                announce "Uh-oh! It seems that we have a plague in the Prontera Villas, house" + .@j + ".",0,0x99CCFF;

        set $@GTB, 1; // Active GTB
    }
    stopnpctimer;
    initnpctimer;
    end;

OnGTB:
    set $@GTB, 0;
    end;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  80
  • Reputation:   1
  • Joined:  10/08/13
  • Last Seen:  

@hardelite It's this line here:

 set .@j, rand(1,27);

It's going to randomly generate a number between 1 and 27 each time and then gets used here:

announce "Uh-oh! It seems that we have a plague in the Prontera Villas, house" + .@j + ".",0,0x99CCFF;

So it won't necessarily be the house that is occupied.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...