• 0
danielps

Doubt About instance_create command

Question

Guys, in script_command doc we have the follow description of command instance_create:

Instance Mode options:
 IM_NONE: Attached to no one.
 IM_CHAR: Attached to a single character.
 IM_PARTY: Attached to a party (default instance mode).
 IM_GUILD: Attached to a guild.
 IM_CLAN: Attached to a clan.

 

I have a question, fi dont set a mode it will be by default party, and when player talk to npc he will send him to the instance that the party leader created, right?
Ok, now what if i use IM_NONE. How the npc will know what instance he need to send the plaery? o.O

Share this post


Link to post
Share on other sites

12 answers to this question

Recommended Posts

  • 0

You should pass an instance id (which you should have stored somewhere since you created an IM_NONE instance) to instance_enter command to let the server know which instance it should warp the player to. See script_commands.txt for more info.

  • Upvote 1
  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Like Secrets saied, you have to set an variable for the instance you want to send the player to, also I believe that in instance_enter you will have to warp the player extra, since no one is attached.
The variable has to contain the exact same name as in the instance_db.txt.

If you need an example how instances work you could check the doc/sample/instancing.txt or look at the existing ones. 

Regards,
Chris

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
15 hours ago, Secrets said:

You should pass an instance id (which you should have stored somewhere since you created an IM_NONE instance) to instance_enter command to let the server know which instance it should warp the player to. See script_commands.txt for more info.

Ok i got it, but i think that my problem is bigger xD
I'1m creating a bg with instance commands, why? Instance (different of bg) it duplicates the maps and script, so many groups can enter it simultaneously while in bg they can't, right?

So my first point is, i have to warp the bg team after creating the instance, should i use bg_warp or instance_enter for each player in the npc waitingroom ?

Idk if it works but i'm thinking to try something like this -> bg_warp $GidBGTeam1,instance_mapname("mymapname"),93,125;

But as it's instance created with IM_NONE (cause they are random players in a waitiing room, they are not in same party), so idk if it's gonna work xD

Did u guys get my point now? Any ideia or another better way to solve my problem?

Thank you guys and already liked ur posts for helpping me! ^_^

Share this post


Link to post
Share on other sites
  • 0
9 hours ago, danielps said:

-snip-

dw I like people who actually put efforts 😆

You can do it either way, it's not gonna matter. Be sure to pass the instance id to instance_mapname so it resolves the correct instance.

  • Love 1

Share this post


Link to post
Share on other sites
  • 0
28 minutes ago, Secrets said:

dw I like people who actually put efforts 😆

You can do it either way, it's not gonna matter. Be sure to pass the instance id to instance_mapname so it resolves the correct instance.

Haha thanks a lot! I'm really tryind hard xD
Ok so just for me be sure that i understood.

I can use bg_warp to a instance map using this sir?
bg_warp $GidBGTeam1,instance_mapname("mymapname",[email protected]),93,125;

I just add the ID as you said, my original code was this -> bg_warp $GidBGTeam1,instance_mapname("mymapname"),93,125;

Now i'm sending the ID as well to the instance_mapname as you said, this should work? You are a god sir xD
Thanks a lot! Liked all you answers, i'm very glad there are people like you here in rA that help nobs as me haha
Hope you are here in rA when i finish my project xD It's a ragnarok mod, it will be a moba style, like league of legends (idk if you know this game...) xD
So, thank you so much again s2 and i will post here when i finish it =D

btw u said "dw I like people who actually put efforts" what is dw? I'm from brazil, idk slags haha

The map it about 80% done, need some detais to finish it, now i'm focused in the script and src mods ^_^
The map until now is going like this:

https://www.facebook.com/375199606295649/videos/375200579628885/
 

 

Edited by danielps

Share this post


Link to post
Share on other sites
  • 0

the way you describe your post already telling you don't have any experience writing instance script before...

anyway
 

/* db\re\instance_db.txt
//28,BG_PVP,0,10,bat_c01,100,95 // THIS LINE FAILS
//28,BG_PVP,3600,10,bat_c01,100,95 // THIS LINE will automatically destroy the instance in 10 seconds
28,BG_PVP,3600,3600,bat_c01,100,95
*/

