Jump to content
  • 0

Simple script for pvp announcer


diehard

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  12/22/12
  • Last Seen:  

Announce if player killed the gm in prontera only. Thanks

Ops. Wrong section. Please move this topic to request script section. Thank you!

Edited by diehard
Link to comment
Share on other sites

15 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Announce if player killed the gm in prontera only. Thanks

Ops. Wrong section. Please move this topic to request script section. Thank you!

-    script    ghjkl    -1,{
OnPCDieEvent:
   if( getgmlevel() > 0 && killerrid ) {
       .@acc_id = getcharid(3);
       attachrid( killerrid );
       if( getgmlevel() > 0 ) end;
       attachrid( .@acc_id );
       announce "GM " + strcharinfo(0) + " had been kill by Player " + rid2name( killerrid ) + " !",0;
   }
   end;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  12/22/12
  • Last Seen:  

@Capuche

I'm using eAthena. How to fix this error

1e54pg.jpg

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

@Capuche

I'm using eAthena. How to fix this error

You have got several options :

1/ Change to rAthena

or

2/ Change .variable = 666; into set <variable>,<expression>;

-    script    ghjkl    -1,{
OnPCDieEvent:
   if( getgmlevel() > 0 && killerrid ) {
       set .@acc_id, getcharid(3);
       attachrid( killerrid );
       if( getgmlevel() > 0 ) end;
       attachrid( .@acc_id );
       announce "GM " + strcharinfo(0) + " had been kill by Player " + rid2name( killerrid ) + " !",0;
   }
   end;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  12/22/12
  • Last Seen:  

@Capuche

No errors. But not working.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

OnPCDieEvent is only use when you are killed by monsters

example like pvm event scripts

OnPCDieEvent:
announce strcharinfo(0)+" has been killed (by monster)",0;
warp "SavePoint",0,0;

something like this ...

otherwise, pvp script should always use OnPCKillEvent

-	script	kjdhfksdjhf	-1,{
OnPCKillEvent:
if ( !getgmlevel() && strcharinfo(3) == "prontera" ) {
	set .@name$, strcharinfo(0);
	attachrid killedrid;
	if ( getgmlevel() )
		announce strcharinfo(0) +" has been killed by "+ .@name$, 0;
}
end;
}

somehow Capuche script is working fine in my test server though

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

OnPCDieEvent is only use when you are killed by monsters

example like pvm event scripts

OnPCDieEvent:
announce strcharinfo(0)+" has been killed (by monster)",0;
warp "SavePoint",0,0;

something like this ...

otherwise, pvp script should always use OnPCKillEvent

OnPCDieEvent can be use when you are killed by player if the doc doesn't lie. It's not a bug. Just to point it out XD

OnPCDieEvent:

This special label triggers when a player dies. The variable 'killerrid' is

set to the ID of the killer.

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

maybe he use eAthena that doesn't have direct variable assignment system

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

OnPCDieEvent can be use when you are killed by player if the doc doesn't lie. It's not a bug. Just to point it out XD

I know, 5 years ago I also used OnPCDieEvent in pvp scripts

http://www.eathena.ws/board/index.php?showtopic=155874

later only I change it into OnPCKillEvent ( dunno where the topic went )

just to make it a habit

as you can see in your script, you attachrid twice, and I only did once XD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  161
  • Reputation:   31
  • Joined:  12/06/11
  • Last Seen:  

I wonder why it was never possible to give a parameter for getgmlevel

BUILDIN_FUNC(getgmlevel)
{
TBL_PC* sd;
   if( script_getnum(st,2) )
    sd = script_getnum(st,2);
   else
    sd = script_rid2sd(st);
if( sd == NULL )
	return 0;// no player attached, report source

script_pushint(st, pc_get_group_level(sd));

return 0;
}

Untested (+I'm not that great @src but I can't test it right now).

Edited by Jeroen
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

LOL !!

you wanna revolutionize the script commands ?

there are TONS of them that needed optional parameter

like checkweight, countitem, countitem2 <- getitem/delitem/getitem2/delitem2 has optional parameter for account ID

getvariableofpc <- we got getvariableofnpc, why not make another getvariableofpc which read pc variable XD

etc etc

BUILDIN_FUNC(getgmlevel) {
TBL_PC* sd = NULL;
if ( script_hasdata(st,2) ) {
	if ( data_isstring( script_getdata(st,2) ) )
		sd = map_nick2sd( script_getstr(st,2) );
	else
		sd = map_id2sd( script_getnum(st,2) );
} else
	sd = script_rid2sd(st);
if ( sd )
	script_pushint( st, pc_get_group_level(sd) );
else
	script_pushint( st, 0 );
return 0;
}

BUILDIN_DEF(getgmlevel,"?"),

tested with

-    script    kjdhfksdjhf    -1,{
OnPCKillEvent:
   if ( !getgmlevel() && getgmlevel(killedrid) && strcharinfo(3) == "prontera" )
       announce rid2name( killedrid ) +" has been killed by "+ strcharinfo(0), 0;
   end;
}

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  161
  • Reputation:   31
  • Joined:  12/06/11
  • Last Seen:  

Didn't really have time earlier this morning so It was kind of rushed and I forgot a few aspects :P.

Anyway starting exam.

Edited by Jeroen
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

as you can see in your script, you attachrid twice, and I only did once XD

-	script	ghjkl	-1,{
OnPCDieEvent:
if( getgmlevel() > 0 && killerrid ) {
	.@acc_id = getcharid(3);
	attachrid( killerrid );
	if( getgmlevel() < 1 )
		announce "GM " + rid2name( .@acc_id ) + " has been kill by Player " + strcharinfo(0) + " !",0;
}
end;
}

ahAH ! XD >>

Whatever you're right it's better to use OnPCKillEvent

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

getvariableofpc <- we got getvariableofnpc, why not make another getvariableofpc which read pc variable XD

I suggested this, but it got abandoned. D:

http://rathena.org/board/topic/65277-script-commands-for-offline-characters/

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

almost 10 hours wasted on this single topic

update this script

http://www.eathena.ws/board/index.php?s=&showtopic=177319&view=findpost&p=975591

setvar_0.2.txt


about setc\getc

I don't recommend to set/retrieve value from an offline char

because it needs to read the value from SQL table

its not thread safe, and needs memory allocations

I can try to code, but seems noob x.x

setc.getc_17101.diff

setc works great

but getc got problem

prontera,155,185,5	script	jdfhksdfjhksdj	100,{
setc #abcd$, "12345", 2000000;
//	setc @abcd$, "54321", 2000001;
//	set @abcd$, "";
dispbottom #abcd$;
//	dispbottom getc( @abcd$, 2000000 ) +"";
//	dispbottom getc( @abcd$, 2000001 );
dispbottom getc( #abcd$ ) +"";
//	dispbottom getcharid( 3, "AnnieRuru" ) +"";
end;
}

[Warning]: Found more arguments than necessary. unexpected arg type C_STR
[Debug]: Function: dispbottom
[Debug]: Source (NPC): jdfhksdfjhksdj at prontera (155,185)
[Error]: Memory manager: args of aFree 0x1071CD50 is overflowed pointer d:\rathena\src\map\script.c line 2944

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