Jump to content
  • 0
Louis T Steinhil

setunitdata UDT GROUP & setunittitle

Question

6 answers to this question

Recommended Posts

  • 0

The error is due to the main NPC not being in a map. As it is not in a map, Herc most likely didn't initialize unit data for it (since it would be useless).

 

Either put it in a map or add a check to not apply unitdata for it. Here is how to do the 2nd option:

OnInit:
	if (strnpcinfo(NPC_MAP) == "") // Not in a map, can't set view data
		end;

	setunitdata(getnpcid(), UDT_GROUP, 1);
	setunittitle(getnpcid(), "Goddess Statue");
	end;

 

Share this post


Link to post
Share on other sites
  • 0

How are you setting the title/group for the first one? OnInit should be called in every duplicate, so you could just use it to set the title/group

Share this post


Link to post
Share on other sites
  • 0
10 hours ago, KirieZ said:

How are you setting the title/group for the first one? OnInit should be called in every duplicate, so you could just use it to set the title/group

Ah it's different, okay thanks for the advice!

I set the title group like this.

OnInit:
	setunitdata( getnpcid("[ Heal & Buffs ]"), UDT_GROUP, 21);
	setunittitle( getnpcid("[ Heal & Buffs ]"), "Goddess Statue" );
	end;

 

Share this post


Link to post
Share on other sites
  • 0

what if you simply use "getnpcid()" without the NPC name? or use the full name. I am assuming your duplicates have a hidden or unique name added to them, so this getnpcid is not picking it and all of them are targeting the main one.

 

Try to either use just "getnpcid()" (which should target the current NPC), or if this doesn't work, use strnpcinfo to get the full name instead of the display name

Share this post


Link to post
Share on other sites
  • 0
7 hours ago, KirieZ said:

what if you simply use "getnpcid()" without the NPC name? or use the full name. I am assuming your duplicates have a hidden or unique name added to them, so this getnpcid is not picking it and all of them are targeting the main one.

 

Try to either use just "getnpcid()" (which should target the current NPC), or if this doesn't work, use strnpcinfo to get the full name instead of the display name

I get this error when i set it to

OnInit:
	setunitdata( getnpcid(), UDT_GROUP, 21);
	setunittitle( getnpcid(), "Goddess Statue" );
	end;

image.png.16f9276831c9af7e4fdf6ee0bbe56365.png

 

then:

image.png.50639581ef812851e4d31fd1b7935bfc.png

OnInit:
	setunitdata( strnpcinfo(1), UDT_GROUP, 21);
	setunittitle( strnpcinfo(1), "Goddess Statue" );
	end;

Whole script:

//===== Hercules Script ======================================
//= [ Heal & Buffs ]
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.2
//===== Description: =========================================
//= Basic [ Heal & Buffs ] script.
//===== Additional Comments: =================================
//= 1.0 Initial script.
//= 1.1 Aligned coordinates with @go.
//= 1.2 Fix variables and character stuck at healing
//============================================================

-	script	Healer	FAKE_NPC,{

	.@price = 0;	// Zeny required for heal
	.@Buffs = 1;	// Also buff players? (1: yes / 0: no)
	.@Delay = 5;	// Heal delay, in seconds

	if (@HD > gettimetick(GETTIMETICK_UNIXTIME)) {
		end;
	}
	if (.@price) {
		message strcharinfo(PC_NAME),"Healing costs "+.@price+" Zeny.";
		if (Zeny < .@price) end;
		if(select("^0055FFHeal^000000", "^777777Cancel^000000") == 2) close;
		Zeny -= .@price;
	}
	specialeffect(EF_HEAL2, AREA, playerattached()); percentheal 100,100;
	if (.@Buffs) {
		specialeffect(EF_INCAGILITY, AREA, playerattached()); sc_start SC_INC_AGI,240000,10;
		specialeffect(EF_BLESSING, AREA, playerattached()); sc_start SC_BLESSING,240000,10;
	}
	if (.@Delay) {
		@HD = gettimetick(GETTIMETICK_UNIXTIME) + .@Delay;
	}
	end;
OnInit:
	setunitdata( strnpcinfo(1), UDT_GROUP, 21);
	setunittitle( strnpcinfo(1), "Goddess Statue" );
	end;	
}