prontera,156,185,5	script	Guild VS	1_F_MARIA,{
	[email protected] = instance_create( "BG_PVP", IM_NONE );
	if ( [email protected] < 0 ) {
		mes "failed to create instance";
		close;
	}
//	instance_enter "BG_PVP"; // THIS LINE FAILS
	instance_enter "BG_PVP", 100,95, getcharid(0), [email protected];
	end;
}
bat_c01,100,95,5	script	test#2	1_F_MARIA,{
	dispbottom strnpcinfo(4) +" test ID "+ 'test;
	end;
OnInstanceInit:
	'test = instance_id();
	end;
}

there seems to have 2 system that is different than hercules emulator that I am more familiar with

1. rathena cannot set 0 timer as timeout
if you set as 0, the map-server say "warp to 0,0" FAILS  .... doesn't make sense to me

in hercules not only we can define the map name in whatever name we want, the IOT_NONE flag also can calculate the IdleTimeOut correctly
rathena seems cannot do this, since IM_NONE doesn't have anyone to attach, the IdleTimeOut will behave in the same way as LimitTime

furthermore, hercules doesn't even have instance_db.txt file to begin with

 

2. rathena missing has_instance script command
this script command is fairly important ... without this, I have to resort to use strnpcinfo(4) to check which map I'm in
because IM_NONE doesn't attach to character/party/guild ... instance_id() can only search by npc

 

but anyway this information is enough for me to write instanced battleground script for rathena

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
11 hours ago, AnnieRuru said:

the way you describe your post already telling you don't have any experience writing instance script before...

Yeah, i've never created an instance before because i never felt to do it, and now i had an ideia to create a moba so i'm learning instance commands sorry =/

11 hours ago, AnnieRuru said:

rathena cannot set 0 timer as timeout
if you set as 0, the map-server say "warp to 0,0" FAILS  .... doesn't make sense to me

in hercules not only we can define the map name in whatever name we want, the IOT_NONE flag also can calculate the IdleTimeOut correctly
rathena seems cannot do this, since IM_NONE doesn't have anyone to attach, the IdleTimeOut will behave in the same way as LimitTime

I don't need a timeout controller, as in moba style we don't have it.. it1'sd 2 teams of 5 players, with no time limit, the goal is to destroy enemy base, so i don't really care about this point.
I just didn't understand this part when you said "warp to 0,0" FAILS", i defined a x,y to respawn in instance_db when player die, and i'm using bg_warp with defined x,y as well so i don't understand why would i have this problem.

 

11 hours ago, AnnieRuru said:

2. rathena missing has_instance script command
this script command is fairly important ... without this, I have to resort to using strnpcinfo(4) to check which map I'm in
because IT_NONE doesn't attach to character/party/guild ... instance_id() can only search by npc

 

but anyways this information is enough for me to write instanced battleground script for rathena

Ok i think i can use both strnpcinfo(4) or ,instance_mapname("mymapname",[email protected]), it's not a problem ^_^

Anyway thanks annie, you said somethings that i didn't know about instances, and i'm learning, nobody born knowing everything as you sorry 😉
Btw now that you're back to being active in the forum and answered several of my posts, I'm kind of changing my concept about you. Nothing personal and no offense, but I think you're a bit proud.

Hey guys, thanks a lot for you all, i think that now i won't have any problems to finish my script, i'm very glad to have you here in rA, you are very nice guys haha
Thanks 😉

 

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, danielps said:

I just didn't understand this part when you said "warp to 0,0" FAILS", i defined a x,y to respawn in instance_db when player die, and i'm using bg_warp with defined x,y as well so i don't understand why would i have this problem.

rathena instance script commands are ....
well it throws error on you that you don't even understand what it actually means
I have to read the source code to find out how rathena actually handling the instance ... duplicating map stuff

anyway, you can check out my example script, and I think you can learn things faster from reading a sample script

 

1 hour ago, danielps said:

