Issue information

Issue ID
#6936
Status
Working as Intended
Severity
None
Started
Hercules Elf Bot
Nov 27, 2012 18:53
Last Post
Hercules Elf Bot
Nov 27, 2012 23:43
Confirmation
Yes (0)
No (3)

Hercules Elf Bot - Nov 27, 2012 18:53

Originally posted by [b]capuche[/b]
Hello!

Using [color=#ff0000]r16821[/color] version+, when i store array values in [color=#0000ff].variable[][/color] on the Label [color=#0000ff]OnInit[/color] and [color=#0000ff]Duplicate[/color] the NPC, there are the same[color=#0000ff] .variable[][/color]'s[color=#0000ff] [/color]value double in the [color=#0000ff].variable[][/color] of 1 NPC.

Example:
[CODE]
prontera,164,188,4 script ihbih 100,{
set .@menu, select(.menu1$) -1;
close;
OnInit:
setarray .skill$[0], "Acid Terror", "Arrow Shower";
for ( .@i = 0; .@i < getarraysize(.skill$); .@i += 1 )
set .menu1$, .menu1$ +":"+ .skill$[.@i];
end;
}
prontera,166,188,4 duplicate(ihbih) ihbih#2 100
[/CODE]

There are the [color=#ff0000]same menu twice in the same NPC[/color]. Bug?

Hercules Elf Bot - Nov 27, 2012 20:11

Originally posted by [b]Euphy[/b]
Duplicate NPCs share NPC variables. If it weren't for this, duplicates would not be much more efficient than normal scripts.

The reason you get a menu twice is because you don't initialize the [b].menu1$[/b] variable with [b]set .menu1$,"";[/b], and the OnInit label runs twice.

Hercules Elf Bot - Nov 27, 2012 23:43

Originally posted by [b]capuche[/b]
/ok Thanks Euphy.