Jump to content
  • 0

Homunculus Resetter


Question

15 answers to this question

Recommended Posts

Posted (edited)

prontera,100,100,3<tab>script<tab>Reseter<tab>100,{
mes "Do you want reset homunculus stat ?";
menu "Yes please",resetw,"No Thanks",resetn;
resetw:
 atcommand "hlvl -500";
 close;
resetn:
 close;
}

like that ? CMIIW

Edited by Yahiko
Posted (edited)

not working :/

i've tryed to modify

atcommand "hlvl -500";

to

atcommand "@hlvl -500";

But there is this error:

Please, enter a level adjustment (usage: @ homlevel <# of levels to level up>

@hlvl failed.

Edited by Belkan
Posted
{
set .@cid,getcharid(0);
atcommand "@kick "+strcharinfo(0);
query_sql "SELECT `homun_id` FROM `char` WHERE `char_id` ="+.@cid+"",.@homun_id;
sleep 1000;
if( .@homun_id > 0 )
 query_sql "UPDATE `homunculus` SET `level` = 1 WHERE `homun_id` ="+.@homun_id+"";
}

Posted (edited)

[info]: Character 'Test' logged off.

[Error]: script_rid2sd: fatal error ! player not attached!

[Debug]: Function: close (no parameters)

[Debug]: Source (NPC): Reseter at prontera (150,170)

I have try to modify the script, but the homshuffle doesn't work:

prontera,150,170,5	script	Reseter	100,{
mes "Do you want reset homunculus stat ?";
menu "Yes please",resetw,"No Thanks",resetn;

resetw:
	set .@cid,getcharid(0);
	atcommand "@kick "+strcharinfo(0);
	query_sql "SELECT `homun_id` FROM `char` WHERE `char_id` ="+.@cid+"",.@homun_id;
	sleep 1000;
	if( .@homun_id > 0 ){
		query_sql "UPDATE `homunculus` SET `level` = 1 WHERE `homun_id` ="+.@homun_id+"";
		query_sql "UPDATE `homunculus` SET `exp` = 0 WHERE `homun_id` ="+.@homun_id+"";
		query_sql "UPDATE `homunculus` SET `intimacy` = 20 WHERE `homun_id` ="+.@homun_id+"";
		query_sql "UPDATE `homunculus` SET `skill_point` = 0 WHERE `homun_id` ="+.@homun_id+"";
		set .@hom_flag,1;
		}

resetn:
	close;

OnPCLoginEvent:
	if(.@hom_flag == 1){
		atcommand "homshuffle";
		set .@hom_flag,0;
		end;
	}

}

Edited by Mysterious
Use [codebox] for content longer than 10 lines please.
Posted (edited)

now on the map server don't give error... but homshuffle doesn't work...

prontera,150,170,5    script    Reseter    100,{

mes "Do you want reset homunculus stat ?";
menu "Yes please",resetw,"No Thanks",resetn;

   resetw:
       set .@cid,getcharid(0);
       atcommand "@kick "+strcharinfo(0);
       query_sql "SELECT `homun_id` FROM `char` WHERE `char_id` ="+.@cid+"",.@homun_id;
       sleep 1000;
       if( .@homun_id > 0 ){
           query_sql "UPDATE `homunculus` SET `level` = 1 WHERE `homun_id` ="+.@homun_id+"";
           query_sql "UPDATE `homunculus` SET `exp` = 0 WHERE `homun_id` ="+.@homun_id+"";
           query_sql "UPDATE `homunculus` SET `skill_point` = 0 WHERE `homun_id` ="+.@homun_id+"";
           set .@hom_flag,1;
           }
       end;

   resetn:
       close;





   OnPCLoginEvent:
       if(.@hom_flag == 1){
           atcommand "@homshuffle";
           set .@hom_flag,0;
       }
   end;
}

Edited by Belkan
Posted (edited)

then use initnpctimer & npc variable to make a out of player running system.

player clicked -> record cid -> kicked -> initnpctimer -> OnTimer1 -> done query_sql -> end.

that's all.

Edited by goddameit
Posted

if I set the level 1 but not imposed the homshuffle the homunculus stats remain the same, then I find myself with a Homunculus Level 1 and the stats of a level 99 homunculus, for this reason I tried to set it

Posted (edited)

Ain't really script but way easier imo :

//simple it to reset homon [Lighta]
ACMD_FUNC(homreset)
{
nullpo_retr(-1, sd);

if (!sd->hd)
	return -1; // nothing to do

merc_reset_stats(sd->hd);
clif_displaymessage(sd->fd, "[Homunculus Reset]");
atcommand_homstats(fd, sd, command, message); //Print out the new stats
return 0;
}

nb : The sql option it's ok if you have char and map database in the same spot. Otherwise it will fail...

Edited by Lighta
Posted

Ain't really script but way easier imo :

//simple it to reset homon [Lighta]
ACMD_FUNC(homreset)
{
nullpo_retr(-1, sd);

if (!sd->hd)
	return -1; // nothing to do

merc_reset_stats(sd->hd);
clif_displaymessage(sd->fd, "[Homunculus Reset]");
atcommand_homstats(fd, sd, command, message); //Print out the new stats
return 0;
}

nb : The sql option it's ok if you have char and map database in the same spot. Otherwise it will fail...

I'm sorry but I can not figure out how to use it, can you give me the full script? O.o

Posted

The snippet I gave you is a src edit Belkan sorry. I can't give you an npc with it beside :

atcommand "@homreset";

the rest should be fine.

@goddameit the sql way will only work if char and map sharing the same database. It's usually the case but oyu should know you're breaking servers independence here.

(since query_sql using map-server db connection to execute his query there no way he acces homunculus table wich part of char db if it's ain't the same. (especially if you're using another host for char and map)

Posted (edited)

prontera,150,170,9	script	HomResetP1	100,{

if(!gethominfo(1)){
	mes "[Hom Reseter]";
	mes "Hi There "+StrCharInfo(0)+",";
	mes "Sorry, but you havn't homunculus";
	close;
	}else {
		mes "[Hom Reseter]";
		mes "Hi There "+StrCharInfo(0)+",";
		mes "You wish to reset your Homunculus?";
		mes "for this service, the price is 100,000";
		next;
			switch(select("Yes:No, Thanks")) {
			case 1:
				if (Zeny < 100000){
					mes "Sorry, but you don't have enough money";
					close;
					}
				if (Zeny >= 100000){
					set zeny,zeny-100000;
					 warp "prontera",155,168;
					break;
					}
			case 2:	
				mes "[Hom Reseter]";
				mes ""+StrCharInfo(0)+", if you change your mind,";
				mes "I'm here only for you <3";
				close;
			}
	}
}




prontera,155,170,9	script	HomResetP2	100,{
if(gethominfo(6) == 1){
	homshuffle;
	warp "prontera",150,168;
}
if(gethominfo(6) >= 90){
		if(.ui)end;
		set .cid,getcharid(0);
		atcommand "@kick "+strcharinfo(0);
		Initnpctimer;
		end;
		OnTimer1000:
			set .ui,1;
			query_sql "SELECT `homun_id` FROM `char` WHERE `char_id` ="+.cid+"",.@homun_id;
			set .cid,0;
			if( .@homun_id > 0 )
				query_sql "UPDATE `homunculus` SET `level` = 1 WHERE `homun_id` ="+.@homun_id+"";
				query_sql "UPDATE `homunculus` SET `exp` = 0 WHERE `homun_id` ="+.@homun_id+"";
				query_sql "UPDATE `homunculus` SET `skill_point` = 0 WHERE `homun_id` ="+.@homun_id+"";
			set .ui,0;
		end;
}
else{
	mes "Your Homunculus must be > or = level 90";
	next;
	warp "prontera",150,168;
	}
}

can anyone help me to do homshuffle after the sql process, for reduce the 2 npc in 1 complete?

Edited by Belkan

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...