I'm kind of changing my concept about you. Nothing personal and no offense, but I think you're a bit proud.

Exactly, in fact on the childish side too xD
I used to make drama in the staff area ... but I guess those posts has been hidden by moderation

and yes, you may think that way, but I've also taught a lot members how to make battleground script through PM/Skype/Discord ...
its not that I'm discouraging you,
but I'm just talking from experience that making battleground script needs more experience from making basic event script first, then only move upward
in my opinion, you should try to write some simpler event script first, to build up your basic event script knowledge,
then only tackle that harder moba style bg you spoke of

anyway you are already in my discord friend list, its ok to ask question through discord

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
32 minutes ago, AnnieRuru said:

anyway you are already in my discord friend list, its ok to ask question through discord

Ok Annie, thanks for your help, i didn't want to annoy or offend you when i said you were proud, just told that because you said "the way you describe your post already telling you don't have any experience writing instance ", of course i do not, otherwise i would not open a topic here to make a question xD. I'm not the best scripter, but i study and try it myself,I didn't come here asking anybody to create or do anything to me, i just came for some doubts and script commands behavior. Thanks for you sample script, i have already read it, you just sent it in another post to me, but there are some stuffs that i need to do in my script that you don't have in this example you sent me (after all they are different styles of battlegrounds), that is why i still openned this topic.

And i'm not proud or daring to say i'm greater than you think, but i guess i'm not as bad as you think, " write some simpler event script first", I do not expect you to read all my code (dont wanna take your time), but here it goes:

Quote

// create the instance
.id = instance_create(mobaro,IM_NONE);

// Create one of the teams
setd "$GidT1"+instance_mapname("mobaro",.id) , waitingroom2bg(instance_mapname("mobaro",.id),97,85,instance_npcname("instance_npcname",.id)+"::OnQuit",instance_npcname("instance_npcname",.id)+"::OnDie");

// warp the teams to the instace created
bg_warp getd "$GidT1"+instance_mapname("mobaro",.id),instance_mapname("mobaro",.id),rand(93,101),rand(81,88);

My main question was about the team creation and warp to the correct map (using bg and instance command), i think these steps above solve that.

I'm very very grateful for your help and other guys help. I'll try to finish it this month and show to you guys ^_^
 

Share this post


Link to post
Share on other sites
  • 0
21 hours ago, AnnieRuru said:

2. rathena missing has_instance script command
this script command is fairly important ... without this, I have to resort to use strnpcinfo(4) to check which map I'm in
because IM_NONE doesn't attach to character/party/guild ... instance_id() can only search by npc

  

but anyway this information is enough for me to write instanced battleground script for rathena

That’s because our instance system is intended to be less verbose. 😆

There’s no sanity check from has_instance needed here because how the instance creation process is designed. The instance isn’t supposed to work if a required map isn’t added in the database anyways. Also, map names can always be retrieved with instance_mapname if you have instance id stored or strnpcinfo like you mentioned. Map name retrieval from outside of the instance isn’t something we need. Instance should be isolated (with only instance_enter or warp commands sending people in). You should think about redesigning your script if you need something more complicated than this somehow 🙂

Share this post


Link to post
Share on other sites
  • 0

@Secrets  I'm just comparing hercules ones with rathena ones

45 minutes ago, Secrets said:

 The instance isn’t supposed to work if a required map isn’t added in the database anyways.
Map name retrieval from outside of the instance isn’t something we need...

hercules instancing can duplicate any maps ... so the checks not just on the database, but also on duplicated ones
see instance_attachmap / instance_detachmap

in other words, I could make this party go into map A, and other party instance into map B (as long as the map cell are similar)
remember hercules don't have instance_db.txt file to begin with

 

 

and for daniel ... I'm currently solving his problem in discord, I think for his problem, its better to teach 1 on 1

Edited by AnnieRuru
  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0

Hey guys,

You are all doing a great job!
The script commands are ok, we can use it, and Annie is helpping me a lot with some questions i used have ^_^
I think we don't have any problem, all doubts were solved =D
Thank you guys you are awesome 😉

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