Jump to content

Homunculus S and sql read


utofaery

Recommended Posts


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

Well here goes.

 

I was hoping there could be something like read

homunculus S previous form before mutation

so that I could make quest script from that.

 

Eg. Bayeri  from  Amistr

And so on.

 

Will be glad if this can be added in thank you.

Link to comment
Share on other sites


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

You can already do this. Just do a query on the 'homunculus' table and grab the `prev_class` to get the ID of the homunculus' previous class.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

 

You can already do this. Just do a query on the 'homunculus' table and grab the `prev_class` to get the ID of the homunculus' previous class.

 

Sir if you will please give me example on how I would do that.

I am not good at all at sql than I could create npc script which sell stuff.

Something like

I have trigger the npc script then script checks

for my homunculus prev_class through query_sql

then the script would go on

if prev_class a then action 1 ...

Link to comment
Share on other sites


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

query_sql "SELECT `prev_class` FROM `homunculus` WHERE `char_id` = "+ getcharid(0) +" LIMIT 1", .@prev_class;
if (.@prev_class == 6001) {
   mes "I was a small Lif!";
   close;
}

Something like that should do fine.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

Thank you for your helping hand,  Aleos.

 

 

prontera,154,182,4 script SQLTest 90,{
query_sql "SELECT `prev_class` FROM `homunculus` WHERE `char_id` = "+getcharid(0)+" LIMIT 1", .@prev_class;
if (.@prev_class == gethominfo(1) ) {
mes .@prev_class+" "+gethominfo(1);
close;
}
else
{
mes .@prev_class;
mes gethominfo(1);
close;
}
}
 

Now everytime I talk to that npc it shows something like:

 

[Warning]: Unexpected type for argument 1. Expected string.
[Debug]: Data: variable name='.@prev_class' index=0
[Debug]: Function: mes
[Debug]: Source (NPC): SQLTest at prontera (154,182)
[Warning]: Unexpected type for argument 1. Expected string.
[Debug]: Data: number value=6009
[Debug]: Function: mes
[Debug]: Source (NPC): SQLTest at prontera (154,182)
Edited by utofaery
Link to comment
Share on other sites


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

prontera,154,182,4 script SQLTest 90,{

  query_sql "SELECT `prev_class` FROM `homunculus` WHERE `char_id` = "+getcharid(0), @prev_class;

  if (getarraysize(@prev_class)) { // If the person has a homunculus or not.

    if (@prev_class == gethominfo(1)) {

      mes "Your homunculus hasn't evolved yet!";

      close;

    } else {

      mes "Previous class: "+@prev_class;

      mes "Current class: "+gethominfo(1);

      close;

    }

  } else {

    mes "You don't even have a homunculus!";

    close;

}

  • Like 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

Sir your script is superb. And there is something stuff came up.

Sometimes if homunculus is owned by profession other than alchemist,

Sql data related to the homunculus is not deleted

in table char and skill_homunculus, when delete or somehow.

So I was hoping if there is way to clean not existing homunculus data in the db by script or not?

Link to comment
Share on other sites


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

Are you talking about people using @makehomun? How would a class other than Alchemist get a homunculus?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

Yes. Well the case would be npc script which grant player skill

with call homunculus and rest resurrect homunculus.

And rathena always make reset skill added by script command

Eg. skill "bash",1; by npc script to archer

Then after status change that skill is gone.

And so I wish for an npc script to clean out leftover

In table char, skill_homunculus,

if linked homunculus non-exists anymore.

Then @makehomun or by skill can create homunculus again.

Link to comment
Share on other sites


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

Hm. Well you can always add a check before the query to get the class of the player, and if they aren't of Alchemist class, then ignore it.

Link to comment
Share on other sites

×
×
  • Create New...