Jump to content
  • 0

help - putting array


GM Takumirai

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

can i ask a question/help

- in god* dedicate npc script

i put this script


if( getd(".n_"+.@type+"_master_map$") == "guild_01" )
{
callsub OnEndd;
break;
}

- the npc disappear in map guild_01 and it works

now my problem is when i made it like this


if( getd(".n_"+.@type+"_master_map$") == ".@maps$" )
{
callsub OnEndd;
break;
}

setarray .@maps$,
"guild_vs1","0",
"guild_vs2","1",
"guild_vs3","2",
"guild_vs4","3",
"guild_vs5","4";

- there's no errors but the problem is the npc doesn't remove when i go in the said map

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

try something like this..

for( .@i = 0; .@i < getarraysize( .@map$ ) - 1; .@i++ )
   if( getd(".n_"+.@type+"_master_map$") == .@maps$[.@i] ){
       callsub onendd;
       break;
   }

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

That's, because your specifying a variable when it's an array. You need to also specify which slot in the array.

.@maps$[0]

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

Tnx emistry and ocean..

still not working


OnTimer1000:
{
set .@type,atoi(strnpcinfo(2));
for(;isloggedin(getd(".n_"+.@type+"_master"))
{
set .@type,atoi(strnpcinfo(2));
attachrid(getd(".n_"+.@type+"_master"));
getmapxy(getd(".n_"+.@type+"_master_map$"),getd(".n_"+.@type+"_master_x"),getd(".n_"+.@type+"_master_y"),0);
getmapxy(getd(".n_"+.@type+"_npc_map$"),getd(".n_"+.@type+"_npc_x"),getd(".n_"+.@type+"_npc_y"),1,strnpcinfo(0));
{
for( .@i = 0; .@i < getarraysize( .@map$ ) - 1; .@i++ )
if( getd(".n_"+.@type+"_master_map$") == .@maps$[.@i] ){
callsub onendd;
break;
}
if(maxhp/hp>=4)
{
percentheal 15,15;
specialeffect2 312;
}
if(getd(".n_"+.@type+"_tmp_time") == 0)
{
sc_start SC_BLESSING,60000,10;
specialeffect2 42;

sc_start SC_INCREASEAGI,60000,10;
specialeffect2 37;

sc_start SC_IMPOSITIO,60000,10;
specialeffect2 84;

sc_start SC_MAGNIFICAT,60000,10;
specialeffect2 76;

sc_start SC_GLORIA,60000,10;
specialeffect2 75;

sc_start SC_SUFFRAGIUM,60000,10;
specialeffect2 88;

sc_start SC_ASSUMPTIO,60000,10;
specialeffect2 375;
}
setd ".n_"+.@type+"_tmp_time",getd(".n_"+.@type+"_tmp_time")+1;
if( getd(".n_"+.@type+"_tmp_time") >= 60 )
setd ".n_"+.@type+"_tmp_time",0;
detachrid; 
if(!isloggedin(getd(".n_"+.@type+"_master")))
{
callsub OnEndd;
break;
}
if(distance(getd(".n_"+.@type+"_npc_x"),getd(".n_"+.@type+"_npc_y"),getd(".n_"+.@type+"_master_x"),getd(".n_"+.@type+"_master_y"))>=8||getd(".n_"+.@type+"_master_map$")!=getd(".n_"+.@type+"_npc_map$"))
unitwarp getd(".n_"+.@type+"_unit_id"),getd(".n_"+.@type+"_master_map$"),getd(".n_"+.@type+"_master_x"),getd(".n_"+.@type+"_master_y");
else
unitwalk getd(".n_"+.@type+"_unit_id"),getd(".n_"+.@type+"_master_x")+rand(-3,3),getd(".n_"+.@type+"_master_y")+rand(-3,3);
setd ".n_"+.@type+"_time",getd(".n_"+.@type+"_time")-1;
if( getd(".n_"+.@type+"_time") <= 0 )
{
callsub OnEndd;
break;
}
sleep2 1000;
}
}
callsub OnEndd;
end;
OnInit:
setd ".n_"+atoi(strnpcinfo(2))+"_unit_id",getnpcid(0);
set .amount,.amount+1;
setarray .@maps$,
"guild_vs1","0",
"guild_vs2","1",
"guild_vs3","2",
"guild_vs4","3",
"guild_vs5","4",
"06guild_01","5",
"06guild_02","6";
end;
}
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Change .@map$ to .map$.

Edit: And also remove the "- 1" in the for() condition.

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