Jump to content

plankt

Members
  • Posts

    130
  • Joined

  • Last visited

Posts posted by plankt

  1. If you don't want the dialogue open, you can add the green line.

    Switched place of the two orange lines to make sure the shop is attached before we call it.

    mes "Select only one.";

    close2;

    npcshopattach "quest_shop1";

    callshop "quest_shop1",1;

    end;

    On each OnInit, the shops content is removed by:

    npcshopitem "quest_shop1",0,0;
    

    And no items are added after that.

  2. If you only have the statement, only 1 command will be executed for each loop. Ex:

    for(...)
     mes "This will be looped";
     mes "This will not be looped";
    
    
    for(...) mes "This will be looped";
     mes "This will not be looped";
    

    If you surround the code with { } then all the code inside will be executed each loop. Ex:

    for(...){
     mes "This will be looped";
     mes "This will be looped";
    }
    mes "This will not be looped";
    

  3. For the first one, if you only want to announce once, then add the announce like below:

    for(set @i,@i+1; getarg(@i)!=0; set @i,@i+2) getitem getarg(@i),getarg(@i+1);
    announce "Yay, the player got items",bc_all;
    

    If you want it to announce for each item, change the for loop like this: (to make sure it does both commands for each loop)

    for(set @i,@i+1; getarg(@i)!=0; set @i,@i+2){
     getitem getarg(@i),getarg(@i+1);
     announce "Yay, the player got another item",bc_all;
    }
    

    For the second one, you can add an announce, like I did in the first example, after the line which gives the item:

     getitem $CB_Prize[.@d], $CB_Prize[.@d+3];
     // Add announce here
    

  4. What you're looking for could be:

    *callshop "<name>",<option>;

    These are a series of commands used to create dynamic shops.

    The callshop function calls a invisible shop (view -1) as if the player clicked on it.

    For the options on callShop:

    0 = The normal window (buy, sell and cancel)

    1 = The buy window

    2 = The sell window

    Example(s):

    callshop "DaShop",1; //Will call the shop named DaShop and opens the buy menu.

    It will open a normal shop. You need to have that shop as a script already.

  5. -<tab>script<tab>Shop5<tab>-1,{
    ...
    OnShop:
    ...
    }
    

    *doevent "<NPC object name>::<event label>";

    This command will start a new execution thread in a specified NPC object at the

    specified label. The execution of the script running this command will not stop.

    No parameters may be passed with a doevent call.

    The script of the NPC object invoked in this manner will run as if it's been

    invoked by the RID that was active in the script that issued a 'doevent'.

    place' date='100,100,1%TAB%script%TAB%NPC%TAB%53,{

    mes "This is what you will see when you click me";

    close;

    OnLabel:

    mes "This is what you will see if the doevent is activated";

    close;

    }

    doevent "NPC::OnLabel";[/quote']

  6. You can switch "OnPCLoginEvent" for:

    OnNPCKillEvent:

    This special label triggers when a player kills a monster.

    And use a temporary char variable to keep track of monsters killed, ex:

    // Increase the mobs killed by 1
    set @mobskilled, @mobskilled+1;
    // If the user has killed less then 80 mobs, don't run the script
    if(@mobskilled < 80) end;
    // Then reset the variable so we can start counting again
    set @mobskilled, 0;
    

  7. The function gettime() returns only what you specify.

    gettime(3) will give you the hour only.

    Since you can only arrive at the if check at two possible times, 19:00 and 20:30, you only need to check for the days and that specific hour.

    OnClock1900: // Start time
    OnClock2030: // End time
    // Check for Sunday or Wednesday AND that it is starttime
    if((gettime(4) == 0 || gettime(4) == 3) && gettime(3) == 19) {
    

    I'm guessing you have an "end time check" at the end of that if. Make sure to change that check to something like this:

    
    // Check for Sunday or Wednesday AND that it is endtime
    if((gettime(4) == 0 || gettime(4) == 3) && gettime(3) == 20) {
    

    *gettime(<type>)

    This function will return specified information about the current system time.

    ...

    3 - Hour (of a day)

    ...

  8. You can save the AID where the variable $HighestPoringPointsName$ is set.

    Then at OnTimer310000 you can attachrid and give the reward. Make sure to remove the price part from the standard NPC.

    For the second, change this:

    }
    initnpctimer;
    end;
    OnPCDieEvent:
    

    To this:

    }
    killmonsterall "quiz_01";
    mapannounce "quiz_01","You have won, approach the Present For You Npc please.",0;
    enablenpc "Present For You";
    stopnpctimer;
    end;
    OnPCDieEvent:
    

  9. Ah, mistake from my part. Ignore what I said about the for-loop.

    Change:

    do {
     set .@guessrepeat, 0;
     set $monster, 1000 + rand(1,950);
     for (set .@k, 0; .@k <getarraysize($Forbidden); set .@k, .@k+1){
    if ($monster == $Forbidden[.@k]){
      set .@guessrepeat, 1;
      break;
    }
     }
    } while (.@guessrepeat);
    

    To

    set $monster, $Forbidden[rand(getarraysize($Forbidden))];
    

    Note: It can ONLY choose ids from the $Forbidden array if you do this edit.

    That way you can have arrays with monsters and select from them, ex:

    setarray .@mvps, id1, id2, id3, ...;
    
    set $monster, .@mvps[rand(getarraysize(.@mvps))];
    

  10. I did answer that one in the previous thread you made.

    For the first error, you can get rid of it by adding "end;" before "L_LadderMove:".

    It should not, but could, affect the script.

    end;
    L_LadderMove:
    

    Reason for the error:

    The event 'OnPCKillEvent' is activated but the script isn't ended before reaching 'L_LadderMove'.

    It then reaches

    if (getarg(0) == 0) set @length,@beginmoving;

    Which executes the error.

  11. Something like this:

    OnPCLoginEvent:
    // Get the data to array @VotePoints, since we only get 1 value it will be treated as a variable, .@n is amount of rows
    set .@n, query_sql("SELECT `points` FROM `cp_v4p_voters` WHERE `account_id` = '"+getcharid(0)+"'", @VotePoints);
    // If we got data
    if(.@n){
       // Update his/her values to 0
       query_sql("UPDATE `cp_v4p_voters` SET `points` = 0 WHERE `account_id` = '"+getcharid(0)+"'");
       // Update the CASHPOINTS var
       set #CASHPOINTS, #CASHPOINTS+@VotePoints;
    }
    end;
    

    Check the variables, names and code before using.

    • Upvote 1
  12. For the first error, you can get rid of it by adding "end;" before "L_LadderMove:".

    It should not, but could, affect the script.

    end;
    L_LadderMove:
    

    For the "Expected string" errors. You need to give the function the correct type of values for it to work.

    It expects an integer, gets a string. There's 2 ways to fix it.

    1) Typecast, change ex: getstrlen(var) to getstrlen(""+var). You add an empty string to force it to turn in to a string.

    2) Check if the function is needed at all. You send an integer in to the function atoi which is used to turn string to integers = not needed.

  13. Does it enter the label "OnEndInstance" at all?

    If it does, check if .@a$ is set to an empty string or the map name.

    The script or player might not be attached to an instance, in that case you could save the instance ID and supply to the script command.

    *has_instance("<map name>"{,<instance id>});
    

    If you want an alternative to scanning all the IDs to check who is on the map, you can try to:

    *instance_warpall "<map name>",<x>,<y>{,<instance id>};
    

    And have a reward NPC they can talk to, or activate an OnTouch on arrival.

×
×
  • Create New...