Jump to content

Winterfox

Members
  • Posts

    240
  • Joined

  • Last visited

  • Days Won

    19

Posts posted by Winterfox

  1.   - Id: 6010
        AegisName: Pickaxe
        Name: Pickaxe
        Type: Armor
        Buy: 10
        Weight: 10
        Attack: 10
        Range: 1
        Classes:
          Normal: true
          Upper: true
          Baby: true
        Gender: Female
        Locations:
          Both_Hand: true
        Script: |
          bonus bAspd,-30; bonus bCritical,100; bonus bAtkRate,-100; autobonus "{ callfunc \"Minner_Main\",1; }",10000,1,BF_WEAPON;
        EquipScript: |
          callfunc "Minner_Main",0;
        UnEquipScript: |
          callfunc "Minner_Main",2;

    According to the csv2yaml tool, your item should look like above. I can't check it, since I can't find the documentation of the old rathena text format.
    But without knowing the details of the item, it seems weird that it gets typed as armor and female only.

  2. There is a slight mistake in the script, it has a chance of 1:99 instead of 1:100.

    if( .@rnd < .item_arrays[.@i+2] ) {

    Makes it range from 1 to 99 since the last check is: 1 - 100 < 100.

    //Created Date: 04/07/2022
    -	script	AEOUS_MVP_DROP	FAKE_NPC,{
    	OnNPCKillEvent:
    		.@rnd = rand(1,100);
    		if( getmonsterinfo( killedrid,MOB_MVPEXP ) <= 0) end;
    
    		for( .@i = 0; .@i < getarraysize(.item_arrays); .@i += 3 ) {
    			if( .@rnd <= .item_arrays[.@i+2] ) {
    				getitem .item_arrays[.@i], .item_arrays[.@i+1];
    				announce "Congratulations! Player "+ strcharinfo(0) +" has obtained "+ getitemname( .item_arrays[.@i] ) +" ["+ .item_arrays[.@i+1] +"] from "+ getmonsterinfo(killedrid, 0) +" (chance: "+.item_arrays[.@i+2]+"%) MVP Drop(s).",bc_all,0x00FF00;
    			}
    		}
    		end;
    	}
    
    	OnInit:
    		//	(<structure,<item_id>,<chances>)
    		setarray .item_arrays[0],
    			675,	1,	10,
    			677,	1,	30,
    			7539,	1,	100;
    		end;
    }

     

  3. What happened is that rAthena uses a new format for the databases since the release of the script you are using.
    For the first, I assume the 200 is the ID to make sure it doesn't collide with upcoming instances.

      - Id: 200
        Name: Emperium Test Breaker
        TimeLimit: 3600
        Enter:
          Map: job3_arch01
          X: 26
          Y: 28

    For the mob db you could simply copy the original Emperium und use the ID 3002 for the copy. But beware: You can't add 3002 if you use renewal, since a mob is already defined at this ID. In this case you would have to take an ID that is higher and match the script and mob avail accordingly.
    You mixed the order up in your mob avail:

      - Mob: 3002
        Sprite: 1288

    The first ID is the mob, the second is the sprite it should use, in this case the sprite of the emperium. The client doesn't know what sprite to show for your mob, so you have to tell the server to send it a known ID the client can use to show the mob.

  4. mes "Pick your number!";
    next;
    input(.@number);
    .@rowCount = query_sql("SELECT `number` FROM numberdb WHERE `number` = " + .@number + ";");
    if(.@rowCount == 1) {
        mes "This number is already used. Try again.";
        close;
    }
    query_sql("INSERT INTO numberdb (`number`) VALUES (" + .@number + ");");

     

    • Upvote 1
  5. 11 hours ago, ran0120 said:

    Wouldn't this script be it? I mean if the poison damage is 100 and you put bonus2 bSubEle,Ele_Poison,100; the damage reduction becomes 100% thus making the poison damage 0?

    Logically, that would make sense, yes. But the calculations in ragnarok don't seem to always work exactly as one would expect under all circumstances.

  6. You have to put the script in the item you want to use it on in the item_db_equip.yml.
     

      - Id: 1101
        AegisName: Sword
        Name: Sword
        Type: Weapon
        SubType: 1hSword
        Buy: 100
        Weight: 500
        Attack: 25
        Range: 1
        Slots: 3
        Jobs:
          Alchemist: true
          Assassin: true
          Blacksmith: true
          Crusader: true
          Knight: true
          Merchant: true
          Novice: true
          Rogue: true
          SuperNovice: true
          Swordman: true
          Thief: true
        Locations:
          Right_Hand: true
        WeaponLevel: 1
        EquipLevelMin: 2
        Refineable: true
        Script: |
          bonus bMaxHP,100;
      - Id: 1102
        AegisName: Sword_
        Name: Sword
        Type: Weapon
        SubType: 1hSword
        Buy: 100
        Weight: 500
        Attack: 25
        Range: 1
        Slots: 4
        Jobs:
          Alchemist: true
          Assassin: true
          Blacksmith: true
          Crusader: true
          Knight: true
          Merchant: true
          Novice: true
          Rogue: true
          SuperNovice: true
          Swordman: true
          Thief: true
        Locations:
          Right_Hand: true
        WeaponLevel: 1
        EquipLevelMin: 2
        Refineable: true
        Script: |
          bonus bMaxHP,100;

     

  7. These cooldowns are made with the quest commands. It works by giving the player a quest that has an expiration time.
    Here is a small example: 
     

    prontera,124,201,1	script	Example NPC	726,{
    	// Check if the time limit is still running.
    	if(checkquest(200000, PLAYTIME) == 0) {
    		mes "Example";
    		mes "I am still preparing the cake, please wait!";
    		close;
    	}
    
    	// Check if the time limit expired.
    	if(checkquest(200000, PLAYTIME) == 2) {
    		mes "Example";
    		mes "Finally! Here is your cake!";
    		erasequest(200000);
    		getitem(12062, 1);
    		close;
    	}
    
    	// Give the quest with the time limit
    	mes "Example";
    	mes "Hello, how may i help you?";
    	mes "Oh, a free special cake?";
    	mes "Sure, i will bake you a fresh one.";
    	mes "Please come back in 5 minutes!";
    	setquest(200000);
    	close;
    }

    The actual quest and time limit is defined in the quest_db.yml. For the Example NPC the entry would look like this:
     

      - Id: 200000
        Title: "Example Cake Timer"
        TimeLimit: +5mn

    If you want to show the quest info in the client like in your screenshot, you need to edit the System/OngoingQuestInfoList_True_EN.lub.
    For the quest in the example, the entry could look like this:
     

    	[200000] = {
    		Title = "Example Cake Timer",
    		Description = {
    			"Wait for Example to prepare your cake."
    		},
    		Summary = ""
    	}

     

    • Upvote 1
  8. There is a sample in the docs under doc/samples/instancing.txt. Please note the comment that says you need to add the instance to the database, for the script to work. It is in the old format, but you shouldn't have issues to convert it to the yaml version. 

    //===== rAthena Script =======================================
    //= Sample: Instancing
    //===== By: ==================================================
    //= Euphy
    //===== Last Updated: ========================================
    //= 20140129
    //===== Description: ========================================= 
    //= Contains elements of a basic instance script.
    //============================================================
    
    // Before running this script, add the entry below to
    // 'db/(pre-)re/instance_db.txt':
    // 100,Abyss Lake Instance,3600,300,abyss_03,160,155
    
    // Instance Creation
    //============================================================
    prontera,151,190,6	script	Sample Instance	101,{
    	.@instance$ = "Abyss Lake Instance";
    
    	if (instance_live_info(ILI_NAME, instance_id(IM_PARTY)) == .@instance$) {  // the instance "Abyss Lake Instance" is running
    		mes "[Sample Instance]";
    		mes "You are already part of an instance.";
    		next;
    		switch(select("Enter Instance.:Cancel.")) {
    		case 1:
    			break;
    		case 2:
    			mes "[Sample Instance]";
    			mes "You don't want to try again?";
    			emotion ET_CRY;
    			close;
    		}
    	}
    	else if (instance_id(IM_PARTY)) {	// another instance is running
    		mes "[Sample Instance]";
    		mes "You are part of the instance " + instance_live_info(ILI_NAME, instance_id(IM_PARTY)) + ".";
    		close;
    	}
    	else {
    		mes "[Sample Instance]";
    		mes "Would you like to try the sample instance in Abyss Lake 3?";
    		next;
    		switch(select("Create Instance.:Cancel.")) {
    		case 1:
    			.@create = instance_create(.@instance$);
    			if (.@create < 0) {
    				mes "[Sample Instance]";
    				switch (.@create) {
    					case -1: mes "ERROR: Invalid type."; break;
    					case -2: mes "ERROR: Party not found."; break;
    					case -3: mes "ERROR: Instance already exists."; break;
    					case -4: mes "ERROR: No free instances."; break;
    				}
    				mes " ";
    				mes "Instance creation ^FF0000failed^000000.";
    				emotion ET_HUK;
    				close;
    			}
    			mes "[Sample Instance]";
    			mes "Instance created.";
    			mes " ";
    			mes "Now entering the instance...";
    			next;
    			break;
    		case 2:
    			mes "[Sample Instance]";
    			mes "Okay. Maybe next time!";
    			close;
    		}
    	}
    	.@enter = instance_enter(.@instance$);
    	if (.@enter != 0) {
    		mes "[Sample Instance]";
    		switch (.@enter) {
    			case 1: mes "ERROR: Party not found."; break;
    			case 2: mes "ERROR: Party does not have an instance."; break;
    			case 3: mes "ERROR: Unknown error."; break;
    		}
    		mes " ";
    		mes "Instance entry ^FF0000failed^000000.";
    		emotion ET_HUK;
    		close;
    	}
    	close;
    }
    
    // Instance Scripts
    //============================================================
    abyss_03,154,159,6	script	Instance NPC#start	101,{
    	mes "[Instance NPC]";
    	mes "Are you ready to begin?";
    	next;
    	switch(select("Yes.:No.")) {
    	case 1:
    		mes "[Instance NPC]";
    		mes "Good luck.";
    		close2;
    		donpcevent instance_npcname("#ins_abyss03_mobs")+"::OnEnable";
    		delwaitingroom;
    		disablenpc instance_npcname(strnpcinfo(0));
    		end;
    	case 2:
    		mes "[Instance NPC]";
    		mes "Take your time.";
    		close;
    	}
    	end;
    
    OnInit:  // hide the NPC on the normal map
    	disablenpc strnpcinfo(0);
    	end;
    OnInstanceInit:  // initialize the NPC when the instance is created
    	disablenpc instance_npcname("abysslakedunwarp004");  // disable original warp portal (currently buggy)
    	waitingroom "Click here to start!",0;
    	end;
    }
    
    abyss_03,0,0,0	script	#ins_abyss03_mobs	-1,{
    	end;
    OnEnable:
    	initnpctimer;
    	end;
    OnTimer1000:  //strnpcinfo(4) will retrieve the instanced map name
    	mapannounce strnpcinfo(4),"Instance NPC: The Abyss Lake instance has begun.",bc_all;
    	end;
    OnTimer4000:
    	mapannounce strnpcinfo(4),"Instance NPC: Smash the Treasure Chest in the center of the map for a prize.",bc_all;
    	end;
    OnTimer5000:
    	stopnpctimer;
    
    	// spawn mobs
    	.@map$        = instance_mapname("abyss_03");
    	.@label$      = instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
    	.@label_boss$ = instance_npcname(strnpcinfo(0))+"::OnMyBossDead";
    	monster .@map$,0,0,"Huge Poring",1002,20,.@label$,2;
    	monster .@map$,0,0,"Huge Drops",1113,15,.@label$,2;
    	monster .@map$,0,0,"Huge Poporing",1031,10,.@label$,2;
    	monster .@map$,0,0,"Huge Marin",1242,10,.@label$,2;
    	monster .@map$,0,0,"Tiny Zombie",1015,30,.@label$,1;
    	monster .@map$,0,0,"Huge Mime Monkey",1585,2,.@label$,2;
    	monster .@map$,97,102,"Treasure Chest",1732,1,.@label_boss$,2;
    	end;
    OnMyMobDead:  // normal mobs
    	dispbottom "What am I doing? I should be attacking the Treasure Chest!";
    	viewpoint 0,97,102,0,0xFF0000;
    	switch (rand(6)) {  // for fun (:
    		case 0: sc_start SC_STONE,5000,0; break;
    		case 1: sc_start SC_FREEZE,5000,0; break;
    		case 2: sc_start SC_STUN,5000,0; break;
    		case 3: sc_start SC_SLEEP,5000,0; break;
    		case 4: sc_start SC_CONFUSION,5000,0; break;
    		case 5: sc_start SC_BLIND,5000,0; break;
    	}
    	end;
    OnMyBossDead:  // treasure chest
    	specialeffect2 EF_MVP;
    	getitem 512,1; //Apple
    
    	// trigger other events
    	.@map$   = instance_mapname("abyss_03");
    	.@label$ = instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
    	killmonster .@map$,.@label$;
    	mapannounce .@map$,"Instance NPC: Good work! Please speak to me as soon as possible.",bc_all;
    	donpcevent instance_npcname("Instance NPC#finish")+"::OnEnable";
    	end;
    }
    
    abyss_03,97,102,4	script	Instance NPC#finish	101,{
    	mes "[Instance NPC]";
    	mes "Congratulations! You've finished the instance.";
    	mes "I'll send you back to town now.";
    	emotion ET_BEST;
    	close2;
    	warp "prontera",156,191;
    	instance_destroy();
    	end;
    
    OnInit:
    	disablenpc strnpcinfo(0);
    	end;
    OnInstanceInit:
    	disablenpc instance_npcname(strnpcinfo(0));
    	end;
    OnEnable:
    	enablenpc instance_npcname(strnpcinfo(0));
    	specialeffect EF_HIDING;
    	end;
    }
    
    abyss_03,115,26,0	script	#ins_abyss03_warp	45,5,5,{
    	end;
    OnTouch:
    	mes "Are you sure you want to leave?";
    	next;
    	switch(select("Leave.:Stay.")) {
    	case 1:
    		warp "prontera",156,191;
    		break;
    	case 2:
    		warp strnpcinfo(4),160,155;
    		break;
    	}
    	close;
    OnInit:
    	disablenpc strnpcinfo(0);
    	end;
    }

     

    • Upvote 1
  9. You can use the item scripts and use the @size command on equip and unequip. Example:
     

      - Id: 4126
        AegisName: Minorous_Card
        Name: Minorous Card
        Type: Card
        Buy: 20
        Weight: 10
        Locations:
          Right_Hand: true
        Flags:
          BuyingStore: true
          DropEffect: CLIENT
        Script: |
          atcommand("@size 2");
          bonus2 bAddSize,Size_Large,15;
          bonus bBaseAtk,5;
        UnEquipScript: |
          atcommand("@size 0");

     

  10. You use strcharinfo(3) which first of all returns a string, so your calculation fails and second it returns the name of the map the character is in, which sure isn't what you want.
     

    .@price = .@base_price * strcharinfo(3);
    *strcharinfo(<type>{,<char_id>})
    
    This function will return either the name, party name or guild name for the
    invoking character. Whatever it returns is determined by type.

    To get the level of a character, you can simply use the BaseLevel variable, which is pre-defined by rAthena. This should do what you want:
     

    .@price = .@base_price * BaseLevel;

    Also, since you always need the same base price, you could move the variable to OnInit and use a NPC variable.
    This saves your script from having to assign the variable on every call. Probably this isn't really crucial performancewise, but it also helps to organize your script better, because you can use NPC variables globally in your NPC, you can use them anywhere you want and know they are defined.

    Lastly, you are writing the zeny price hard in your string. I assume because you want it to be comma separated. You can achieve this dynamically with the global F_InsertComma function.

    Here is an example of the script you provided, with what I mean:
     

    -	script	BUFF_CMD	FAKE_NPC,{
    	OnInit:
    	  	.basePrice = 5000; // ราคาพื้นฐานสำหรับการให้บัฟ
    		bindatcmd "buff", strnpcinfo(0) + "::OnCommand";
    		end;
    
    	OnCommand:
    		.@price = BaseLevel * .basePrice;
    
    		if ( getmapflag(strcharinfo(3), MF_PVP) || getmapflag(strcharinfo(3), MF_BATTLEGROUND) ||  getmapflag(strcharinfo(3), MF_GVG) ) {
    			mes "ใช้ไม่ได้ในแผนที่ PVP/BG/WOE";
    			close;
    		}
    
    		if ( Zeny < .@price ) {
    			mes "ต้องใช้เงิน " + F_InsertComma(.@price) + "z. ในการกดใช้บัฟ";
    			close;
    		}
    		
    		if ( select("บัฟเลย " + F_InsertComma(.@price) + "z ก็ไหว!","ไม่เอาดีกว่า!") == 2 ) {
    			mes "แค่ " + F_InsertComma(.@price) + "z ก็ยัง ^FF0000งก^000000 เนอะ";
    			mes "ตีมอนแปปเดียวก็ได้แล้ว";
    			mes "ฆ่ามอนยังไงก็ได้เงินไปด้วยอยู่แล้ว";
    			close;
    		}
    		Zeny -= .@price;
    
    		// บัฟที่ได้
    		specialeffect2(42);
    		sc_start(SC_BLESSING, 3600000, 10);
    		
    		specialeffect2(37);
    		sc_start(SC_INCREASEAGI, 3600000, 10);
    		
    		specialeffect2(112);
    		sc_start(SC_KYRIE, 3600000, 10);
    
    		specialeffect2(76);
    		sc_start(SC_MAGNIFICAT, 3600000, 10);
    
    		mes "จัดไป!";
    		mes "ขอให้มีความสุขกับการเก็บเลเวล!";
    		mes "ด้วยความปรารถนาดีจาก TooHard-RO!";
    		close;
    }

     

    • MVP 1
×
×
  • Create New...