Jump to content

Patskie

Members
  • Posts

    1702
  • Joined

  • Last visited

  • Days Won

    18

Posts posted by Patskie

  1. You have to add up something like this

    OnPCKillEvent:
    		.@self = getcharid(3);
    		if (killedrid == .@self) end;
    		attachrid killedrid; 
    		.@class = Class;
    		attachrid .@self;
    		.@index = inarray(class_arr, .@class);
    		if (.@index == -1) {
    			.@size = getarraysize(class_arr);
    			class_arr[.@size] = .@class;
    			count_arr[.@size] = 1;
    		} else
    			cleararray count_arr[.@index], count_arr[.@index] + 1, 1;
    		end;

    and then you can create npc to fetch all the details like below

    .@size = getarraysize(class_arr);
    	if (!.@size)
    		mes "No data";
    	else {
    		mes "Your kills per class";
    		for (.@i = 0; .@i < .@size; .@i++)
    			mes "> Job:" + jobname(class_arr[.@i]) + " | Kill Count:" + count_arr[.@i];
    	}
    	close;

     

    • Love 1
  2. 31 minutes ago, Version said:

    still error 

    script:add_word: invalid word. A word consists of undercores and/or alphanumeric characters, and valid variable prefixes/postfixes.

    
    query_sql "INSERT INTO `redeembetalog` (`code`, `item_amount`,`name`, `time`) VALUES ('"+@voucher_code$+"', '"+@amt+"', '"+strcharinfo(0)+"',  '"+gettimestr("%Y-%m/%d %H:%M:%S",21);+"')";

     

    query_sql ("INSERT INTO `redeembetalog` (`code`, `item_amount`,`name`, `time`) VALUES ('"+escape_sql(@voucher_code$)+"', '"+@amt+"', '"+strcharinfo(0)+"', NOW())");

    Store your data like above.

    Then whenever you pull the data, format them first before showing to the npc.

    • Upvote 1
  3. 1 hour ago, jayvz17 said:

    I wonder where the data will be save? I think if you restart your server the data/list will be lost.

    "$"      - A global permanent variable.
               They are stored by map-server in database table `mapreg`.

     

    • Upvote 1
  4. Not everyone does have that Easycore battleground mod. So you have to dig in more by yourself. Some insights like below

    You could add a state in pc.hpp 

    bool cashshop_open;
    bool sale_open;
    + bool brothers;
    unsigned int block_action : 10;

    and access them in an if condition like

    if (sd->state.brothers) { // bypass the duplicate

    Of course you need to set the brothers (true/false) somewhere based on some criteria. Up to you where and how

  5. Quote
    
    ".@"     - A scope variable.
               They are unique to the instance and scope. Each instance has its
               own scope that ends when the script ends. Calling a function with
               callsub/callfunc starts a new scope, returning from the function
               ends it. When a scope ends, its variables are converted to values
               ('return .@var;' returns a value, not a reference).

    You have to used another way to store your bet amount. It's up to you to find out. I gave most of the mechanics already, besides you should detailed out your topic to prevent "1 question, last question" replies.

    • Love 1
  6. -	script	MVP_vs_MVP	FAKE_NPC,{
    	
    	OnMinute00:
    		if (gettime(DT_HOUR) % 2 || .start) end;
    		goto OnStart;
    		end;
    	
    	OnStart:
    		mapwarp "1@dth3", "prontera", 150, 150;
    		killmonster "1@dth3", "All";
    		.start = 1;
    		announce .npc$ + " We are going to have a MVP vs MVP Event.", bc_all;
    		sleep 7000;
    		announce .npc$ + " For those who want to join, you can participate by using @mvpjoin", bc_all;
    		sleep 7000;
    		announce .npc$ + " We will start the event after 1 minute", bc_all;
    		sleep 60000;
    		announce .npc$ + " The entry to the event is now closed", bc_all;
    		.start = 2;
    		sleep 7000;
    		
    		if (getmapusers("1@dth3") < 1) {
    			announce .npc$ + " Not enough participants to continue the event", 0;
    			.start = 0;
    			end;
    		}
    		
    		mapannounce "1@dth3", .npc$ + " The rules for this event is simple", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " Two MVP's will spawn at the center of the map and will attack each other", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " Before these MVP's spawn, I will give you 1 minute to make a bet", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " The bet cost for this event is " + F_InsertComma(.bet_cost) + "z and when your chosen MVP wins you'll get as much as " + F_InsertComma(.bet_rewd) + "z !!!", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " All good?? Let's start betting !!!", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " To make a bet please use @mvpbet command, I will give 1 minute for you guys to make a bet", bc_map;
    		
    		.start = 3;
    		sleep 55000;
    		mapannounce "1@dth3", .npc$ + " Betting will close in 5...", bc_map;
    		sleep 1000;
    		mapannounce "1@dth3", .npc$ + " 4...", bc_map;
    		sleep 1000;
    		mapannounce "1@dth3", .npc$ + " 3...", bc_map;
    		sleep 1000;
    		mapannounce "1@dth3", .npc$ + " 2...", bc_map;
    		sleep 1000;
    		mapannounce "1@dth3", .npc$ + " 1...", bc_map;
    		sleep 1000;
    		.start = 4;
    		mapannounce "1@dth3", .npc$ + " Betting is now closed !!!", bc_map;
    		
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " Let's get ready to RUMBLE !!!", bc_map;
    		
    		.@mid = .MVP[rand(.size)];
    		monster "1@dth3", 68, 68, "MVP A", .@mid, 1, strnpcinfo(1) + "::OnDie1", Size_Small, AI_NONE;
    		.ma = $@mobid;
    		monster "1@dth3", 71, 68, "MVP B", .@mid, 1, strnpcinfo(1) + "::OnDie2", Size_Small, AI_ATTACK;
    		.mb = $@mobid;
    		
    		unitattack .ma, .mb;
    		unitattack .mb, .ma;
    		
    		end;
    		
    	OnDie1:
    		unittalk .mb, "[MVP B] Mwahaha!~ Such a weak opponent!";
    		sleep 7000;
    		killmonster "1@dth3", "All";
    		.start = 0;
    		addrid(5, 0, "1@dth3");
    		
    		if (2 == @mvp_bet) {
    			message strcharinfo(0),"Congratulations! You won the event, Good choice!";
    			Zeny += .bet_rewd;
    		}
    		
    		@mvp_bet = 0;
    		setpcblock PCBLOCK_ATTACK | PCBLOCK_IMMUNE, false;
    		warp "SavePoint", 0, 0;
    		end;
    		
    	OnDie2:
    		unittalk .ma, "[MVP A] Mwahaha!~ Such a weak opponent!";
    		sleep 7000;
    		killmonster "1@dth3", "All";
    		.start = 0;
    		addrid(5, 0, "1@dth3");
    		
    		if (1 == @mvp_bet) {
    			message strcharinfo(0),"Congratulations! You won the event, Good choice!";
    			Zeny += .bet_rewd;
    		}
    		
    		@mvp_bet = 0;
    		setpcblock PCBLOCK_ATTACK | PCBLOCK_IMMUNE, false; 
    		warp "SavePoint", 0, 0;
    		end;
    	
    	OnEventBet:
    		mes .npc$;
    		if (!.start)
    			mes "The event is not active.";
    		else if (.start != 3)
    			mes "The event cannot accept bets at the moment.";
    		else if (Zeny < .bet_cost)
    			mes "You don't have enough zeny to make a bet.";
    		else if (@mvp_bet)
    			mes "You already placed your bet.";
    		else if (strcharinfo(3) != "1@dth3")
    			mes "Hmm~";
    		else {
    			mes "Which mvp will you bet on this match???";
    			next;
    			.@s = select("MVP A:MVP B");
    			mes .npc$;
    			mes "Are you sure you want to bet " + F_InsertComma(.bet_cost) + " on " + (.@s == 1 ? "MVP A" : "MVP B") + "?";
    			next;
    			if (select("Yes:No") & 2) end;
    			if (.start != 3) { // in case they delay the select ???
    				setpcblock PCBLOCK_ATTACK | PCBLOCK_IMMUNE, false;
    				warp "SavePoint", 0, 0;
    				end;
    			}
    			mes .npc$;
    			mes "Good luck and have fun!";
    			Zeny -= .bet_cost;
    			@mvp_bet = .@s;
    		}
    		end;
    	
    	OnEventJoin:
    		if (!.start)
    			message strcharinfo(0), "The event is not active.";
    		else if (.start != 1)
    			message strcharinfo(0), "The event is not yet allowing participants to enter.";
    		else {
    			setpcblock PCBLOCK_ATTACK | PCBLOCK_IMMUNE, true;
    			switch (rand(1,4)) {
    				case 1:
    					warp "1@dth3", 49, 50;
    					break;
    				case 2:
    					warp "1@dth3", 49, 88;
    					break;
    				case 3:
    					warp "1@dth3", 89, 88;
    					break;
    				case 4:
    					warp "1@dth3", 89, 50;
    					break;
    			}
    		}
    		end;
    	
    	OnInit:
    		bindatcmd "mvpjoin", strnpcinfo(1) + "::OnEventJoin";
    		bindatcmd "mvpbet", strnpcinfo(1) + "::OnEventBet";
    		bindatcmd "mvpstart", strnpcinfo(1) + "::OnStart", 99, 99;
    		
    		// List of MVP's
    		setarray .MVP[0], 1112, 1115, 1147, 1150, 1157, 1159;
    		.size = getarraysize(.MVP);
    	
    		.npc$ = "[MVP vs MVP Event]";
    		
    		.bet_cost = 5000; // 5,000z to bet in the event
    		.bet_rewd = 1000000; // 1,000,000z if bet wins
    		
    		end;
    }
    
    1@dth3	mapflag	monster_noteleport
    1@dth3	mapflag	noskill
    1@dth3	mapflag	noloot
    1@dth3	mapflag	noitemconsumption
    1@dth3	mapflag	nomemo
    1@dth3	mapflag	nosave	SavePoint
    1@dth3	mapflag	nowarpto
    1@dth3	mapflag	nowarp
    1@dth3	mapflag	noteleport

     

    • Upvote 3
  7. Try below script. I didn't test it too much

    -	script	MVP_vs_MVP	FAKE_NPC,{
    	
    	OnMinute00:
    		if (gettime(DT_HOUR) % 2 || .start) end;
    		goto OnStart;
    		end;
    	
    	OnStart:
    		mapwarp "1@dth3", "prontera", 150, 150;
    		killmonster "1@dth3", "All";
    		.start = 1;
    		announce .npc$ + " We are going to have a MVP vs MVP Event.", bc_all;
    		sleep 7000;
    		announce .npc$ + " For those who want to join, you can participate by using @mvpjoin", bc_all;
    		sleep 7000;
    		announce .npc$ + " We will start the event after 1 minute", bc_all;
    		sleep 60000;
    		announce .npc$ + " The entry to the event is now closed", bc_all;
    		.start = 2;
    		sleep 7000;
    		
    		if (getmapusers("1@dth3") < 1) {
    			announce .npc$ + " Not enough participants to continue the event", 0;
    			.start = 0;
    			end;
    		}
    		
    		mapannounce "1@dth3", .npc$ + " The rules for this event is simple", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " Two MVP's will spawn at the center of the map and will attack each other", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " Before these MVP's spawn, I will give you 1 minute to make a bet", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " The bet cost for this event is " + F_InsertComma(.bet_cost) + "z and when your chosen MVP wins you'll get as much as " + F_InsertComma(.bet_rewd) + "z !!!", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " All good?? Let's start betting !!!", bc_map;
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " To make a bet please use @mvpbet command, I will give 1 minute for you guys to make a bet", bc_map;
    		
    		.start = 3;
    		sleep 55000;
    		mapannounce "1@dth3", .npc$ + " Betting will close in 5...", bc_map;
    		sleep 1000;
    		mapannounce "1@dth3", .npc$ + " 4...", bc_map;
    		sleep 1000;
    		mapannounce "1@dth3", .npc$ + " 3...", bc_map;
    		sleep 1000;
    		mapannounce "1@dth3", .npc$ + " 2...", bc_map;
    		sleep 1000;
    		mapannounce "1@dth3", .npc$ + " 1...", bc_map;
    		sleep 1000;
    		.start = 4;
    		mapannounce "1@dth3", .npc$ + " Betting is now closed !!!", bc_map;
    		
    		sleep 7000;
    		mapannounce "1@dth3", .npc$ + " Let's get ready to RUMBLE !!!", bc_map;
    		
    		.@mid = .MVP[rand(.size)];
    		monster "1@dth3", 68, 68, "MVP A", .@mid, 1, strnpcinfo(1) + "::OnDie1", Size_Small, AI_NONE;
    		.ma = $@mobid;
    		monster "1@dth3", 71, 68, "MVP B", .@mid, 1, strnpcinfo(1) + "::OnDie2", Size_Small, AI_ATTACK;
    		.mb = $@mobid;
    		end;
    		
    	OnDie1:
    		unittalk .mb, "[MVP B] Mwahaha!~ Such a weak opponent!";
    		sleep 7000;
    		killmonster "1@dth3", "All";
    		.start = 0;
    		addrid(5, 0, "1@dth3");
    		
    		if (2 == @mvp_bet) {
    			message strcharinfo(0),"Congratulations! You won the event, Good choice!";
    			Zeny += .bet_rewd;
    		}
    		
    		@mvp_bet = 0;
    		setpcblock PCBLOCK_ATTACK | PCBLOCK_IMMUNE, false;
    		warp "SavePoint", 0, 0;
    		end;
    		
    	OnDie2:
    		unittalk .ma, "[MVP A] Mwahaha!~ Such a weak opponent!";
    		sleep 7000;
    		killmonster "1@dth3", "All";
    		.start = 0;
    		addrid(5, 0, "1@dth3");
    		
    		if (1 == @mvp_bet) {
    			message strcharinfo(0),"Congratulations! You won the event, Good choice!";
    			Zeny += .bet_rewd;
    		}
    		
    		@mvp_bet = 0;
    		setpcblock PCBLOCK_ATTACK | PCBLOCK_IMMUNE, false; 
    		warp "SavePoint", 0, 0;
    		end;
    	
    	OnEventBet:
    		mes .npc$;
    		if (!.start)
    			mes "The event is not active.";
    		else if (.start != 3)
    			mes "The event cannot accept bets at the moment.";
    		else if (Zeny < .bet_cost)
    			mes "You don't have enough zeny to make a bet.";
    		else if (@mvp_bet)
    			mes "You already placed your bet.";
    		else if (strcharinfo(3) != "1@dth3")
    			mes "Hmm~";
    		else {
    			mes "Which mvp will you bet on this match???";
    			next;
    			.@s = select("MVP A:MVP B");
    			mes .npc$;
    			mes "Are you sure you want to bet " + F_InsertComma(.bet_cost) + " on " + (.@s == 1 ? "MVP A" : "MVP B") + "?";
    			next;
    			if (select("Yes:No") & 2) end;
    			if (.start != 3) { // in case they delay the select ???
    				setpcblock PCBLOCK_ATTACK | PCBLOCK_IMMUNE, false;
    				warp "SavePoint", 0, 0;
    				end;
    			}
    			mes .npc$;
    			mes "Good luck and have fun!";
    			Zeny -= .bet_cost;
    			@mvp_bet = .@s;
    		}
    		end;
    	
    	OnEventJoin:
    		if (!.start)
    			message strcharinfo(0), "The event is not active.";
    		else if (.start != 1)
    			message strcharinfo(0), "The event is not yet allowing participants to enter.";
    		else {
    			setpcblock PCBLOCK_ATTACK | PCBLOCK_IMMUNE, true;
    			switch (rand(1,4)) {
    				case 1:
    					warp "1@dth3", 49, 50;
    					break;
    				case 2:
    					warp "1@dth3", 49, 88;
    					break;
    				case 3:
    					warp "1@dth3", 89, 88;
    					break;
    				case 4:
    					warp "1@dth3", 89, 50;
    					break;
    			}
    		}
    		end;
    	
    	OnInit:
    		bindatcmd "mvpjoin", strnpcinfo(1) + "::OnEventJoin";
    		bindatcmd "mvpbet", strnpcinfo(1) + "::OnEventBet";
    		bindatcmd "mvpstart", strnpcinfo(1) + "::OnStart", 99, 99;
    		
    		// List of MVP's
    		setarray .MVP[0], 1112, 1115, 1147, 1150, 1157, 1159;
    		.size = getarraysize(.MVP);
    	
    		.npc$ = "[MVP vs MVP Event]";
    		
    		.bet_cost = 5000; // 5,000z to bet in the event
    		.bet_rewd = 1000000; // 1,000,000z if bet wins
    		
    		end;
    }
    
    1@dth3	mapflag	monster_noteleport
    1@dth3	mapflag	noskill
    1@dth3	mapflag	noloot
    1@dth3	mapflag	noitemconsumption
    1@dth3	mapflag	nomemo
    1@dth3	mapflag	nosave	SavePoint
    1@dth3	mapflag	nowarpto
    1@dth3	mapflag	nowarp
    1@dth3	mapflag	noteleport

     

    • Upvote 1
  8. You can try to work with below command to get what you want

    Spoiler
    
    *pcblockskill <id>,<option>;
    *unitblockskill <id>,<option>;
    
    Prevents the given GID from casting skills when the option is 1, and enables
    the ID to cast skills again when the option is 0. This command will run for
    the attached unit if the given GID is zero.
    
    Examples:
    	// Prevents the current char from casting skills.
    	pcblockskill getcharid(3),1;
    
    	// Enables the current char to cast skills again.
    	pcblockskill getcharid(3),0;
    
    ---------------------------------------
    
    *setpcblock <type>,<state>{,<account ID>};
    *getpcblock {<account ID>};
    
    'setpcblock' command prevents/allows the player from doing the given <type> of action according
    to the <state> during the player session (note: @reloadscript removes all <type> except PCBLOCK_IMMUNE).
    The <type> values are bit-masks, multiples of <type> can be added to change the player action.
    
    The action is blocked when the <state> is true, while false allows the action again.
    
    'getpcblock' command return the bit-mask value of the currently
    enabled block flags.
    
    Available <type>:
    	PCBLOCK_MOVE				Prevent the player from moving.
    	PCBLOCK_ATTACK				Prevent the player from attacking.
    	PCBLOCK_SKILL				Prevent the player from using skills/itemskills.
    	PCBLOCK_USEITEM				Prevent the player from using usable items.
    	PCBLOCK_CHAT				Prevent the player from sending global/guild/party/whisper messages.
    	PCBLOCK_IMMUNE				Prevent the player from being hit by monsters.
    	PCBLOCK_SITSTAND			Prevent the player from sitting/standing.
    	PCBLOCK_COMMANDS			Prevent the player from using atcommands/charcommands.
    	PCBLOCK_NPCCLICK			Prevent the player from clicking/touching any NPC/shop/warp.
    	PCBLOCK_EMOTION				Prevent the player from using emotions.
    	PCBLOCK_NPC				Simulate NPC interaction. Useful for NPC with no mes window. Sum of PCBLOCK_MOVE|PCBLOCK_SKILL|PCBLOCK_USEITEM|PCBLOCK_COMMANDS|PCBLOCK_NPCCLICK.
    	PCBLOCK_ALL				Sum of all the flags.
    
    Examples:
    
    // Make the attached player invulnerable to monster (same as @monsterignore)
    	setpcblock PCBLOCK_IMMUNE, true;
    
    // Prevents the attached player from attacking and using skills
    	setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL, true;
    
    // Re-enables attack, skills and item use
    	setpcblock PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM, false;
    
    // getpcblock related checks
    	if (getpcblock() & PCBLOCK_IMMUNE)
    		mes "You are invulnerable!";
    
    	if (getpcblock() & (PCBLOCK_MOVE|PCBLOCK_SITSTAND))
    		mes "You can't walk or sit.";
    
    	if ((getpcblock() & (PCBLOCK_ATTACK|PCBLOCK_SKILL)) == 0)
    		mes "You can attack and use skills.";
    
    	if (getpcblock() & PCBLOCK_CHAT)
    		mes "You can't chat.";

     

    • Upvote 1
  9. Something like this?

    prontera,150,150,6	script	Sample	100,{
    	if (BaseLevel < 20) end;
    	switch (select("Register", "View List", (getgmlevel() < 99 ? "" : "[^FF0000GM Menu^000000] Clear List"), "Exit")) {
    		case 1:
    			if (inarray($register$, strcharinfo(0)) != -1)
    				mes "Already registered";
    			else {
    				mes "Done registration";
    				$register$[getarraysize($register$)] = strcharinfo(0);
    			}
    			close;
    		case 2:
    			.@s = getarraysize($register$);
    			if (!.@s)
    				mes "No list";
    			else {
    				mes "Registration List";
    				for (.@i = 0; .@i < .@s; .@i++)
    					mes (.@i+1) + ". " + $register$[.@i];
    			}
    			close;
    		case 3:
    			deletearray $register$;
    			end;
    	}
    }

     

    • Upvote 1
  10.  

    20 hours ago, TheKingDino said:

    This would be a lot of work and unless it's already been done I doubt someone is gonna do it for free. I've looked around a lot for something like this in the past and never found it.

    This would require client-side modification on top of the c++ coding to install the AT command, which is the easier part.

    I know this isn't really helpful. But there is a costume item called Invisible Hat, Invisible Sunglasses, and Invisible Mask(dont remember the real name).
    https://www.divine-pride.net/database/item/31292/unknown-item-31292

    So at the very least you could make an NPC or command that hands these out so a single player has the freedom to hide their own headgears. But it's hardly a solution.

    I don't think it will be hard as per your claim ?

    @tokenacc001

    Go to src/map/clif.cpp and change below from

    // prevent leaking the presence of GM-hidden objects
    if( sc && sc->option&OPTION_INVISIBLE )
    	target = SELF;

    to

    // prevent leaking the presence of GM-hidden objects
    if( (sc && sc->option&OPTION_INVISIBLE) || !val )
    	target = SELF;

    Recompile and re-test the script given by @Poring King . above change will work globally so use at your own risk.

    Photo1.PNG

    Photo2.PNG

    • Upvote 1
×
×
  • Create New...