Jump to content

Red

Members
  • Content Count

    1
  • Joined

  • Last visited


Reputation Activity

  1. Upvote
    Red reacted to jaBote in summon monster script   
    Well, since he's new on it I think we should explain some things before giving him the solution, isn't it?
     
    First of all you know what's an array and possibly miss a bit of how setarray works, but I'd advice you to fill up the arrays on their first position. The first position of an array is number 0, then number 1, 2, 3, etcetera. Why positions start on 0? I don't know very well; Why start setting on position 0? It's a mere convention and you can perfectly start setting at position 1. It could also simplify some calculations/processing later.
     
    That setarray literally said: start setting the array $@monsteridweak at index 1 (second position, remember first one is 0) with the values: 1301 for index 1,1297 for index 2,1403 for index 3, etcetera.
     
    Then, let's go to the summoning part: you tried to summon this piece of code:
    monster "this",0,0,"--ja--",$@monsteridweak[1],100,strnpcinfo(3)+"::OnWave1"; which I think you know what it literally means, but let's go to the monster ID variable you passed. You're trying to summon the content of $@monsteridweak at index 1, which is just ID# 1301 and just summons that mob, and that's your issue. What to do to solve this? Just passing the $@monsteridweak variable? Wrong (that'll only summon the monster at position 0 if possible). You need a new tool for it, that's looping on the array till all desired monsters are summoned.
     
    How do you get the size of an array? With getarraysize, that gets all set positions except trailing zeros or empty strings (which by default mean unset variable), but getarraysize counts leading zeros or empty strings. You are already familiar with loops so, as examples:
    // Supposing empty arrays before setting. !!Position 0 is the first position of an array!!setarray .@myArray1[0],5,4,3,2,1; // myArray1 = 5,4,3,2,1 at positions 0,1,2,3,4 respectivelygetarraysize(.@myArray1); // Returns 5// Correct loop around .@myArray1for (set .@i, 0; .@i < getarraysize(.@myArray1); set .@i, .@i + 1) { // i varies from 0 to 4 whatever with .@myArray[i];}setarray .@myArray2[1],5,4,3,2,1; // myArray2 = 0,5,4,3,2,1 at positions 0,1,2,3,4,5 respectivelygetarraysize (.@myArray2); // Returns 6// Correct loop around .@myArray2for (set .@i, 1; .@i <= getarraysize(.@myArray1); set .@i, .@i + 1) { // i varies from 1 to 5, position 0 is skipped whatever with .@myArray[i];}  
    Since Via and others have already caught me up you have now a correct solution at the moment depending on what you want, but hope that this explanation has given you a bit of more insight if possible!
     
    P.S.: 31 filled up positions on the array... Multiplying by 100... You sure you want to summon 3100 monsters on the same map at once? O.O
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.