Jump to content
  • 0

Homunculus Resetter


Belkan

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

is possible create an NPC that allows you to reset homunculus' lvl then simultaneously the stats?

Edited by Belkan
Link to comment
Share on other sites

15 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  81
  • Reputation:   14
  • Joined:  08/17/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

anyone have some idea? :/

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

{
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+"";
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

[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.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

need homshuffle; test with a level 99 and you'll see better. i think to warp the player in one map where you can not escape:

if lvl >= 1: i use yoiur script

if lv == 1: homshuffle and rewarp on prontera

this is the easiest way. I will script this and post the result

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

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)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

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
Link to comment
Share on other sites

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.

×
×
  • Create New...