Jump to content
  • 0
Sign in to follow this  
stivinov

I wrote the script. What's my mistake?

Question

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

-	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;
}

 

 

Edited by stivinov

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

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

-	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

Edited by AnnieRuru

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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