Jump to content

Angelmelody

Members
  • Content Count

    772
  • Joined

  • Last visited

  • Days Won

    23

Posts posted by Angelmelody


  1. not sure, but you can try....
    .
    @amount = query_sql ("SELECT ID, (weight/10), attack, defence, slots, equip_level FROM item_db WHERE name_japanese = '"+ escape_sql(.@itemname$) +"'", @iid, .@weight$, .@attack, .@defence, .@slots, .@elvl);

    mes "Weight: "+.@weight$; //--> maybe it can show float

     


  2. you don't need freeloop if you have used sleep2 inside the while loop and sleep2 can check if the invoked player was

    online or not ,and player should be checked

            while( slppe2(200) && .@currentMap$ == .@onMap$ ) {            for( .@i = 1; .@i <= 20; .@i++ ) {                for( .@j = 0; .@j < getarraysize( .restrictedItemIds ); .@j++ ) {                    if ( getequipid( .@i ) == .restrictedItemIds[ .@j ] ) {                        unequip( .@i );			dispbottom( "Equipment " + getitemname( .restrictedItemIds[ .@j ] ) + " is not permitted on map " + .@onMap$ + ". It has been stripped." );					}                }			}            getmapxy( .@currentMap$, .@x, .@y, 0 );                    }

  3. dunno if these mapflags work for mob unit?

     

    map_zone_db.conf

    mapflags: (

    "weapon_damage_rate 60",

    "magic_damage_rate 60",

    "misc_damage_rate 60",

    "long_damage_rate 70",

    "short_damage_rate 80",

    )


  4. will you please send me a link in which i can learn how to make an instance? Please

    example:

     

    prontera,154,175,5    script    testtestest    1002,{    set .@id,instance_create("prt dup02",0,IOT_NONE);    instance_attachmap("prontera", .@id,1,"prontera02");    instance_init .@id;    warp "prontera02",154,166;}

  5.  

    to use  global permanent variables($prefix) instead of npc variables(. prefix)

    No reason to use $global variables, just add OnInit label with defaulting those values.

    the only reason is those variables will be change by gm and not every gm can modify that script


  6.  

     

     

    use this script command

    http://herc.ws/board/topic/4593-getmemberaid-checkmes/

     

    then

     

    -	script	test777	-1,{OnPCLoadMapEvent:    if(strcharinfo(3) =="event_wroom" && getmapusers("event_wroom") >= 10 && !$@gamerunning ) {        $@gamerunning = 1; //--->when the event end , remember to set this varaible to 0;        mapannounce "event_wroom", "Event is about to start in 3 seconds.",0;        sleep2 1000;        mapannounce "event_wroom", "3",0;        sleep2 1000;        mapannounce "event_wroom", "2",0;        sleep2 1000;        mapannounce "event_wroom", "1",0;        sleep2 1000;        mapannounce "event_wroom", "Let's get it on!",0;	getmemberaid ALL_SAMEMAP, "event_wroom";        freeloop(1);        for( .@i = 0; .@i < $@onlinecount; .@i++ ) {            if( attachrid($@onlineaid[.@i]) && strcharinfo(3) == "event_wroom" && checkvending() ) {                atcommand "@kick "+strcharinfo(0);            }        }        freeloop(0);	$@onlinecount = 0;	deletearray $@onlineaid;        donpcevent "event_quest::OnStart";    } end;OnInit: setmapflag "event_wroom", mf_loadevent;}

     

    already tested , it was working fine for me

    @@Angelmelody Thank you for this. anyway I just tested it but it still doesn't kick vendors :/ do you think vendors on auto trade mode cannot be kicked using an npc script?

     

     

    I tried this script and clicked the npc.. It announces the char name of the vendors on the map but doesn't kick them..

    event_wroom,34,157,4	script	kickertest	100,{	getmemberaid ALL_SAMEMAP, "event_wroom";        freeloop(1);        for( .@i = 0; .@i < $@onlinecount; .@i++ ) {            if( attachrid($@onlineaid[.@i]) && strcharinfo(3) == "event_wroom" && checkvending() ) {                atcommand "@kick "+strcharinfo(0);		mapannounce "event_wroom", strcharinfo(0),0;            }        }        freeloop(0);	$@onlinecount = 0;	deletearray $@onlineaid;	end;}

    try 'detachrid' then kick the 'rid2name( $@onlineaid[.@i])' , I think it should work on @AT state vendors

    event_wroom,34,157,4	script	kickertest	100,{	getmemberaid ALL_SAMEMAP, "event_wroom";        freeloop(1);        for( .@i = 0; .@i < $@onlinecount; .@i++ ) {            if( attachrid($@onlineaid[.@i]) && strcharinfo(3) == "event_wroom" && checkvending() ) {		mapannounce "event_wroom", rid2name( $@onlineaid[.@i]),0;		detachrid;                atcommand "@kick "+rid2name( $@onlineaid[.@i]);            }        }        freeloop(0);	$@onlinecount = 0;	deletearray $@onlineaid;	end;}

  7. I will try it, by the way thanks @@Angelmelody...

    Forgot to say, the appearance of head gear will dispear when you relogin,coz your headgear appearance will load costume appearance again,so you have to make your non-appearance costume to show normal headgear.

    OnEquipScript: <" callfunc("test123", 1024); ">
    function	script	test123	{		if(!set(.@pos, getarg(0,0))) return;	if(.@pos&(1024|2048|4096)) {		if(.@pos&1024) {			.@cp = EQI_HEAD_TOP;			.@lp = LOOK_HEAD_TOP;		} else if ( !(.@pos&1024) && .@pos&2048) {			.@cp = EQI_HEAD_MID;			.@lp = LOOK_HEAD_MID;		} else if (!(.@pos&1024) && !(.@pos&2048) && .@pos&4096) {			.@cp = EQI_HEAD_LOW;			.@lp = LOOK_HEAD_BOTTOM;		}		.@rlook = getiteminfo(getequipid(.@cp),11);		changelook .@lp, .@rlook;	}}

  8.  

    use this script command

    http://herc.ws/board/topic/4593-getmemberaid-checkmes/

     

    then

     

    -	script	test777	-1,{OnPCLoadMapEvent:    if(strcharinfo(3) =="event_wroom" && getmapusers("event_wroom") >= 10 && !$@gamerunning ) {        $@gamerunning = 1; //--->when the event end , remember to set this varaible to 0;        mapannounce "event_wroom", "Event is about to start in 3 seconds.",0;        sleep2 1000;        mapannounce "event_wroom", "3",0;        sleep2 1000;        mapannounce "event_wroom", "2",0;        sleep2 1000;        mapannounce "event_wroom", "1",0;        sleep2 1000;        mapannounce "event_wroom", "Let's get it on!",0;	getmemberaid ALL_SAMEMAP, "event_wroom";        freeloop(1);        for( .@i = 0; .@i < $@onlinecount; .@i++ ) {            if( attachrid($@onlineaid[.@i]) && strcharinfo(3) == "event_wroom" && checkvending() ) {                atcommand "@kick "+strcharinfo(0);            }        }        freeloop(0);	$@onlinecount = 0;	deletearray $@onlineaid;        donpcevent "event_quest::OnStart";    } end;OnInit: setmapflag "event_wroom", mf_loadevent;}

     

    already tested , it was working fine for me


  9. I did convert by hand but not test .... good luck :)
     

    Index: chat.c===================================================================--- chat.c	(revision 14682)+++ chat.c	(working copy)@@ -377,3 +377,17 @@  	return 0; }++/// Kicks a user from the chat room.+int chat_npckickchat(struct chat_data* cd, const char* kickusername)+{+	int i;+	nullpo_ret(cd);++	ARR_FIND( 0, cd->users, i, strncmp(cd->usersd[i]->status.name, kickusername, NAME_LENGTH) == 0 );+	if( i == cd->users )+		return -1;++	chat->leave(cd->usersd[i],1);+	return 0;+} No newline at end of fileIndex: chat.h===================================================================--- chat.h	(revision 14682)+++ chat.h	(working copy)@@ -36,4 +36,5 @@ int chat_disableevent(struct chat_data* cd); int chat->npc_kick_all(struct chat_data* cd); +int chat_npckickchat(struct chat_data* cd, const char* kickusername); #endif /* _CHAT_H_ */Index: script.c===================================================================--- script.c	(revision 14682)+++ script.c	(working copy)@@ -3461,6 +3461,10 @@ 		} 	} +	+	++ 	if(st->sleep.tick > 0) { 		//Restore previous script 		script->detach_state(st, false);@@ -9300,6 +9304,51 @@ 	return 0; } +/// Kick the specified player from the waiting room of the target npc.+///+/// kickwaitingroomall "<npc_name>", <char_name>;+BUILDIN(waitingroomkick)+{+	struct npc_data* nd;+	struct chat_data* cd;+	const char* char_name;++	nd = npc->name2id(script_getstr(st,2));+	char_name = script_getstr(st,3);++	if( nd != NULL && (cd=(struct chat_data *)map->id2bl(nd->chat_id)) != NULL )+		chat_npckickchat(cd, char_name);+	return 0;+}+++/// Get Users in waiting room and stores gids in .@waitingroom_users[]+/// Num users stored in .@waitingroom_usercount+///+/// getwaitingroomusers "<npc_name>";+BUILDIN(getwaitingroomusers)+{+	struct npc_data* nd;+	struct chat_data* cd;++	int i, j=0;++	if( script_hasdata(st,2) )+		nd = npc->name2id(script_getstr(st,2));+	else+		nd = (struct npc_data *)map->id2bl(st->oid);++	if( nd != NULL && (cd=(struct chat_data *)map->id2bl(nd->chat_id)) != NULL ) {+		for(i = 0; i < cd->users; ++i) {+			script->setd_sub(st, NULL, ".@waitingroom_users", j, (void *)cd->usersd[i]->status.account_id, NULL);+			j++;+		}++		script->setd_sub(st, NULL, ".@waitingroom_usercount", 0, (void *)j, NULL);+	}+	return 0;+}+ /// Enables the waiting room event of the current or target npc. /// /// enablewaitingroomevent "<npc_name>";@@ -14254,6 +14303,28 @@ 	return 0; } +BUILDIN(getbgmembers)+{+	struct battleground_data *bg = NULL;+	struct map_session_data *sd;+	int bg_id, i, j=0;++	bg_id = script_getnum(st,2);+	if( (bg = bg->team_search(bg_id)) == NULL) {+		script_pushint(st,0);+		return 0;+	}+	for( i = 0; i < MAX_BG_MEMBERS; i++ ) {+		if( (sd = bg->members[i].sd) == NULL )+			continue;+		script->setd_sub(st, NULL, ".@bg_members", j, (void *)sd->status.account_id, NULL);+		j++;+	}+	script->setd_sub(st, NULL, ".@bg_membercount", 0, (void *)j, NULL);++	return 0;+}+ BUILDIN(bg_updatescore) { 	const char *str;@@ -14924,6 +14995,8 @@ 	BUILDIN_DEF(waitingroom,"si??"), 	BUILDIN_DEF(delwaitingroom,"?"), 	BUILDIN_DEF2(waitingroomkickall,"kickwaitingroomall","?"),+	BUILDIN_DEF(waitingroomkick,"ss"),+	BUILDIN_DEF(getwaitingroomusers, "?"), 	BUILDIN_DEF(enablewaitingroomevent,"?"), 	BUILDIN_DEF(disablewaitingroomevent,"?"), 	BUILDIN_DEF2(enablewaitingroomevent,"enablearena",""),		// Added by RoVeRT@@ -15134,7 +15207,7 @@ 	BUILDIN_DEF(bg_get_data,"ii"), 	BUILDIN_DEF(bg_getareausers,"isiiii"), 	BUILDIN_DEF(bg_updatescore,"sii"),-+	BUILDIN_DEF(getbgmembers, "i"), 	// Instancing 	BUILDIN_DEF(instance->create,"si"), 	BUILDIN_DEF(instance->destroy,"?"),

     


  10.  

     

     

     

     

     

     

    its .@account_ids[.@i]  not .@char_ids[.@i]

    I've modified it.
    changed this part -> setd_sub(st, NULL, ".@account_ids", *users, (void *)__64BPRTSIZE(sd->status.account_id), NULL);
    to this one -> setd_sub(st, NULL, ".@char_ids", *users, (void *)__64BPRTSIZE(sd->status.char_id), NULL);
     
    and extracting the char id's works successfully. the problem is with the script only.

     

    script->setd_sub(st, NULL, ".@char_ids", *users, (void *)h64BPTRSIZE(sd->status.char_id), NULL);

     

    Thanks for this.. But it still doesn't kick the vendors :/
    Would you mind to check the script itself? Coz I have a hunch that it's actually because of the script..

     

    I can't understand the logic of your script , why did you need to kick all vendors on that event map?
    why not just set mapflag novending to that map?

     

    I have my own reasons for the vendors.. The event can't run unless there are 10 players participating.. but during night time, there are less players who want to play the event.
    That's why I they can vend inside the event map for it to start.. I also don't want to use timer for it.. Right now the only problem im facing here is the script wont kick the vendors for some reason.
    but im pretty sure that it extracts their char ids.

     


    As I remembered, the rid2name only support player's account id not char id,
    you should change back to account id
    script->setd_sub(st, NULL, ".@account_ids", *users, (void *)h64BPTRSIZE(sd->status.account_id), NULL);

     

    and
     

    OnPCLoadMapEvent:    if(strcharinfo(3)!="event_wroom") end;    if( getmapusers("event_wroom") >= 10 && !$@gamerunning ) {        $@gamerunning = 1; //--->when the event end ,  remember to set this varaible to 0;        mapannounce "event_wroom", "Event is about to start in 3 seconds.",0;        sleep2 1000;        mapannounce "event_wroom", "3",0;        sleep2 1000;        mapannounce "event_wroom", "2",0;        sleep2 1000;        mapannounce "event_wroom", "1",0;        sleep2 1000;        mapannounce "event_wroom", "Let's get it on!",0;        .@len = getareausersid("event_wroom",1,1,500,500);        freeloop(1);        for( .@i = 0; .@i < .@len; .@i++ ) {            if( attachrid(.@account_ids[.@i]) && checkvending() ) {                atcommand "@kick "+strcharinfo(0);            }        }        freeloop(0);        donpcevent "event_quest::OnStart";    }    end;

  11.  

     

     

     

     

     

    its .@account_ids[.@i]  not .@char_ids[.@i]

    I've modified it.

    changed this part -> setd_sub(st, NULL, ".@account_ids", *users, (void *)__64BPRTSIZE(sd->status.account_id), NULL);

    to this one -> setd_sub(st, NULL, ".@char_ids", *users, (void *)__64BPRTSIZE(sd->status.char_id), NULL);

     

    and extracting the char id's works successfully. the problem is with the script only.

     

     

    script->setd_sub(st, NULL, ".@char_ids", *users, (void *)h64BPTRSIZE(sd->status.char_id), NULL);

     

     

    Thanks for this.. But it still doesn't kick the vendors :/

    Would you mind to check the script itself? Coz I have a hunch that it's actually because of the script..

     

     

    I can't understand the logic of your script , why did you need to kick all vendors on that event map?

    why not just set mapflag novending to that map?


  12.  

    its .@account_ids[.@i]  not .@char_ids[.@i]

    I've modified it.

    changed this part -> setd_sub(st, NULL, ".@account_ids", *users, (void *)__64BPRTSIZE(sd->status.account_id), NULL);

    to this one -> setd_sub(st, NULL, ".@char_ids", *users, (void *)__64BPRTSIZE(sd->status.char_id), NULL);

     

    and extracting the char id's works successfully. the problem is with the script only.

     

    script->setd_sub(st, NULL, ".@char_ids", *users, (void *)h64BPTRSIZE(sd->status.char_id), NULL);


  13.  

    I think you need a new custom event i.e. OnEquipEvent for equip action triggering then calculate pc  again it will update the normal head gear view

     

    unfortunate me then i didn't understand how to do it, can you help me with that :blush:,

     

    TBH

    Litro

     

    -	script	test456	-1,{OnEquipEvent:	if (@eqpos <= 0) end;	if(@eqpos&(1024|2048|4096)) {		if(@eqpos&1024) {			.@cp = EQI_HEAD_TOP;			.@lp = LOOK_HEAD_TOP;		} else if ( !(@eqpos&1024) && @eqpos&2048) {			.@cp = EQI_HEAD_MID;			.@lp = LOOK_HEAD_MID;		} else if (!(@eqpos&1024) && !(@eqpos&2048) && @eqpos&4096) {			.@cp = EQI_HEAD_LOW;			.@lp = LOOK_HEAD_BOTTOM;		}		.@rlook = getiteminfo(getequipid(.@cp),11);		changelook .@lp, .@rlook;	} else if (@eqpos&(256|512|1)) {		if(@eqpos&256) {			.@cp = EQI_HEAD_TOP;			.@lp = LOOK_HEAD_TOP;		} else if ( !(@eqpos&256) && @eqpos&512) {			.@cp = EQI_HEAD_MID;			.@lp = LOOK_HEAD_MID;		} else if (!(@eqpos&256) && !(@eqpos&512) && @eqpos&1) {			.@cp = EQI_HEAD_LOW;			.@lp = LOOK_HEAD_BOTTOM;		}		.@rlook = getiteminfo(getequipid(.@cp),11);		changelook .@lp, .@rlook;	}	@eqpos = 0;	end;OnUnEquipEvent:	if (@uneqpos <= 0) end;	if (@uneqpos&(256|512|1)) {		if(@uneqpos&256) {			.@cp = EQI_HEAD_TOP;			.@lp = LOOK_HEAD_TOP;		} else if ( !(@uneqpos&256) && @uneqpos&512) {			.@cp = EQI_HEAD_MID;			.@lp = LOOK_HEAD_MID;		} else if (!(@uneqpos&256) && !(@uneqpos&512) && @uneqpos&1) {			.@cp = EQI_HEAD_LOW;			.@lp = LOOK_HEAD_BOTTOM;		}		.@rlook = getiteminfo(getequipid(.@cp),11);		changelook .@lp,.@rlook;	}	@uneqpos = 0;	end;}

     

    test456.patch

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.