hthuong Posted October 17, 2012 Posted October 17, 2012 I want to give item for character and get character name via charid. How do I do it? Quote
AnnieRuru Posted October 17, 2012 Posted October 17, 2012 getitem getitem 512,1, 2000000; // give an apple to account ID 2000000 seriously, most of the script commands you find in rathena uses account ID rather than char ID there's only 2 conditions that I can think of uses char ID 1st is when a party do party registration 2nd is when make a signed item the rest are almost dealing with account ID 1 Quote
hthuong Posted October 17, 2012 Author Posted October 17, 2012 (edited) because I use charid to count the number of monsters killed here is my source mellina,123,78,4 script Goblin Invasion 459,{ set .gm,40;//GM Level to access the GM Menu. Default: 40 // GM menu | Game Masters Level 40 or more are allowed to Start and Stop invasions. if (getgroupid()>.gm) { if (.mobs_left) { mes "[invasion]"; mes "An invasion is already in progress! Details:"; mes "Location: " + .Map$; mes "^FF0000"+.mobs_left+"^000000 Goblins left"; mes " "; mes "Would you like to Stop the invasion?"; if(select("- No:- Yes")==1) close; /*donpcevent "Goblin Invasion::OnTimer1805000"; mes "Invasion stopped"; set .mobs_left,0; announce "The Invasion has been stopped by "+strcharinfo(0),bc_all; close;*/ for (set @i,0; @i < getarraysize(.charid); set @i,@i+1) { dispbottom "ID: " + .charid[@i] + " - Số lần: " + .charcount[@i]; sleep2 4000; } close; } mes "[invasion]"; mes "Please customize the Invasion event before starting it."; mes "Note - The Goblin Leader drops x5 of the prize."; Main: next; mes "[invasion]"; switch(select("Item [" + getitemname(.ItemID) + "]:Start Event")) { case 1: mes "Which item would you like the Goblin Leader to drop?"; mes "Please input the item ID:"; input .ItemID; goto Main; case 2: mes "The event is going to begin shortly."; close2; goto OnStart; } //If a player clicks the NPC, the NPC will tell the player how much Mobs are left on the certain map. mes "[invasion]"; mes "Còn "+.mobs_left+" 5 chú Goblins đang long nhong tại "+.Map$[.rand_map]+"!"; close; ///////////////////////// //The actual NPC Script// ///////////////////////// //OnMinute30: OnMinute50: // Change this to your liking (When you want the event to start) OnStart: killmonster .Map$,"Goblin Invasion::OnMyMobDead"; // delete before start killmonster .Map$,"Goblin Invasion::OnSpecialMobDead"; // delete before start set .mobs_left, 1; sleep2 1000; set $@ran, rand(1,5); if ($@ran == 5) set .Map$,"izlude"; if ($@ran == 4) set .Map$,"payon"; if ($@ran == 3) set .Map$,"geffen"; if ($@ran == 2) set .Map$,"morocc"; if ($@ran == 1) set .Map$,"prontera"; sleep2 1000; //announce "[ Rune-Midgard Guard ]: Ơ kìa, lũ Goblin đang phá làng phá xóm ở " + .Map$ + "!", bc_all; sleep2 5000; //announce "[ Rune-Midgard Guard ]: Mọi người ơi, hãy đuổi bọn choi choi này giúp chúng mình với!!", bc_all; monster .Map$,0,0,"Goblin",1258,250,"Goblin Invasion::OnMyMobDead"; set .mobs_left, 250; startnpctimer; end; /*OnTimer1800000: // 30 minutes later, kills all the mobs. killmonster .Map$,"Goblin Invasion::OnMyMobDead"; set .mobs_left, 0; */ OnStop://When the event is stopped by a GM, or all monsters dead. set .mobs_left,0; stopnpctimer; killmonster .Map$,"Goblin Invasion::OnMyMobDead"; killmonster .Map$,"Goblin Invasion::OnSpecialMobDead"; announce "It seems that "+strcharinfo(0)+" has ended the Invasion!",bc_all; end; OnMyMobDead: //When a Goblin is killed if (getarraysize(.charid)) { for (set @i,0; @i < getarraysize(.charid); set @i,@i+1) { if (getcharid(0) == .charid[@i]) /* Nếu không có thì thêm vào*/ { set .charcount[@i],.charcount[@i]+1; break; } else { if (@i+1 == getarraysize(.charid)) /* Lượt cuối */ { set .charid[getarraysize(.charid)],getcharid(0); set .charcount[getarraysize(.charcount)],1; } } } } else { set .charid[0],getcharid(0); set .charcount[0],1; } set .mobs_left, .mobs_left-1; if (.mobs_left==0) { //announce "[ Rune-Midgard Guard ]: Golbin Bé Bự đã xuất hiện tại " + .Map$ + "!", bc_all; monster .Map$,0,0,"Goblin Leader",1299,1,"Goblin Invasion::OnSpecialMobDead"; } else { if (.mobs_left > 0) { announce "Còn ["+.mobs_left+"/250] chú Goblins.",bc_map; } } end; OnSpecialMobDead: announce strcharinfo(0)+" đã đá trúng mông Golbin Bé Bự, cả nhà vỗ tay hoan hô nào!", bc_all; getitem .ItemID,10; //Change the [5] to the amount you wish to hand out. donpcevent "Goblin Invasion::OnStop"; } end; OnInit: set .ItemID,675; } I want to award the player by charid through the monster that killed but i don't know how to do I found Getnameditem but that it can only be given 1 item and I do not know what to convert charid char name Edited October 17, 2012 by hthuong Quote
Brian Posted October 17, 2012 Posted October 17, 2012 I found Getnameditem but that it can only be given 1 itemand I do not know what to convert charid char name You want to create named items? (ex: hthuong's Stone) getnameditem .@item_id, strcharinfo(0); is the equivalent to: set .@char_id, getcharid(0); getitem2 .@item_id,.@amt,1,0,0, 254, 0, .@char_id & 0xFFFF, .@char_id >> 0x10; Quote
hthuong Posted October 18, 2012 Author Posted October 18, 2012 Yeah! I tried getitem with account id and problem is solved! Quote
Question
hthuong
I want to give item for character and get character name via charid.
How do I do it?
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.