Jump to content
  • 0

Instance unique variable


Alayne

Question


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Hi peoples,

As you might have seen it, I've released a big bunch of script recently, including some instances.

But I encounter a major issue when several team run the same instance at the same time.

I'm using a general npc to handle everything (mob pop, warps...) and specific others for dialog display, and run from one to the other by using donpcevent.

The problem come with this command in fact, cause I have to keep tracks off certains infos, such as level or speaking char. Therefor, i've used variable like 'level, which is supposed to be bound to the instance. When two teams run the instance at the same time, even though some part are handled correctly (mob, dead mob event, warp...) some doesn't, due to those variable, as if it were share within the two instances running.

How can we handle that correctly?

  • Upvote 1
Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Allright peoples I've finally fixed everything.

There was several issue, one with the getpartymember, which was called with bad id and therefor wasn't filling the temp array properly (that's why I was warping players from second team, not first one)

And another was with the "talking" variable, which, as megu (I think) said, was shared between instances and therefor block the second team going.

Thanks anyway peoples!

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

if you did include one of the files so we can debug

however i think it's maybe something like the map name and the npc name 

they are generated for the instance 

*instance_npcname("<npc name>"{,<instance id>})

*instance_mapname("<map name>"{,<instance id>})



example:

donpcevent instance_npcname("#PronteraNPC") + "::OnStart"; end;


prontera,0,0,0	script	#PronteraNPC	CLEAR_NPC,{
OnStart:
	'map$ = instance_mapname("prontera");
	'ondead$ = instance_npcname("#PronteraNPC")+"::OnMobDead";
	monster 'map$,0,0,"Poring",1002,1,'ondead$;
end;
	
OnMobDead:
	'map$ = instance_mapname("prontera");
	'ondead$ = instance_npcname("#PronteraNPC")+"::OnMobDead";
	monster 'map$,0,0,"Poring",1002,1,'ondead$;
end;
	
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

You can take the Morse Cave instance I've released, that's the easier to understand the issue. For the doevent, that's what I do. But take the morse cave, and give it a try with two team in the same time (the hardest point is to go on with both if you're alone ^^')

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Using instance variable should be safe.

In some script you're using permanent variable to store instance info, which are probably the culprits.

"$"      - A global permanent variable.

e.g.

$mm_instance
$instance_vp_level
...

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

yeah I know, that's when I tried to changed those and started using instance variable that I encountered this issue.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Be careful when using NPC variable too. Instance NPCs are duplicates of original NPCs. NPC variable share his infos in duplicate NPC.

e.g.

1@rev,27,181,4	script	Kaep::alamocka	HIDDEN_WARP_NPC,2,2,{
	end;
	
OnTouch:
	if(.talking == 0)
	{
		set 'mocTalking, getcharid(3);
		set .talking, 1;

 

Edited by Capuche
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Arf is it? Well then there's no solution...If I can't use npc variable, global nor instance, what am I supposed to use? ^^'

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

So far using instance variable on instance map is safe. The initiales infos could be stored again in instance variable after instance_create.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

That's what I thought too, but then, how is it possible that this scenario might happen:

Team A enter in Morse Cave, and pass step one (ghoul + yanku). They enter on second map and have morocc dialog

Team B enter in another instance of Morse Cave, and kill the Ghouls but don't enter in second map, while team A kill morocc

Now that weakened is dead, team A should be warped other map. But the dialog of Yanku change the 'mocTalking variable, and when we enter on warp section, that Team B that is warped, not team A.

Like if, as you said, 'mocTalking was shared by the two instances...

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

what the warp you use ?

i suggest you try like this

prontera,156,22,0	script	prt_fild08_warp	45,1,1,{
	'map$ = instance_mapname("prt_fild08");
	instance_warpall 'map$,170,375;
	
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

Nope that's not possible cause only half of the team member should be warped to the first map, and the other half to another map. So instance_warpall is not possible.

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

prontera,156,22,0	script	prt_fild08_warp	45,1,1,{
	getpartymember getcharid(1),1;
	'count = $@partymembercount;
	'map$ = instance_mapname("prt_fild08");
	'map2$ = instance_mapname("?");
	if(('count / 2) > 'countwarped){
		'countwarped += 1;
		warp 'map$,170,375;
	}else{
		warp 'map2$,170,375;
	}
}

what the warp script you use ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

attachrid 'mocTalking;
//warp all players to fourth room + summon
getpartymember getcharid(1),0;
set .@memberCount, $@partymembercount;
copyarray .@members[0], $@partymemberaid[0], .@memberCount;
for(set .@i,0; .@i<.@memberCount; set .@i,.@i+1)
{
		if(attachrid(.@members[.@i]) == 1)
		{
			warp .@map$, 111, 44;
		}
}

With .@map$ being


set .@map$, strnpcinfo(4);

or

set .@map$, instance_mapname(strnpcinfo(4), instance_id())

Tried both, same issue.

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  

i did see the script you are talking about

i don't know why you get this issue but i see you always attach a player even if he already attached so first thing i would suggest don't use attachrid 'mocTalking; when the player already attached

of corse even if you use i don't see where this would be a problem but it's possible that it would create a problem like that

also the same for instance_id() the script would know the instance id without (Except for instance_announce)

so

set .@npcname$, instance_npcname(strnpcinfo(0));

and

set .@npcname$, instance_npcname(strnpcinfo(0), instance_id());

have must have the same result

but as always i maybe wrong and also maybe this have nothing to do with the issue

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  342
  • Reputation:   169
  • Joined:  02/25/12
  • Last Seen:  

I'll give it a shot without the instance_id.

For the attachrid, I've allready tried it yesterday, the only real time I need it is when I go from npc a to npc b with a donpcevent, cause the binding is lost at this particular time. But I'll give it a shot without the other it might increase the success rate maybe ^^

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...