Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Offer ] Get GID of playerattached homunculus #3210

Open
AcidMarco opened this issue May 21, 2023 · 1 comment
Open

[ Offer ] Get GID of playerattached homunculus #3210

AcidMarco opened this issue May 21, 2023 · 1 comment

Comments

@AcidMarco
Copy link

AcidMarco commented May 21, 2023

Is your feature request related to a problem? Please describe.
I've asked myself, how to get GID of playerattached homunculus to manipulate it via scripts directly? Not class (it shows monster ID), not unique ID (it shows 1/2/3/etc), but GID. I cannot get it via 'gethominfo()'. I was using getmapxy & getunits to find and get homunculus GID which is located close to the player within several cells, BUT it would be perfect to get the GID directly.

Describe the solution you'd like
To get homunculus GID directly via 'gethominfo()'.

Additional context
I've changed src a bit and it works, by adding type 'HOMINFO_GID' as PETINFO has.
Might be it would be helpful for some people using Herc and working with homunclus.
Can you check it and implement to Herc, or might be don't something?

Add to script.c [ field: static BUILDIN(unitattack) {...} ] :

	switch(type) {
	case HOMINFO_ID:
		script_pushint(st, sd->hd->homunculus.hom_id);
		break;
	case HOMINFO_CLASS:
		script_pushint(st, sd->hd->homunculus.class_);
		break;
	case HOMINFO_NAME:
		script_pushstrcopy(st, sd->hd->homunculus.name);
		break;
	case HOMINFO_INTIMACY:
		script_pushint(st, sd->hd->homunculus.intimacy);
		break;
	case HOMINFO_HUNGRY:
		script_pushint(st, sd->hd->homunculus.hunger);
		break;
	case HOMINFO_RENAME:
		script_pushint(st, sd->hd->homunculus.rename_flag);
		break;
	case HOMINFO_LEVEL:
		script_pushint(st, sd->hd->homunculus.level);
		break;
	case HOMINFO_GID:                        // Hom GID
		script_pushint(st, sd->hd->bl.id);
		break;
	default:
		script_pushint(st, 0);
		break;
	}
  • and add line to 'script->constdb_comment("gethominfo types");'
    script->set_constant("HOMINFO_GID", HOMINFO_GID, false, false); // Hom GID

Add to script.h [enum script_hominfo_types {...} ] :

enum script_hominfo_types {
	HOMINFO_ID = 0,
	HOMINFO_CLASS,
	HOMINFO_NAME,
	HOMINFO_INTIMACY,
	HOMINFO_HUNGRY,
	HOMINFO_RENAME,
	HOMINFO_LEVEL,
	HOMINFO_GID, // Hom GID
	HOMINFO_MAX
};
@AcidMarco AcidMarco changed the title [ Offer ] Get GID of playerattached homuncules [ Offer ] Get GID of playerattached homunculus May 21, 2023
@csnv
Copy link
Contributor

csnv commented Aug 14, 2023

I consider this a pretty good solution. Could you submit a PR for it? That way the staff has better visibility and can be merged easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants