Page 1 of 1

anti resskill code

Posted: Thu Jul 10, 2008 10:24 am
by westrupp

Code: Select all

	var resskill := GetObjProperty(ghost, "resskill");
	if (killer == resskill)
		SetObjProperty( ghost, "killedtimes", 1);
	endif
	var killedtimes := getobjproperty (ghost,"killedtimes");
	if (killedtimes == 1)
		SetObjProperty( ghost, "killedtimes", 2);
	endif
	if (killedtimes == 2)
		SetObjProperty( ghost, "killedtimes", 3);
	endif
	if (killedtimes == 3)
		SetObjProperty( ghost, "killedtimes", 4);
	endif
	if (killedtimes == 4)
		MoveCharacterToLocation( killer, 5304, 1184, 0, 0);
		SendSysMessage( killer, "You have been jailed");
	endif
dont work...i think i dont have correct value for killer

Re: anti resskill code

Posted: Thu Jul 10, 2008 11:31 am
by Luth

Code: Select all

	// resskill should be the serial of the last person to kill this character
	var resskill := GetObjProperty(ghost, "resskill");
	if (killer.serial != resskill)
		SetObjProperty( ghost, "resskill", killer.serial);
		SetObjProperty( ghost, "killedtimes", 1);
		return;
	endif

	var killedtimes := CInt(getobjproperty (ghost,"killedtimes"));
	if (killedtimes < 4)
		SetObjProperty( ghost, "killedtimes", killedtimes + 1);
	else
		MoveCharacterToLocation( killer, 5304, 1184, 0, 0);
		SendSysMessage( killer, "You have been jailed");
	endif
This is a cleaner version of your script. I made a few assumptions, but it may fix your problem. :) Here's hoping.

ReadGameClock

Posted: Sat Jul 19, 2008 8:54 am
by westrupp

Code: Select all


	var acc := playr.acct;

	var penultimopk := GetObjProperty (ghost,"ultimopk"); 
	SetObjProperty( ghost, "penultimopk", penultimopk);
	SetObjProperty( ghost, "ultimopk", plyr.name);

	ReadConfigFile("::npcdesc");
    	FindConfigElem(conf2, "plyr.npctemplate");
	if (plyr.npctemplate)
		SetObjProperty( ghost, "killedtimes", 0);
		EraseObjProperty( ghost, "ultimopk" );
	endif

	
	var killedtimes := CInt(getobjproperty (ghost,"killedtimes")); 
   	if (killedtimes > 4)
       		MoveCharacterToLocation( plyr , 5304, 1184, 0, 0); 
		              acc.setprop("Release", (ReadGameClock() + 345600)); // 4 Days
      		SendSysMessage( plyr , "Jailed by Anti-Resskill System.");
		              SetObjProperty( ghost, "killedtimes", 0); 
   	endif 

	var resskill  := GetObjProperty (ghost,"ultimopk");
	var resskill2 := GetObjProperty (ghost,"penultimopk"); 
	if (resskill != resskill2) 
      		SetObjProperty( ghost, "killedtimes", 0); 
   	endif
 
   	if ((resskill == resskill2) and (killedtimes < 5))
      		SetObjProperty( ghost, "killedtimes", killedtimes + 1); 
	endif