// Duplicates
//============================================================
alberta,25,240,6	duplicate(Healer)	Healer#alb	4_F_08_STATUE
aldebaran,135,118,6	duplicate(Healer)	Healer#alde	4_F_08_STATUE
amatsu,200,79,4	duplicate(Healer)	Healer#ama	4_F_08_STATUE
ayothaya,207,169,6	duplicate(Healer)	Healer#ayo	4_F_08_STATUE
comodo,184,158,6	duplicate(Healer)	Healer#com	4_F_08_STATUE
einbech,57,36,6	duplicate(Healer)	Healer#einbe	4_F_08_STATUE
einbroch,57,202,6	duplicate(Healer)	Healer#einbr	4_F_08_STATUE
geffen,115,72,6	duplicate(Healer)	Healer#gef	4_F_08_STATUE
gonryun,156,122,6	duplicate(Healer)	Healer#gon	4_F_08_STATUE
hugel,89,150,6	duplicate(Healer)	Healer#hug	4_F_08_STATUE
izlude,125,118,5	duplicate(Healer)	Healer#izl	4_F_08_STATUE
jawaii,250,139,4	duplicate(Healer)	Healer#jaw	4_F_08_STATUE
lighthalzen,152,100,6	duplicate(Healer)	Healer#lhz	4_F_08_STATUE
louyang,226,103,4	duplicate(Healer)	Healer#lou	4_F_08_STATUE
manuk,272,144,6	duplicate(Healer)	Healer#man	4_F_08_STATUE
mid_camp,203,289,6	duplicate(Healer)	Healer#mid	4_F_08_STATUE
moc_ruins,72,164,4	duplicate(Healer)	Healer#moc	4_F_08_STATUE
morocc,153,97,6	duplicate(Healer)	Healer#mor	4_F_08_STATUE
moscovia,220,191,4	duplicate(Healer)	Healer#mos	4_F_08_STATUE
niflheim,212,182,5	duplicate(Healer)	Healer#nif	4_F_08_STATUE
payon,179,106,4	duplicate(Healer)	Healer#pay	4_F_08_STATUE
prontera,162,193,4	duplicate(Healer)	Healer#prt	4_F_08_STATUE
rachel,125,116,6	duplicate(Healer)	Healer#rac	4_F_08_STATUE
splendide,201,153,4	duplicate(Healer)	Healer#spl	4_F_08_STATUE
thor_camp,249,74,4	duplicate(Healer)	Healer#thor	4_F_08_STATUE
umbala,105,148,3	duplicate(Healer)	Healer#umb	4_F_08_STATUE
veins,217,121,4	duplicate(Healer)	Healer#ve	4_F_08_STATUE
xmas,143,136,4	duplicate(Healer)	Healer#xmas	4_F_08_STATUE
yuno,164,45,4	duplicate(Healer)	Healer#yuno	4_F_08_STATUE

// Duplicates (Renewal)
//============================================================
brasilis,194,221,6	duplicate(Healer)	Healer#bra	4_F_08_STATUE
dewata,195,187,4	duplicate(Healer)	Healer#dew	4_F_08_STATUE
dicastes01,201,194,4	duplicate(Healer)	Healer#dic	4_F_08_STATUE
ecl_in01,45,60,4	duplicate(Healer)	Healer#ecl	4_F_08_STATUE
malangdo,132,114,6	duplicate(Healer)	Healer#mal	4_F_08_STATUE
malaya,205,205,6	duplicate(Healer)	Healer#ma	4_F_08_STATUE
mora,55,152,4	duplicate(Healer)	Healer#mora	4_F_08_STATUE
t_garden,123,121,4	duplicate(Healer)	Healer#tgarden	4_F_08_STATUE

 

Share this post


Link to post
Share on other sites
  • 0
7 hours ago, KirieZ said:

The error is due to the main NPC not being in a map. As it is not in a map, Herc most likely didn't initialize unit data for it (since it would be useless).

 

Either put it in a map or add a check to not apply unitdata for it. Here is how to do the 2nd option:

OnInit: if (strnpcinfo(NPC_MAP) == "") // Not in a map, can't set view data end; setunitdata(getnpcid(), UDT_GROUP, 1); setunittitle(getnpcid(), "Goddess Statue"); end;


OnInit:
	if (strnpcinfo(NPC_MAP) == "") // Not in a map, can't set view data
		end;

	setunitdata(getnpcid(), UDT_GROUP, 1);
	setunittitle(getnpcid(), "Goddess Statue");
	end;

 

Oh thanks man, this works. Now every duplicate has group and title.

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.