-
Posts
276 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Posts posted by ToiletMaster
-
-
Hi everyone, i seem to be having an issue where the channels that i've configured for some reason, such as #global, #trade, #support, doesn't work for all players except for the administrator.
For example, the administrator is able to chat to everyone in global, but for any other players, it'll state that you're typing too fast.
I've tried downloading a fresh copy of rAthena with only the conf file import and no scripts and db amendments and the problem still persists, i've checked on the config and i can't find anything that players cannot chat via #global., I've set autojoin: true on the settings, follow by chat: yes, removed the delay or set delay to 1 but to no avail. Players can see the #global chat, but they just cant type it back.
Hope someone is able to point me to the right direction. Thank you!
-
Are you looking for the /str +number?
Example /str+ 50 will add 50 into strength, same for Dex, luk, agi, and etc.
-
10 hours ago, Digos said:
I think getd / setd are the commands that you are looking for
setd ".@" + .@var$ + "123$", "Poporing is cool"; mes getd ".@" + .@var$ + "123$";
9 hours ago, llchrisll said:Okay, mistake on my side.
You need to use as example:
getd(".reqItemQty"+(.@n+1)+"["+.@i+"]")
getd allows you to make an variable dynamical.
.@n+1 because we reduced that value in the menu but your arrays don't have 0 in the name. But you could use .reqItemQty0 instead of .reqItemQty1.
Regards,
Chris
Thanks! I wasn't aware that this was the specific command that I was looking for. I'm not sure how I missed as well ._. but thanks for clearing that up!
-
7 hours ago, llchrisll said:
mes "Select Equipment to Craft."; for (.@i = 1; .@i < getarraysize(.itemID); .@i++) .@menu$ = .@menu$ + "~ "+ getitemname(.itemID[.@i]) + ":"; set .@n,select( .@menu$) - 1; next; // By seting the .@n via the menu already you don't need the switch anymore // So I removed the switch itself as well the extra .@n = x; // I also removed in the .itemID array the 0 and added [0] just for my personal preference xD mes "Item Preview: <ITEM>"+getitemname(.itemID[.@n])+"<INFO>"+.itemID[.@n]+"</INFO></ITEM>"; mes "===================="; for(.@i = 0; .@i < getarraysize(.reqItemID1); .@i++) mes "^FF0000"+countitem(.reqItemID1[.@i])+"^000000 / "+.reqItemQty1[.@i]+ " ~ "+getitemname(.reqItemID1[.@i]); mes "^FF0000"+callfunc("F_InsertComma",Zeny)+" / "+callfunc("F_InsertComma",.Zeny[.@n])+" Zeny"; next; mes "Do you wish to continue?"; switch(select("Let me think about it: Yes, create item.")){ case 1: mes "Come back anytime"; close; case 2: if(Zeny <= .Zeny[.@n]){ mes "You have insufficient Zeny!"; close;} for( .@i = 0; .@i < getarraysize(.reqItemID1); .@i++) if(countitem(.reqItemID1[.@i]) < .reqItemQty1[.@i]){ mes "You have insufficient items"; close; } for( .@i = 0; .@i < getarraysize(.reqItemID1); .@i++){ delitem .reqItemID1[.@i],.reqItemQty1[.@i];} Zeny -= .Zeny[.@n]; getitem .itemID[.@n],1; mes "Here you go!"; close; } // mini case end OnInit: setarray .itemID[0],2589, 18600; setarray .Zeny[0],50000000,20000000; //item requirement for each items //Fallen Angel Wing setarray .reqItemID1[0], 2573, 7441,916,949, 1039, 7063,7511,983,982; setarray .reqItemQty1[0], 1, 300, 300, 300, 300, 100, 50, 20, 20; //Cat Ear Beret setarray .reqItemID2[0], 5172, 714, 5057, 919, 7161, 1059, 983; setarray .reqItemQty2[0], 1, 1, 1, 100, 200, 200, 5; end; }
Here you go, the corrected menu read the // comments what I did xD
Regards,
Chris
Hey Chris!
Thanks for taking the time to script that out, i've tested and it works great, however there seems to be a small little issue though, this is kinda the part that i'm stuck lol
for( .@i = 0; .@i < getarraysize(.reqItemID1); .@i++) if(countitem(.reqItemID1[.@i]) < .reqItemQty1[.@i]){ mes "You have insufficient items";
The requirements doesn't jump directly to the 2nd requirements from here since .reqItemID1 is fixed
i was hoping it'd be something like
.reqItemID+.@n[.@i]
followed by
.reqItemQty+.@n[.@i]
so that it automatically rotates based on which selection i chose but, after trying out this one it doesn't work , generally hoping for a way to join 2 variables into one
Oh and before i forget since you've removed the first array, then i guess this part has to start from 0 then , otherwise it'd skipped the first item
for (.@i = 0; .@i < getarraysize(.itemID); .@i++) .@menu$ = .@menu$ + "~ "+ getitemname(.itemID[.@i]) + ":"; set .@n,select( .@menu$) - 1;
-
9 hours ago, llchrisll said:
If you want to get index 0 just add -1 after select(.@menu$) so it looks like this
switch(select(.@menu$)-1)
That way you can use index 0 as well, but you need to use case 0: too.
Best way for this kind of menu would be like this:
set .@n,select(.@menu$) - 1;
Then remove the switch stuff and just use the .@n for the index.
I'm at work right now, so I can't post an full example. When I'm done, I can write it better.
But you could check my scripts a example.
Regards,
Chris
Hey Chris!
Thanks for the insight! I'll try out removing the switch and adjusting the menu.
However I'd still like to know whether if its possible to combine them into one though, perhaps I can show what I plan to achieve? Cause each case requires me to copy and paste so I'm hoping to not copy and paste instead. I have a rough concept in mind but I just can't put my head on how to do it. I'll write it up once I'm back home.
Thanks!
-
Hi guys,
The script currently works fine, however i'm hoping to get an opinion whether if the script below can be improved or better answer my query which is whether is it possible to join 2 variables into 1 ?
Here's the NPC that i've made so far.
mes "Select Equipment to Craft."; for (.@i = 1; .@i < getarraysize(.itemID); .@i++) .@menu$ = .@menu$ + "~ "+ getitemname(.itemID[.@i]) + ":"; switch(select( .@menu$ ) ){ case 1: .@n = 1; mes "Item Preview: <ITEM>"+getitemname(.itemID[.@n])+"<INFO>"+.itemID[.@n]+"</INFO></ITEM>"; mes "===================="; for(.@i = 0; .@i < getarraysize(.reqItemID1); .@i++){ mes "^FF0000"+countitem(.reqItemID1[.@i])+"^000000 / "+.reqItemQty1[.@i]+ " ~ "+getitemname(.reqItemID1[.@i]); } mes "^FF0000"+callfunc("F_InsertComma",Zeny)+" / "+callfunc("F_InsertComma",.Zeny[.@n])+" Zeny"; next; mes "Do you wish to continue?"; switch(select("Let me think about it: Yes, create item.")){ case 1: mes "Come back anytime"; close; case 2: if(Zeny <= .Zeny[.@n]){ mes "You have insufficient Zeny!"; close;} for( .@i = 0; .@i < getarraysize(.reqItemID1); .@i++){ if(countitem(.reqItemID1[.@i]) < .reqItemQty1[.@i]){ mes "You have insufficient items"; close; } } for( .@i = 0; .@i < getarraysize(.reqItemID1); .@i++){ delitem .reqItemID1[.@i],.reqItemQty1[.@i];} Zeny -= .Zeny[.@n]; getitem .itemID[.@n],1; mes "Here you go!"; close; } // mini case end case 2: .@n = 2; mes "Item Preview: <ITEM>"+getitemname(.itemID[.@n])+"<INFO>"+.itemID[.@n]+"</INFO></ITEM>"; mes "===================="; for(.@i = 0; .@i < getarraysize(.reqItemID2); .@i++){ mes "^FF0000"+countitem(.reqItemID2[.@i])+"^000000 / "+.reqItemQty2[.@i]+ " ~ "+getitemname(.reqItemID2[.@i]); } mes "^FF0000"+callfunc("F_InsertComma",Zeny)+" / "+callfunc("F_InsertComma",.Zeny[.@n])+" Zeny"; next; mes "Do you wish to continue?"; switch(select("Let me think about it: Yes, create item.")){ case 1: mes "Come back anytime"; close; case 2: if(Zeny <= .Zeny[.@n]){mes "You have insufficient Zeny!";close;} for( .@i = 0; .@i < getarraysize(.reqItemID2); .@i++){ if(countitem(.reqItemID2[.@i]) < .reqItemQty2[.@i]){ mes "You have insufficient items"; close; } } for( .@i = 0; .@i < getarraysize(.reqItemID2); .@i++){ delitem .reqItemID2[.@i],.reqItemQty2[.@i];} Zeny -= .Zeny[.@n]; getitem .itemID[.@n],1; mes "Here you go!"; close; } OnInit: setarray .itemID, 0, 2589, 18600; setarray .Zeny, 0, 50000000,20000000; //item requirement for each items //Fallen Angel Wing setarray .reqItemID1, 2573, 7441,916,949, 1039, 7063,7511,983,982; setarray .reqItemQty1, 1, 300, 300, 300, 300, 100, 50, 20, 20; //Cat Ear Beret setarray .reqItemID2, 5172, 714, 5057, 919, 7161, 1059, 983; setarray .reqItemQty2, 1, 1, 1, 100, 200, 200, 5; end; }
currently i copy and paste case 1 and case 2 and only changing the .@n variable. If i can add the use .reqitemID + .@n together then i'd be able to save much more on this one.
Would appreciate on your feedback, thanks!
P.S., the itemID being 0 for the first array is kinda because i wanna align the case with the .@n >_>
-
1 hour ago, ToiletMaster said:
input .@Rew_Name$; next; query_sql "SELECT `online` FROM `char` WHERE `name`='"+escape_sql(.@Rew_Name$)+"'",.@charstatus; //STATUS CHECK
Whenever there's an input for string with SQL, you should always try to use escape_sql command to make it safe. As long as you parse the variable with this then it should be fine, I've not tested this entirely though since I'm on my phone but it should work.
-
Hope you don't mind if I divert from the original request of this thread, however, Correct me if I'm wrong, doesn't this part here make this vulnerable to SQL injection?
On 9/23/2017 at 12:05 PM, skymia said:input .@Rew_Name$; next; query_sql "SELECT `online` FROM `char` WHERE `name`='"+.@Rew_Name$+"'",.@charstatus; //STATUS CHECK
while it does have a check to prevent groupID to be 4 and above to be able to interact with the NPC, however if it falls into the wrong hands they could do quite a bit of damage if they really wanted.
-
-
Hi everyone,
i seem to be having an issue, as we store permanent character variables in char_reg_num, i have a script that deletes this on a timed basis.
query_sql( "DELETE FROM `char_reg_num` WHERE `key`='variable' " );
However, the problem i find out is that the variables only saves once the person logs out, thus if the person interacts with the NPC and for example gets an additional ranking, it'll be the old value + new value together.
For example
Value before Scripts deletes the variables
- Variable = 100
If the person interacts with the NPC and let's say the variable adds 10 without logging off,
- Variable = 110
If the person interacts with the NPC and let's say the variable adds 10 after logging off
- Variable = 10
Is there any way to force it to clear the values? This is because i'm using a SQL based ranking for this and players are able to add that variable by themselves. Similar to Rachel's donation quest to open the gateway but instead with a ranking.
-
You need to add the quest description in your questid2display.txt in your grf/data folder.
Follow the format there and add it in there and it should work in game.
-
23 hours ago, Akkarin said:
Apache has no access to files owned by root. Just use chown and set the owner and group correctly and it'll work fine.
I'm not sure entirely on this as i had someone else to come in and take a look and they mentioned it was something to do with my host unfortunately, but i've moved it to another server now and it works fine. thanks for the help though!
-
8 hours ago, Akkarin said:
Chown it. The file is owned by no one so can't be edited by the apache user.
Thanks for the reply! i've tried that but it doesn't seem to work. Currently the entire permission group level for that directory is 0, which in this case is root,
i've checked on my previous host grouping and it was 99 instead. and 99 would also mean under the grouping file for the old host.
nobody:x:99:99:Nobody:/:/sbin/nologin
-
Hi there guys, i seem to be having an error upon reinstalling my flux cp, i've move host for this and it works great for the first host.
for the second host however, i do get the error below, i've did the change in terms of chmod 0600 for the respective files that was stated below but it didn't work at all.
I've even tried making the entire directory 777 to test it out but it still throws the same error.
I've tested a number of times but i'm not able to figure this out, would appreciate if someone could point me to the right direction on what i'm missing out here >_>,
doing a search on google gave me several results but not the exact one that i'm looking unfortunately
-
On 8/17/2017 at 6:38 PM, Aisha said:
I was hoping to save the HP information every 30 minutes or maybe every hour as long as the monster is alive. So I think it is best to have OnClock then? Because I am not sure as to how initnpctimer and stopnpcimer works, it say "pause" the time, so if I stop at one time, and resume at the other, it will resume at the previous timer correct, not back to 0 time?
initnpctimer will set the timer back to 0
however if you stopnpctimer and then startnpctimer, it'll resume where it stopped
-
1 hour ago, Capuche said:
- script Controller -1,{ OnPcDieEvent: if (strcharinfo(3) == instance_mapname("geffen")) { 'chance++; if ('chance == 3) mapwarp instance_mapname("geffen"),"prontera",150,150; else mapannounce instance_mapname("geffen"), "" + strcharinfo(0) + " has died! you only have " + (3 - 'chance) + " lives remaining.", bc_all; } end; }
should work.
About the script with the timer : forget it. After reading the commit, https://github.com/rathena/rathena/commit/9c46f3e6ba288c71f098b12834ea25779eadbc0e just prevent to duplicate npcs with script event in instance.
Notes:
- strcharinfo(3) return the real map name of the player.
- instance_mapname doc :
If no instance ID is specified, the instance the script is attached to is used. If the script is not attached to an instance, the instance of the currently attached player is used (if it is a character, party, guild or clan mode).
Within your OnPCDieEvent instance_mapname will use by default the instance id attached to the player.
EDIT: @crazyarashi please double check your script before posting!
Tested and working perfectly! Thank you very much for the help!
-
17 hours ago, Capuche said:
You can, for example, attach a timer to the character.
@instance_map$ = instance_mapname("instance"); deltimer strnpcinfo(0) + "::OnAtcommand4"; addtimer 300, strnpcinfo(0) + "::OnAtcommand4"; end; OnAtcommand4: if (strcharinfo(3) != @instance_map$) { @instance_map$ = ""; end; } addtimer 300, strnpcinfo(0) + "::OnAtcommand4"; if (Hp < 1) { 'chance++; // 'var attached to the instance if ('chance == 3) mapwarp @instance_map$,"prontera",150,150; else { mapannounce @instance_map$, strcharinfo(0) + " has died! you only have " + (3 - 'chance) + " lives remaining.",bc_all; recovery 0; } } end;
Hi Capuche,
I've tested this and for some reason it doesn't seem to work, i've changed the parameters and set the npc to give the timer but unfortunately it doesn't seem to work for some reason, it doesn't do any count upon dying14 hours ago, Z3R0 said:That's because instance_mapname () needs two parameters unless it's within the instance itself... which this npc is not...
So...
Instance_mapname ("instance", @instance_id) assuming the player has it stored on them... should work
Both instance_mapname () need to have ID because this event is not attached to the instance itself
Suprisingly i've tested this as well and it doesn't seem to work for some reason, i've added my instance ID in together with the name of the map but unfortunately it doesn't work either, is it possible if you could where it went wrong?
- script Controller -1,{ OnPcDieEvent: if(instance_mapname(strcharinfo(3)) != instance_mapname("map_name",100) ){end;} if(.chance == 3){ mapwarp instance_mapname("map_name",100),"prontera",150,150; end;} .chance++; mapannounce strnpcinfo(4),strcharinfo(0)+" has died! you only have "+(3 - .chance)+" lives remaining.",bc_all; end; }
my instance ID in the instance_db is 100, i've set that here and it doesn't work, alternatively i've tried with the name of the instance as well but it doesn't work either
-
14 hours ago, Capuche said:
You can, for example, attach a timer to the character.
@instance_map$ = instance_mapname("instance"); deltimer strnpcinfo(0) + "::OnAtcommand4"; addtimer 300, strnpcinfo(0) + "::OnAtcommand4"; end; OnAtcommand4: if (strcharinfo(3) != @instance_map$) { @instance_map$ = ""; end; } addtimer 300, strnpcinfo(0) + "::OnAtcommand4"; if (Hp < 1) { 'chance++; // 'var attached to the instance if ('chance == 3) mapwarp @instance_map$,"prontera",150,150; else { mapannounce @instance_map$, strcharinfo(0) + " has died! you only have " + (3 - 'chance) + " lives remaining.",bc_all; recovery 0; } } end;
Thanks for the alternative! I'll give this a try and see if this is possible tonight.
12 hours ago, Z3R0 said:That's because instance_mapname () needs two parameters unless it's within the instance itself... which this npc is not...
So...
Instance_mapname ("instance", @instance_id) assuming the player has it stored on them... should work
Both instance_mapname () need to have ID because this event is not attached to the instance itself
That's interesting! I wasn't aware of that too! I'll give this a try as well and see if that works. Though generally since onPCDieEvent is a global call, I guess would it make sense to attach timers on their players itself like Capuche mentioned?
-
1 hour ago, Capuche said:
if that were really the case, would there be any alternatives on how to be able to do the same thing?
-
Hi Guys,
i've been trying to figure out this for quite sometime but after searching around and tinkering around i just can't seem to find out where is the issue here.
this works outside of the instance but within the instance, i get a weird error from the console
(map_mapname2mapid) mapindex_name2id: Map "" not found in index list!
I'm not sure how it works since it's kinda my first time using OnPcDieEvent in instances. Would appreciate if someone could point me to the right direction! Generally what I'm trying to achieve is that once you go in and die 3 times, your entire party should automatically get warped out.
- script Controller -1,{ OnPcDieEvent: if(instance_mapname(strcharinfo(3)) != instance_mapname("instance") ){end;} if(.chance == 3){ mapwarp instance_mapname("instance"),"prontera",150,150; end;} .chance++; mapannounce strnpcinfo(4),strcharinfo(0)+" has died! you only have "+(3 - .chance)+" lives remaining.",bc_all; end; }
-
12 minutes ago, Akkarin said:
A good example is in the instance scripts, where specific NPCs do things dependant on their hidden name value. This is very useful when using the duplicate NPC function. You provided an example in your first post
You've just blew my mind! I completely forgotten about that portion.
Now I see exactly how it works out! Thank you so much for making me understand! I fully understand on how it works now
-
On 14/08/2017 at 3:10 AM, Akkarin said:
Simply put, the value of strnpcinfo(2) is a string formed by the name of the NPC itself. "NPC Name#45" would give "45" as a string, so you'd use "atoi" to change the string to an integer.
First and foremost, would like to apologize for the late reply, got caught up yesterday and couldn't respond back to the topics. Thank you for sharing that, i understand that atoi changes from string to integer, but mainly on the uses of it as i can't seem to imagine on how it would be useful.
13 hours ago, Z3R0 said:right another reason might be, it's easier to store everything as a string because it's always readable, and then only return items as INT if you need to use them as INT... for instance...
// Set Character Name / Level setarray(.@var$[0], "Z3R0", "100"); set(.@var$[1], ( atoi(.@var$[1]) + 100 ) + ""); // Here we have taken the numeric value of "100" as 100, added 100, and then converted it back // to string... this keeps all our variables on 1 array, but let's us use them as either STRING or INTEGER :D
Hi @Z3R0,
Thanks for the example! This makes it easier for me to understand, i wasn't aware that this was possible.
Off Topic,
does your scripting for dummies cover this portion? i saw a little bit earlier on but it was mainly on the basics of the scripting, would love to see if you'd cover a little bit more on this topic if you have the time! Kudos
-
Hi guys,
i'm trying to understand the use of atoi in script commands but for some reason i can't seem to understand.
*atoi("<string>") These commands are used to convert strings to numbers. 'atoi' will interpret given string as a decimal number (base 10), while 'axtoi' interprets strings as hexadecimal numbers (base 16). 'strtol' lets the user specify a base (valid range is between 2 and 36 inclusive, or the special value0, which means auto-detection). The 'atoi' and 'strtol' functions conform to the C functions with the same names, and 'axtoi' is the same as strtol, with a base of 16. Results are clamped to signed 32 bit int range (INT_MIN ~ INT_MAX). Examples: .@var = atoi("11"); // Sets .@var to 11
Based on script commands i noticed the example given is setting the
.@var = atoi("11")
what's the difference if i were to directly put set .@var = 11? aside from it being string and integer.
On the Horror Toy Factory and other scripts, i noticed they used this alot but i can't seem to understand that portion at all, would be great if someone could explain on how it exactly functions. Thank you in advance! Here's one part of the script in Horror Toy Factory that used Atoi
OnStart: .@event$ = instance_npcname( strnpcinfo(0) ) + "::OnMyMobDead"; killmonster 'xm_d_map$, .@event$; getunitdata 'celene_id, .@data; setarray .@coord[0], .@data[UMOB_X], .@data[UMOB_Y]; .@num = atoi(strnpcinfo(2)); .@index = ( .@num > 2 ? 1 : 0 );// x or y .@signe = pow(-1,.@num+1); while(1) { .@coord[.@index] = .@coord[.@index] + (2 * .@signe); .@coord[!.@index] = .@coord[!.@index] + rand(0,2) - 1; monster 'xm_d_map$,.@coord[0], .@coord[1], "#f_w_1",3038,1, .@event$; if (.@coord[0] < 211 || .@coord[0] > 241 || .@coord[1] < 166 || .@coord[1] > 201) break; sleep 200; } sleep 6000; killmonster 'xm_d_map$, .@event$; end;
Edit:
Added another portion of the script of Horror Toy Factory that uses it that i can't exactly understand on how the switch cases relate to Atoi
1@xm_d,210,141,3 script Packaged Present#1 4_TREASURE_BOX,{ specialeffect EF_COIN; disablenpc instance_npcname( strnpcinfo(0) ); initnpctimer; end; OnTimer1000: switch( atoi(strnpcinfo(2)) ) { case 1: .@num = rand(4,8); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 7642,1, 'xm_d_map$, rand(208,212), rand(139,143);// Bloody_Coin if (rand(1,1000) > 150) makeitem 644,1, 'xm_d_map$,209,141;// Gift_Box; if (rand(1,1000) > 600) makeitem 617,1, 'xm_d_map$,210,141;// Old_Violet_Box; if (rand(1,1000) > 900) makeitem 22534,1, 'xm_d_map$,211,141;// Closedmind_Box break; case 2: .@num = rand(3,7); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 7642,1, 'xm_d_map$, rand(212,216), rand(139,143);// Bloody_Coin if (rand(1,1000) > 400) makeitem 603,1, 'xm_d_map$,213,141;// Old_Blue_Box if (rand(1,1000) > 700) makeitem 616,1, 'xm_d_map$,214,141;// Old_Card_Album if (rand(1,1000) > 950) makeitem 13442,1, 'xm_d_map$,215,141;// Old_Parasol break; case 3: .@num = rand(2,6); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 7642,1, 'xm_d_map$, rand(216,220), rand(139,143);// Bloody_Coin if (rand(1,1000) > 850) makeitem 7229,1, 'xm_d_map$,217,141;// Silver_Bullion if (rand(1,1000) > 800) makeitem 12246,1, 'xm_d_map$,218,141;// Magic_Card_Album if (rand(1,1000) > 950) makeitem 2486,1, 'xm_d_map$,219,141;// Shadow_Walk_ break; case 4: .@num = rand(4,8); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 7642,1, 'xm_d_map$, rand(220,224), rand(139,143);// Bloody_Coin if (rand(1,1000) > 700) makeitem 7228,1, 'xm_d_map$,221,141;// Gold_Bullion if (rand(1,1000) > 600) makeitem 617,1, 'xm_d_map$,222,141;// Old_Violet_Box if (rand(1,1000) > 900) makeitem 22534,1, 'xm_d_map$,223,141;// Closedmind_Box break; case 5: .@num = rand(3,7); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 7642,1, 'xm_d_map$, rand(224,228), rand(139,143);// Bloody_Coin if (rand(1,1000) > 150) makeitem 644,1, 'xm_d_map$,225,141;// Gift_Box if (rand(1,1000) > 700) makeitem 616,1, 'xm_d_map$,226,141;// Old_Card_Album if (rand(1,1000) > 950) makeitem 2976,1, 'xm_d_map$,227,141;// Red_Lantern break; case 6: .@num = rand(2,6); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 2976,1, 'xm_d_map$, rand(208,212), rand(134,138);// Red_Lantern if (rand(1,1000) > 400) makeitem 603,1, 'xm_d_map$,209,136;// Old_Blue_Box if (rand(1,1000) > 800) makeitem 12246,1, 'xm_d_map$,210,136;// Magic_Card_Album if (rand(1,1000) > 950) makeitem 2977,1, 'xm_d_map$,211,136;// Hurt_Mind break; case 7: .@num = rand(4,8); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 7642,1, 'xm_d_map$, rand(212,216), rand(134,138);// Bloody_Coin if (rand(1,1000) > 850) makeitem 7229,1, 'xm_d_map$,213,136;// Silver_Bullion if (rand(1,1000) > 600) makeitem 617,1, 'xm_d_map$,214,136;// Old_Violet_Box if (rand(1,1000) > 900) makeitem 22534,1, 'xm_d_map$,215,136;// Closedmind_Box break; case 8: .@num = rand(3,7); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 7642,1, 'xm_d_map$, rand(216,220), rand(134,138);// Bloody_Coin if (rand(1,1000) > 700) makeitem 7228,1, 'xm_d_map$,217,136;// Gold_Bullion if (rand(1,1000) > 700) makeitem 616,1, 'xm_d_map$,218,136;// Old_Card_Album if (rand(1,1000) > 950) makeitem 2978,1, 'xm_d_map$,219,136;// KindHeart break; case 9: .@num = rand(2,6); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 7642,1, 'xm_d_map$, rand(220,224), rand(134,138);// Bloody_Coin if (rand(1,1000) > 150) makeitem 644,1, 'xm_d_map$,221,136;// Gift_Box if (rand(1,1000) > 800) makeitem 12246,1, 'xm_d_map$,222,136;// Magic_Card_Album if (rand(1,1000) > 950) makeitem 18848,1, 'xm_d_map$,223,136;// Lush_Rose break; case 10: .@num = rand(4,8); for ( .@i = 0; .@i < .@num; .@i++ ) makeitem 7642,1, 'xm_d_map$, rand(224,228), rand(134,138);// Bloody_Coin if (rand(1,1000) > 400) makeitem 603,1, 'xm_d_map$,225,136;// Old_Blue_Box if (rand(1,1000) > 600) makeitem 617,1, 'xm_d_map$,226,136;// Old_Violet_Box if (rand(1,1000) > 900) makeitem 22534,1, 'xm_d_map$,227,136;// Closedmind_Box break; }
-
4 hours ago, crazyarashi said:
1@instance,123,123,4 script guy#1 791,{ if( getvariableofnpc (.pillar1,"pillar#1" && .pillar2,"pillar#2" && .pillar3,"pillar#3" )) { mapannounce "1@instance", "Guy - All 3 Pillars has been activated, to the activators please talk to me." donpcevent instance_npcname("guy#1")+"::OnDisable"; donpcevent instance_npcname("guy#2")+"::OnEnable"; end; } else { mes "Guy"; mes "I want you talk to the 3 pillars first"; close; donpcevent instance_npcname("pillar#1")+"::OnEnable"; donpcevent instance_npcname("pillar#2")+"::OnEnable"; donpcevent instance_npcname("pillar#3")+"::OnEnable"; end; OnInstanceInit: OnDisable: hideonnpc instance_npcname("guy#1"); end; OnEnable: hideoffnpc instance_npcname("guy#1"); end; } 1@instance,123,123,4 script guy#2 791,{ if(.clicker1$ == 1){ mes "Number 1"; close; } else { if(.clicker2$ == 1) mes "Number 2"; close; } else { if(.clicker3$ == 1) mes "Number 3"; close; } } 1@instance,124,124,4 script pillar#1 791,{ progressbar "0xFFFF00",10; set .pillar1, 1; set .clicker1$, strcharinfo(0); donpcevent instance_npcname("pillar#1")+"::OnDisable"; end; OnInstanceInit: OnDisable: hideonnpc instance_npcname("pillar#1"); end; OnEnable: hideoffnpc instance_npcname("pillar#1"); end; } 1@instance,125,125,4 script pillar#2 791,{ progressbar "0xFFFF00",10; set .pillar2, 1; set .clicker2$, strcharinfo(0); donpcevent instance_npcname("pillar#2")+"::OnDisable"; end; OnInstanceInit: OnDisable: hideonnpc instance_npcname("pillar#2"); end; OnEnable: hideoffnpc instance_npcname("pillar#2"); end; } 1@instance,126,126,4 script pillar#3 791,{ progressbar "0xFFFF00",10; set .pillar3, 1; set .clicker3$, strcharinfo(0); donpcevent instance_npcname("pillar#3")+"::OnDisable"; end; OnInstanceInit: OnDisable: hideonnpc instance_npcname("pillar#3"); end; OnEnable: hideoffnpc instance_npcname("pillar#3"); end; }
Try this haven't tried im only on mobile phone :))
Thanks for the script! i've tried and unfortunately only this part doesn't work after tinkering around, it looks like it only allows 1 variable from 1 NPC rather than many, is there a possibility to get multiple variables from multiple NPCs? i could do multiple ifs as a workaround as such if within another if.
if(getvariableofnpc(.pillar1,"pillar#1") == 1){ mes "You done it!"; close; } else mes "You've not done it :("; close;
However thanks alot for the help though! your initial script had a few errors but i've fixed them all so it's all good
Edit:
-----
as a workaround i did this instead which worked great.
if(getvariableofnpc(.pillar1,"pillar#1") == 1){ //&& .pillar2,"pillar#2" && .pillar3,"pillar#3" ) if(getvariableofnpc(.pillar2,"pillar#2") == 1){ if(getvariableofnpc(.pillar3,"pillar#3") == 1){ mapannounce instance_mapname("prontera"), "Guy - All 3 Pillars has been activated, to the activators please talk to me.",bc_all; donpcevent instance_npcname("guy#1")+"::OnDisable"; //donpcevent instance_npcname("guy#2")+"::OnEnable"; end; } } }
Distinct Array
in Scripting Support
Posted · Edited by ToiletMaster
Hi everyone,
i have a question to ask. is there any possibility to select from an array and make sure that the selection is distinct?
for example
if i set an array of
setarray .random[0], 100,200,300,400,500,600,700,800,900,1000;
Is there a possibility that if i pick a number from this array, that it will not be repeated anymore?
a quick solution would be putting the number in a variable and checking it, but that's only if it works with 1 time checks,
what if i had 5 different times i'm selecting from this array that requires a distinct selection.