Jump to content

Sehrentos

Members
  • Posts

    91
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Sehrentos

  1. On 13.2.2018 at 1:35 PM, Musika6988 said:

    I got this error Sir Sehrentos..

    Ops, there was a typo in the sample. Here is fixed version:

    @size = getarraysize(getd(".tier_reward_"+@range));
    copyarray @reward[0], getd(".tier_reward_"+@range+"[0]"), @size;

    And i think the setarray should be like this:

    setarray .tier_reward_0[0],7227,30804,30805,30806,30000,30001;
    setarray .tier_reward_1[0],7227,7227,7227,7227,7227,7227;
    setarray .tier_reward_2[0],30804,30804,30804,30804,30804,30804;
    setarray .tier_reward_4[0],30805,30805,30805,30805,30805,30805;

    2. How come it does not give all the rewards?

    Script only reward one random party member. Reward is also random from the .tier_reward_0-3

    Or did you mean to give all rewards from the .tier_reward_X array and not just one? If so, im sorry i got the wrong idea.

    I'm currently unable to test it, because i don't have a running emulator.

     

  2. Hi!

    Suggestion 1. This needs a fallback. If you cancel this prompt, then .@name does not exist.

    Quote

    if ( prompt( "Cast Loots" ) == 1 ) {
        .@name = rand( .@party_size );
        message .@party_name$[.@name],"Gained "+getitemname( @reward[.@i] )+" ( Distributed Randomly )";
    }
    getitem @reward[.@i],1,.@party_aid[.@name];

    Suggestion 2. For the random tier set you can try this

    OnInit:
        // tier rewards
        setarray .tier_reward_0,7227,30804,30805,30806,30000,30001;
        setarray .tier_reward_1,7227,7227,7227,7227,7227,7227;
        setarray .tier_reward_2,30804,30804,30804,30804,30804,30804;
        setarray .tier_reward_3,30805,30805,30805,30805,30805,30805;
    OnBoxKill:
        deletearray @reward;
        @label$ = .npc_name$+"::OnBoxKill";
        //@size = getd( ".tier_reward_"+.tier+"_size" );
        //copyarray @reward[0],getd( ".tier_reward_"+.tier+"[0]" ),@size;
    	
        // Select random tier set range 0-3
        @range = rand(4);
        @size = getarraysize(getd(".tier_reward_"+@range));
        copyarray @reward[0], getd(".tier_reward_"+@range+"[0]"), @size;
    
        doevent "WorldBoss::OnTalk";
        end;

    Suggestion 3. For the party leader name. With this you can add .@leader_name$ in the announce string.

    .@party_id = getcharid(1);
    .@party_name$ = getpartyname(.@party_id);
    .@leader_id = getpartyleader(.@party_id, 2);
    .@leader_name$ = strcharinfo(0, .@leader_id);
    announce "[World Boss] The "+.@party_name$+" Hunting Party killed the World Boss! Congratulations!", bc_all, 0xFF0000;

    I hope these help

  3. 8 hours ago, pajodex said:

    i added initnpctimer at OnInit label. however, it restarts the timer to 0

    I don't think there is a way to continue npc timer after a reload.

    Maby OnClock event or other workaround ?

    -	script	DayNight	-1,{
    OnClock0600:
    	day;
    	end;
    OnInit:
    	// setting correct mode upon server start-up
    	if (gettime(DT_HOUR)>=6 && gettime(DT_HOUR)<18) end;
    OnClock1800:
    	night;
    	end;
    }

     

    • Upvote 1
  4. I'm not quite sure what you mean, like this perhaps? :huh:

    job_sword1,117,238,1    script    electricity    1002,1,1,{
    OnTouch: // Player has entered NPC's area
      warp "prontera",155,187;
      end;
    OnInit:
      npcspeed 60;
      npcwalkto 130,250;
      end;
    } 

    You can increase the NPC's area of effect: 1002,2,2,{

    But i'm not sure if OnTouch event will work on moving NPC's.

  5. Hey,

    Remove the first if check and it should work. It will change the title$ to YOO2 if player has the item and to YOO if not.

    Or like this in both cases:

    if (countitem(19009)) {
      set title$, "YOO2";
    } else {
      set title$, "YOO";
    }

     

  6. I'm not sure if this works, but you could test it by making an NPC that sets a bonus2 bDropAddRace,RC_All,5; for the current chacter.

    bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};

    • Love 1
  7. Here is some help,

    Create an event NPC where you manage your normal monsters (sample below).

    Attach OnMobDead event on every minion and after minions have been killed activate boss event NPC.

    prt_are01,0,0,-1	script	SummonMinions#1_1	-1,{
    	end;
    
    OnInit: // disable NPC on normal map
    	disablenpc strnpcinfo(0);
    	end;
    
    OnDisable: // Disable this NPC
    	disablenpc instance_npcname(strnpcinfo(0));
    	end;
    
    OnEnable:
    	enablenpc instance_npcname(strnpcinfo(0));
    	.@map$ = instance_mapname("prt_are01");
    	.@label$ = instance_npcname(strnpcinfo(0))+"::OnMobDead";
    	// Monsters
    	areamonster .@map$,131,168,144,155,"Marin",1242,5,.@label$; //top-left
    	areamonster .@map$,155,167,168,155,"Metaling",1613,5,.@label$; //top-right
    	areamonster .@map$,144,155,144,131,"Poporing",1031,5,.@label$; //bottom-left
    	areamonster .@map$,155,144,168,131,"Drops",1113,5,.@label$; //bottom-right
    	end;
    
    OnMobDead:
    	if (mobcount(instance_mapname("prt_are01"), instance_npcname(strnpcinfo(0))+"::OnMobDead") < 1) {
    		mapannounce instance_mapname("prt_are01"),"Boss incomming!",bc_map,"0xFD3B02";
    		donpcevent instance_npcname("SummonBoss#1_1")+"::OnEnable";
    		disablenpc instance_npcname(strnpcinfo(0)); //Disable this NPC.
    	}
    	end;
    }

    Create an event NPC for the boss monster (Sample below).

    prt_are01,150,150,-1	script	SummonBoss#1_1	-1,{
    	end;
    
    OnInit: // Disable NPC on normal map
    	disablenpc strnpcinfo(0);
    	end;
    
    OnEnable:
    	enablenpc instance_npcname(strnpcinfo(0));
    	.@map$ = instance_mapname("prt_are01");
    	.@label$ = instance_npcname(strnpcinfo(0))+"::OnBossDead";
    	// Monsters
    	monster	.@map$,150,150,"The Boss",1090,1,.@label$;
    	end;
    
    OnDisable: // Disable this NPC
    	disablenpc instance_npcname(strnpcinfo(0));
    	end;
    
    OnBossDead:
    	//specialeffect2 EF_MVP; //This effect will be triggered on the player who dealt the killing blow.
    	mapannounce instance_mapname("prt_are01"),"Boss is dead!",bc_map,"0xFD3B02";
    	killmonster instance_mapname("prt_are01"),instance_npcname(strnpcinfo(0))+"::OnBossDead"; //Clean up
    
    	// Enable portal npc at the center of the room.
    	donpcevent instance_npcname("#PortalOut")+"::OnEnable";
    
    	// Disable this NPC
    	//donpcevent instance_npcname(strnpcinfo(0))+"::OnDisable";
    	disablenpc instance_npcname(strnpcinfo(0));
    
    	end;
    }

    After boss dies you activate portal event NPC (Sample below).

    prt_are01,150,150,0	script	#PortalOut	WARPNPC,2,2,{
    	end;
    
    OnInit: // Disable NPC on normal map
    	disablenpc strnpcinfo(0);
    	end;
    
    OnInstanceInit: // Disable NPC on instance init
    	disablenpc instance_npcname(strnpcinfo(0));
    	end;
    
    OnEnable:
    	mapannounce instance_mapname("prt_are01"),"[Portal] The portal to out side will be opening at the center of the room.",bc_map,"0x7799ff";
    	initnpctimer; // Activate portal after 10 seconds
    	end;
    
    OnDisable:
    	stopnpctimer;
    	disablenpc instance_npcname(strnpcinfo(0));
    	end;
    
    OnTimer10000:
    	mapannounce instance_mapname("prt_are01"),"[Portal] The portal to out side is now open.",bc_map,"0x7799ff";
    	enablenpc instance_npcname(strnpcinfo(0));
    	stopnpctimer;
    	end;
    
    OnTouch:
    	warp "prontera", 156, 167;
    	end;
    }

    Repeat this process for each level you wish to create.

    Good luck! ;)

    • Upvote 1
    • Like 1
  8. 16 hours ago, pajodex said:

    if (attachrid(.@teamA1[0])) {

        attachrid .@teamA1[0];

    Hey, you don't need to attachrid twice it is already done in the IF statement.

     

    16 hours ago, pajodex said:

    for(.@i = 1; .@i < .@num; .@i++) {

        if (attachrid(.@teamA1[0])) {

            attachrid .@teamA1[.@i];

    Same here and i think it go like this?

    for(.@i = 1; .@i < .@num; .@i++) {
    	if (attachrid(.@teamA1[.@i])) {
          // Your stuff here

    Note to attachrid: "The command returns 0 if the player cannot be attached (if the account is offline or does not exist), and 1 upon success."

    It's a good practice to do checks to avoid possible errors and help to find them.

    // Check party create was successful
    if (party_create(<party name>)) {
      // Success
    }
    
    // Check party delete member was successful
    if (party_delmember()) {
      // Success
    }
    
    // Check party add member was successful
    if (party_addmember(<party id>,<character id>)) {
      // Success
    }

     

  9. 5 hours ago, pajodex said:

    I'm getting this error in console every time I use command @die with the leader in the party

    
    [Error]: buildin_rid2name: invalid RID

     

    Hey,

    Have you tried to add in some checks like, if some member is offline? I think when getting RID when some one is offline will fail. Not 100% sure about this! xD


    Like this:

    // (Optional) Check who is the killer
    if (killedrid == killerrid) {
    	// You have been killed by your own hand
    	end;
    }
    
    // Check player is in a party
    if (getcharid(1)) {
    	getpartymember(getcharid(1), 2);
    	set .@partymembercount, $@partymembercount;
    	copyarray .@partymemberaid[0], $@partymemberaid[0], .@partymembercount;
    	for (set .@i, 0; .@i < .@partymembercount; set .@i, .@i + 1) {
    		// Try to attach each party member to this script
    		if (attachrid(.@partymemberaid[.@i])) {
    			// Now we can check player status like AFK
    			if (checkvending() && checkchatting()) {
    				// This member is AFK
    				end;
    			}
    		}
    	}
    }

     

  10. Oo the time before auctioneer came :D

     

    +1 Very nice script. Good if you need to use custom payment methods for selling stuff.

     

    But with Zeny involved, i see it as an normal auction just like said.

    mes "Close this window to open the Auction window.";
    close2;
    openauction;
    end;
    

    And give commands to players? @auction to open it.

×
×
  • Create New...