Jump to content

Skorm

Forum Moderator
  • Posts

    1,238
  • Joined

  • Last visited

  • Days Won

    28

Posts posted by Skorm

  1. On 2/24/2022 at 10:13 AM, PoringSpr said:

    but that way you did, it is necessary to click on the npc, I want it to activate with the presence of the character

    prontera,100,100,1	script	WalkNearMe	100,10,10,{
    end;
    OnTouch:
    	npctalk "Hello world";
    	end;
    }

    It is activated by the presence of the character. The "10,10" after "100," in the NPC header refers to the x and y distance from the NPC with which a character can "bump" into the NPC and trigger the OnTouch: event.

  2. 22 hours ago, M a p l e said:

    You are just making it easy to showcase script in order to PM sales. 😅

    PMing someone to soliciting sales is against the forums rules and would result in infractions, but someone else contacting you because they've seen your work isn't.
    So yeah, I don't think this is necessary a bad thing. I'd also like to reiterate that the Graphic Section has had this since 2011. But, I respect your input all the same.

  3. Yeah ok this is my first attempt it's completely untested and probably not going to work. Also it's horrendous this is probably better done with source tbh.

    -	script	CardHolderThing	-1,{
    OnPCStatCalcEvent:
    OnPCLoadMapEvent:
    	[email protected] = true;
    	if(inarray(.maps$,strcharinfo(3)) != -1) {
    		for([email protected] = 0; [email protected] < .slotlen; [email protected]++)
    			[email protected] &= !getequipcardcnt(.slots[[email protected]]);
    		if([email protected])
    			end;
    		for([email protected] = 0; [email protected] < .slotlen; [email protected]++) {
    			if(inarray([email protected],getequipid(.slots[[email protected]])) == -1) {
    				[email protected][getarraysize([email protected])] = getequipid(.slots[[email protected]]);
    				for([email protected] = 0; [email protected] < 4; [email protected]++) {
    					[email protected] = getequipcardid(.slots[[email protected]],[email protected]);
    					if([email protected] >= 4000) {
    						getmapunits(BL_PC,strcharinfo(3),[email protected][0]);
    						// Add player to ongoing list.
    						for([email protected] = 0; [email protected] < getarraysize([email protected]); [email protected]++) {
    							if(inarray(getd("."+strcharinfo(3)+"_mapusers"), [email protected][[email protected]]) != -1) {
    								setd "."+strcharinfo(3)+"_mapusers["+getarraysize(getd("."+strcharinfo(3)+"_mapusers"))+"]", [email protected][[email protected]];
    							}
    						}
    						for([email protected] = 0; [email protected] < getarraysize(getd("."+strcharinfo(3)+"_mapusers")); [email protected]++) {
    							// Remove player and item list.
    							if(inarray([email protected], getd("."+strcharinfo(3)+"_mapusers["[email protected]+"]")) != -1) {
    								deletearray "."+strcharinfo(3)+"_"+getd("."+strcharinfo(3)+"_mapusers["[email protected]+"]")+"_mapitems";
    								deletearray getd("."+strcharinfo(3)+"_mapusers["[email protected]+"]"), 1;
    							} 
    							// Searching through lists of map players cards...
    							else if(getcharid(3) != getd("."+strcharinfo(3)+"_mapusers["[email protected]+"]")) {
    								if(inarray(getd("."+strcharinfo(3)+"_"+getd("."+strcharinfo(3)+"_mapusers["[email protected]+"]")+"_mapitems"), [email protected]) != -1) {
    									warp "prontera",0,0;
    									dispbottom  "You've been removed from the map because someone else is already using "+getitemname([email protected])+".";
    									end;
    								}
    							}
    						}
    						// Adding card to the current players list.
    						setd "."+strcharinfo(3)+"_"+getcharid(3)+"_mapitems["+getarraysize(getd("."+strcharinfo(3)+"_"+getcharid(3)+"_mapitems"))+"]", [email protected];
    					}
    				}
    			}
    		}
    	}
    	end;
    OnInit:
    	setarray .slots, EQI_ACC_L, EQI_ACC_R, EQI_GARMENT, EQI_HEAD_LOW, EQI_HEAD_MID, EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_SHOES;
    	setarray .maps$, "alde_gld", "aru_gld", "gef_fild13";
    	.slotlen = getarraysize(.slots);
    	for([email protected] = 0; [email protected] < getarraysize(.maps$); [email protected]++)
    		setmapflag .maps$[[email protected]], mf_loadevent;
    }

     

  4. 9 hours ago, worn said:

    in this case it would be for all maps correct? I would like to put on some maps just not all

    example in pay_dun04 I want to drop x item on any monster that is killed on the map native monsters even on the map already in lhz I want another item to drop in all monsters on the map and so on with a percentage at the time of the drop, in addition to gaining the standard mob drops

    Ahh topic title is misleading then.

  5. I want a place to showcase scripts and mini-games and instances that I've made but not necessary release them. A place that I can get comments and feedback. We have that for graphics things but I think a "Script Showcase" section under scripts could be useful. Thoughts?

    • Upvote 1
    • Love 1
    • MVP 1
  6. @worn I think a more practical way to do this would be...

    https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L6663

    -	script	AllMobDrop	-1,{
    OnInit:
    	query_sql("SELECT `ID` FROM `mob_db_re` UNION SELECT `ID` FROM `mob_db2_re`;", [email protected]_ids);
    	[email protected] = getarraysize([email protected]_ids);
    	for([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
    		addmonsterdrop [email protected]_ids[[email protected]],501,100; //Red Potion at 1% drop. 
    	}
    	end;
    }

    or...
    https://github.com/rathena/rathena/blob/master/doc/item_bonus.txt#L465

    -	script	AllMobDrop	-1,{
    OnPCLoginEvent:
    	bonus_script "bonus2 bAddMonsterDropItem,501,100;",86400,8,0; //Red Potion at 1% drop for 24 hours.
    	end;
    }

     

  7. I think this is a better approach because the latter will still trigger on normal spawning MVPS.

    Change the Bloody Branch item script to...

    monster "this",-1,-1,"--ja--",-3,1,"BB_MVP_Announce::OnBBMVPDeath";

    And then add this npc...

    -	script	BB_MVP_Announce	-1,{
    OnBBMVPDeath:
    	announce "'"+ strcharinfo(0) +"' has killed ("+ getmonsterinfo(killedrid,MOB_NAME) +").",bc_yellow|bc_all;
    	end;
    }

     

  8. Yeah just set a npc variable for it.
     

    prontera,100,200,3	script	Picky	78,{
    	if(!.one_at_a_time) {
    		.one_at_a_time = 1;
    		mes "Hello";
    		next;
    		.one_at_a_time = 0;
    	} else {
    		mes "Do you mind I'm talking to someone here!";
    	}
    	close;
    }

    Edit --

    I thought about it a little more and this method might not always work for example if a player gets disconnected while talking with the npc and never resets the variable. So instead maybe it would be better to use an npctimer there might still be some conditions where the player leaves the npc and is still attached but I think overall it's a better approach.

    prontera,100,200,3	script	Picky	78,{
    	if(!.one_at_a_time) {
    		attachnpctimer;
    		initnpctimer;
    		mes "Hello";
    		next;
    	} else {
    		mes "Do you mind I'm talking to someone here!";
    	}
    	close;
    
    Ontimer0:
    	.one_at_a_time = 1;
    OnTimer5000:
    	if(getattachedrid()) {
    		attachnpctimer;
    		initnpctimer;
    	}
    OnTimerQuit:
    	.one_at_a_time = 0;
    	stopnpctimer;
    	detachnpctimer;
    }

    @Reborn

  9. On 11/11/2021 at 10:19 PM, DEsMOn said:

    This Error Pops up in CMD how to get rid of it?

    image.png.210b31050ae4044ac4dcc7a95942faee.png

    It looks like the command mobcount was updated at some point to require another parameter.

    Replace the errored line with...
     

    if(!getusers(8)&&mobcount(strnpcinfo(4),"all")){killmonsterall strnpcinfo(4);}

     

  10. On 8/20/2021 at 11:59 AM, Emistry said:

    actually can, using the unitwarp(...) script command, but it create unnecessary error when you do reloadscript

     

    back to the topics,

     this NPC script cant be done without the create/duplicate/clone NPC. 

    The NPC need to be allow to support concurrent triggered by users. There could be more than one players use the item to generate the NPC which only they can see it.

    If you use only one or specific few NPC, it cant support the demand. 

    it need to clone the NPC then do cloakon to display the NPC, then delete the NPC upon done.

    Exactly that's why I mentioned doing it instead with a stationary monster something that could just be spawned on demand then do the checks on the mobs death. Also I didn't know that about unitwarp makes sense though since NPCs and Mobs are very similar and the latter can move between maps.

  11. On 8/17/2021 at 8:50 AM, DemonChuck said:

    Monster drop zeny for a low chance and can edit by monster?

    poring = 1% chance of dropping zeny
    poporing = 2% chance of dropping zeny

    Thanks

    Another way that's a little more involved but probably better for the server. Would be to just add an item that the mob could drop which when consumed increases the players zeny by a specific amount. You could make an item for each amount like 1k 10k 100k etc.

    -	script	sampledrop	-1,{
    OnInit:
    	addmonsterdrop 1002,90000,100; // 1% Poring Zeny Bag
    }

    Example item_db_usable

      - Id: 90000
        AegisName: Zeny Bag
        Name: Zeny Bag
        Type: Cash
        Buy: 10
        Weight: 10
        EquipLevelMin: 1
        Script: |
          Zeny += 10000;

    -----------------------------------------------------------

    Again another way that you might accomplish this would be to enable:

    // Zeny from mobs
    zeny_from_mobs: yes

    In monster.conf

    And then edit the formula in mob.cpp to follow some kind of curve based on mob level.

    			if(battle_config.zeny_from_mobs && md->level) {
    				 // zeny calculation moblv + random moblv [Valaris]
    				zeny=(int) ((md->level+rnd()%md->level)*per*bonus/100.);
    				if(md->db->mexp > 0)
    					zeny*=rnd()%250;
    			}

     

  12. 9 hours ago, zDUREXz said:

    how to write it.

    So as far as I know NPCs cannot travel between maps which means there would need to be a duplicate of that hidden npc on every map that you wanted this to work on. With that said there are other ways that this could work with a monster spawning instead but that's not what I've created... I made three versions that work slightly different and have their own unique drawbacks.

    // This one will throw a Error/Debug if you're on a map where the npc does not exist.
    prontera,0,0,5	script	Hidden NPC#prontera	HIDDEN_WARP_NPC,{
    	if ( strcharinfo(0) == .character$ ) {
    		mes "Blah";
    		close2;
    		movenpc strnpcinfo(0),0,0;
    		setnpcdisplay(strnpcinfo(0), HIDDEN_WARP_NPC);
    	}
    	end;
    
    OnMoveNPC:
    	.character$ = strcharinfo(0);
    	getmapxy([email protected]$,[email protected],[email protected]);
    	setnpcdisplay(strnpcinfo(0), 4_TREASURE_BOX);
    	movenpc strnpcinfo(0),[email protected],[email protected];
    }
    
    geffen,0,0,0	duplicate(Hidden NPC#prontera)	Hidden NPC#geffen	HIDDEN_WARP_NPC

    Item Script:

    	doevent "Hidden NPC#"+strcharinfo(3)+"::OnMoveNPC";

    ----------------------------

    // This one will not but is hardcoded specific to the character.
    prontera,0,0,5	script	Hidden NPC#1	HIDDEN_WARP_NPC,{
    	if ( strcharinfo(0) == "AnnieRuru" ) {
    		mes "Blah";
    		close2;
    		movenpc strnpcinfo(0),0,0;
    		setnpcdisplay(strnpcinfo(0), HIDDEN_WARP_NPC);
    	}
    	end;
    
    OnMoveSpecialNPC:
    	getmapxy([email protected]$,[email protected],[email protected],BL_PC,"AnnieRuru");
    	if( [email protected]$ == strnpcinfo(4) ) {
    		setnpcdisplay(strnpcinfo(0), 4_TREASURE_BOX);
    		movenpc strnpcinfo(0),[email protected],[email protected];
    	}
    }
    
    geffen,0,0,0	duplicate(Hidden NPC#1)	Hidden NPC#2	HIDDEN_WARP_NPC

    Item Script:

    	donpcevent "::OnMoveSpecialNPC";

    ---------------------------

    // This one might not work from an item I've had problems with functions in items before.
    // But if it does work should fail silently.
    prontera,0,0,5	script	Hidden NPC#prontera	HIDDEN_WARP_NPC,{
    	if ( strcharinfo(0) == .character$ ) {
    		mes "Blah";
    		close2;
    		movenpc strnpcinfo(0),0,0;
    		setnpcdisplay(strnpcinfo(0), HIDDEN_WARP_NPC);
    	}
    	end;
    
    OnMoveNPC:
    	.character$ = strcharinfo(0);
    	getmapxy([email protected]$,[email protected],[email protected]);
    	setnpcdisplay(strnpcinfo(0), 4_TREASURE_BOX);
    	movenpc strnpcinfo(0),[email protected],[email protected];
    }
    
    function	script	Hidden NPC Func	{
    	if(getnpcid(0,"Hidden NPC#"+strcharinfo(3))) {
    		doevent "Hidden NPC#"+strcharinfo(3)+"::OnMoveNPC";
    	}
    }
    
    geffen,0,0,0	duplicate(Hidden NPC#1)	Hidden NPC#geffen	HIDDEN_WARP_NPC

    Item Script:

    	callfunc "Hidden NPC Func";

    I think @mihaamiharu was really close in sharing @AnnieRuru's original script. Just wish they had done so with code brackets.

  13. 3 hours ago, DR4LUC0N said:

    Also not sure if it's possible, I have it set the player speed with @speed 50, and then reset to base, is there a way to instead set a temp speed that gets removed after this is complete that doesn't interfere with the players cards/equipment speed buffs unles they log out?

    You could make it a bonus that just runs out after an amount of time and resets when they relog.

    https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L6026

  14. 21 hours ago, DR4LUC0N said:

    Okay let me try and re-explain this... with this script how do I make this happen? I've been trying to edit it so please excuse my comments.

    prontera,157,176,5	script	guide	650,1,1,{
    setarray [email protected],156,156,156,153;
    setarray [email protected],170,161,153,150;
    setarray [email protected],0,0,1,0;
    .1a = ++
    OnTouch:
    	if(.guide == 0) {
    		unitwalk getcharid(3),[email protected][.guide[.1a]],[email protected][.guide[.1a]];
    		set .guide,.1a;
    	}
    	if(.guide >= 1 && [email protected][.guide] == 0) {
    		unitwalk getcharid(3),[email protected][.guide[.1a]],[email protected][.guide[.1a]];
    		set .guide, .guide++;
    	}
    //	if(.guide >= 1 && [email protected] >= 0 && [email protected][.guide] == 1) {
    //		.guide++;
    //		mes "Test complete";
    //		close;
    //		unitwalk getcharid(3),[email protected][.guide],[email protected][.guide];
    //		end;
    //	}
    //	else if([email protected] >= 1) {
    //		set .guide,0;
    //		end;
    //	}
    }
    
    prontera,157,170,6	duplicate(guide)	guide#1	650,1,1
    prontera,157,162,6	duplicate(guide)	guide#2	650,1,1
    prontera,157,153,6	duplicate(guide)	guide#3	650,1,1
    prontera,152,150,6	duplicate(guide)	guide#4	650,1,1

    I want to basically run this script OnTouch and boost the player to the next NPC on .guidetype0, except on the guidetype 1, I want to stray away from that and move onto another block and have it talk to the player but then go back to the original OnTouch basically like this...

    screenrAthena014.thumb.jpg.f5ebe6438a4c3c532fb91e4e39793750.jpg

    Except #3 it speaks to player and then moves back to the script to keep going until there's no more NPCs to move to.

    Maybe something like this.

    prontera,157,176,5	script	guide	650,1,1,{
    end;
    OnTouch:
    	[email protected] = atoi(strnpcinfo(2));
    	if([email protected]+1 == getarraysize(.npc_pos_x)) {
    		dispbottom "End";
    	}
    	else {
    		switch([email protected]) {
    			case 0:
    				npctalk "Hello I'm the first NPC!";
    				break;
    
    			case 1:
    				npctalk "Hello I'm the second NPC!";
    				break;
    
    			default:
    				npctalk "Hello I'm NPC #"[email protected]+".";
    				break;
    		}
    		unitwalk getcharid(3),.npc_pos_x[[email protected]+1],.npc_pos_y[[email protected]+1];
    	}
    	end;
    
    OnInit:
    	getmapxy([email protected]$,[email protected],[email protected],BL_NPC,strnpcinfo(0));
    	[email protected] = atoi(strnpcinfo(2));
    	.npc_pos_x[[email protected]] = [email protected];
    	.npc_pos_y[[email protected]] = [email protected];
    }
    
    prontera,157,170,6	duplicate(guide)	guide#1	650,1,1
    prontera,157,162,6	duplicate(guide)	guide#2	650,1,1
    prontera,157,153,6	duplicate(guide)	guide#3	650,1,1
    prontera,152,150,6	duplicate(guide)	guide#4	650,1,1

     

  15. 10 hours ago, Origami said:

    I want to request for a script that will get all the total exp the player gained since the login

    -	script	EXP_THING	-1,{
    OnPCLoginEvent:
    	@base_exp = BaseExp;
    	end;
    
    OnPCLogoutEvent:
    	[email protected]_exp = BaseExp - @base_exp;
    }

    Maybe not completely reliable but I can't think of any other way todo it without individually tracking everything killed or a source mod.

×
×
  • Create New...

Important Information

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