Jump to content
  • 0

Turning a map into instance


Question

Posted (edited)

Can anyone make this map (1@cash) an instance for me? I'm trying to make something like Endless tower. I want more than one party to get in but I don't want them to meet inside or killing the same monster.

Edited by Seiro

4 answers to this question

Recommended Posts

Posted (edited)

Here's some sample code. You have to set the $Instance_Minparty variable and edit some other things, but you should get the idea.

 getpartymember(getcharid(1));
 if(!getcharid(1) || $@partymembercount < $Instance_Minparty){
  mes "Make or join a party with more than "+$Instance_Minparty+" member!";
  close;
 }
 if(instance_id(1)){
  if(has_instance("1@Cash") == ""){
mes "Your group is already registered at another instance.";
close;
  }
  mes "Your group is already registered.";
  mes "Select ^0000FFRe-Enter Instance^000000 in the main menu to enter.";
  close;
 }
 set .@instance, instance_create("My Instance", getcharid(1));
 instance_attachmap "1@Cash", .@instance;
 instance_set_timeout(3600,300,.@instance);
 instance_init .@instance;
 warp has_instance("1@Cash"),0,0;
 end;

Edited by michaelsoftman
Posted

Can I see the whole script? or is this yours and it's private?

I kinda don't get it, it registers the party but it only ends up saying "Your group is already registered at another instance." after.

Posted

It's my private script... I will share more of it with you though.

mes "What would you like to do?";
switch(select("Start Instance:Re-enter Instance:Quit")) {
Case 1:
 if(CT_Lasttime + $CT_Cooldown > gettimetick(2) && CT_Lasttime < gettimetick(2)) {
 set .@last,CT_Lasttime + $CT_Cooldown - gettimetick(2);
 set .@hours,.@last / 60 / 60;
 set .@minutes,.@last / 60 % 60;
 set .@seconds,.@last % 60;
 mes "Due to the cooldown limit,";
 mes "you cannot start the instance right";
 mes "now, "+.@hours+"hours "+.@minutes+"minutes "+.@seconds+"seconds";
 mes "left to start the next instance.";
 close;
 }
 getpartymember(getcharid(1));
 if(!getcharid(1) || $@partymembercount < $CT_Minparty){
  mes "Make or join a party with more than "+$CT_Minparty+" member!";
  close;
 }
 if(instance_id(1)){
  if(has_instance("1@cash") == ""){
   mes "Your group is already registered at another instance.";
   close;
  }
  mes "Your group is already registered.";
  mes "Select ^0000FFRe-Enter Instance^000000 in the main menu to enter.";
  close;
 }
 set .@instance, instance_create("Instance Test", getcharid(1));
 instance_attachmap "1@cashl", .@instance;
 instance_set_timeout(7200,300,.@instance);
 instance_init .@instance;
 set .@a$, has_instance("1@cash");
 warp has_instance("1@cash"),0,0;
 set CT_Lasttime,gettimetick(2) + $CT_Timelimit;
 end;
Case 2:
 if(!instance_id(1) || has_instance("1@val") == ""){
  mes "The Instance does not exist.";
  mes "Please confirm with your party leader whether the Instance";
  mes "has been destroyed or if the time given for entering has expired.";
  close;
 }
 instance_attach instance_id(1);
 warp has_instance("1@cash"),100,8;
 set CT_Lasttime,gettimetick(2) + $CT_Timelimit;
 end;
Case 3:
 close;
}

Posted (edited)
// callfunc( "instance__", "<instance name>", <alive timeout>, <idle timeout>, "<instance map 1>" {, <instance map 2>, <instance map 3> ... }  )
function    script    instance__    {
   if ( ( .@ins = instance_create( getarg(0), getcharid(1) ) ) < 0 )
       return .@ins;
   .@i = 3;
   while ( getarg( .@i, "" ) != "" ) {
       if ( instance_attachmap( getarg(.@i), .@ins ) == "" ) {
           instance_destroy .@ins;
           return -5;
       }
       .@i++;
   }
   if ( getarg(1) || getarg(2) )
       instance_set_timeout getarg(1), getarg(2), .@ins;
   instance_init .@ins;
   instance_attach .@ins;
   return .@ins;
}

prontera,156,185,5    script    Devil Square    100,{
   if ( !getcharid(1) ) {
       mes "you need a party to get in";
       close;
   }
   if ( instance_id(1) && getstrlen( has_instance("1@cash") ) ) {
       warp has_instance("1@cash"), 310,215;
       end;
   }
   if ( instance_id(1) ) {
       mes "your party is currently running an instance";
       close;
   }
   if ( callfunc( "instance__", "test", 0, 0, "1@cash" ) < 0 ) {
       mes "failed to create instance";
       close;
   }
   warp "1@cash", 310,215;
   donpcevent instance_npcname("test_instance")+"::Onstart";
   close;
}

1@cash,0,0,0    script    test_instance    -1,{
Onstart:
   monster "1@cash", 310,215, "--ja--", 1002, 1, instance_npcname("test_instance")+"::Onstart";
   end;
}

Edited by AnnieRuru
  • Upvote 1

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...