I wrote the script. What's my mistake?

stivinov

New member
Messages
8
Points
0
Hello friends!
On the server, I would like to activate pvp mode at night! 
I wrote a small code that is below! Night comes, but pvp does not work = (

In the logs, the error does not show.
Explain to me please, what's my problem?

Thank you

Code:
-	script	DayNightPvP	-1,{

OnClock0000:
  announce "Morning! The world has become safer!",bc_all,0xEEEEEE;
  day;
  setbattleflag "pk_mode",0;
  atcommand "@reloadbattleconf";
  end;

OnClock0600:
  announce "Night! Outside the city it became dangerous!",bc_all,0xEEEEEE;
  night;
  setbattleflag "pk_mode",1;
  atcommand "@reloadbattleconf";
  end;
}
 
Last edited by a moderator:
if you reloadbattleconf, it will reset all your battleconfs to the values set in their files. so rynbef is correct you just remove the reloadbattleconf

 
pk mode is meant for something else
I don't think using pk mode as your idea will work

Code:
-	script	DayNightPvP	FAKE_NPC,{
OnInit:
	// Put all possible fields and dungeons here
	setarray .map$, "prt_fild00", "prt_fild01", "prt_fild02", "prt_fild03"; // lazy to put all

	.size = getarraysize(.map$);
	freeloop true;
	for ( .@i = 0; .@i < .size; ++.@i ) {
		setmapflag .map$[.@i], mf_pvp_nocalcrank;
		if ( gettime(GETTIME_HOUR) >= 20 || gettime(GETTIME_HOUR) < 8 )
			setmapflag .map$[.@i], mf_pvp;
	}
	// Overlap the original atcommand, both will run together
	bindatcmd "day", strnpcinfo(0)+"::OnClock0800";
	bindatcmd "night", strnpcinfo(0)+"::OnClock2000";
	end;
OnClock0800:
	announce "Morning! The world has become safer!", bc_all, C_WHITE;
	day;
	for ( .@i = 0; .@i < .size; ++.@i )
//		pvpoff .map$[.@i];
		removemapflag .map$[.@i], mf_pvp;
	end;
OnClock2000:
	announce "Night! Outside the city it became dangerous!", bc_all, C_WHITE;
	night;
	for ( .@i = 0; .@i < .size; ++.@i )
//		pvpon .map$[.@i];
		setmapflag .map$[.@i], mf_pvp;
	end;
}
EDIT2: it seems just setmapflag pvp works, don't need to use pvpon script command

EDIT: woot ... suddenly 2 new posts comes out ... let me test ...

Code:
-	script	DayNightPvP	-1,{
OnInit:
	bindatcmd "day", strnpcinfo(0)+"::OnClock0800";
	bindatcmd "night", strnpcinfo(0)+"::OnClock2000";
	end;
OnClock0800:
	announce "Morning! The world has become safer!", bc_all, C_WHITE;
	setbattleflag "pk_mode", 0;
	end;
OnClock2000:
	announce "Night! Outside the city it became dangerous!", bc_all, C_WHITE;
	setbattleflag "pk_mode", 1;
	end;
}
nope, doesn't work ... I set my pk_mode into 0, @_night doesn't let me kill other player
and when set pk_mode into 1, @_day also let me able to kill other player

PS: _day _night because someone really name night here ... if I type that will become mention that member

 
Last edited by a moderator:
Back
Top