Jump to content
  • 0

Map checks using array variables


Question

Posted

So I'm trying to write a condition where if your character is not on one of these maps:

 

        // Town Definitions    
        setarray .@mapname$[0],"prontera","morocc","geffen","payon","alberta","izlude","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","niflheim","louyang","lunette","in_moc_16","jawaii","ayothaya","einbroch","lighthalzen","einbech","hugel","rachel","veins","moscovia","schenberg";  

 

 

you will be undisguised:

 

    OnPCLoadMapEvent:
        for(set .@i,0; .@i < getarraysize(.@mapname$); set .@i,.@i+1) {
            if( "+.@mapname$[.@i]+" == strcharinfo(3))
                set .@a,1;
            if(!.@a) {
                undisguise;
                end;
           }

 

 

As written, it's not quite confirming that you are not on the maps in the array. What am I doing wrong?

4 answers to this question

Recommended Posts

Posted

Yes, every single map needs the loadevent mapflag in order to trigger OnPCLoadMapEvent ... unless you did one of these source edits

1) when maps are loaded, loadevent mapflag is added to every map

2) change OnPCLoadMapEvent to trigger on all maps, even if they don't have the loadevent mapflag

It looks like (almost) all your maps in .@mapname$[] are already listed in trunk/conf/mapflag/town.txt right? Then you could just check mapflag#town.

-	script	undisguise_me	-1,{
OnPCLoadMapEvent:
	if (!getmapflag(strcharinfo(3), mf_town)) {
		undisguise;
	}
	end;
}
  • Upvote 1
Posted (edited)

try to change the 

 

 

if( "+.mapname$[.@i]+" == strcharinfo(3) )

 

to

 

if(strcharinfo(3) == .mapname$[.@i] )

and btw. did u add loadmapevent mapflag on your map's?

Edited by TrojanWorm
Posted

Does that even matter? I've used the OnPCLoadMapEvent label before on maps without the loadevent mapflag; what makes towns any different? In any case, I want the script to check if the map you loaded on was not in the array, so wouldn't that require every single map that isn't a town to have the loadevent mapflag?

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