Jump to content
  • 0

R> Dynamic Weather Prontera?


Roxess

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   3
  • Joined:  05/01/14
  • Last Seen:  

Hello there guys.

 

Someone can give me a dynamic weather npc for prontera?

 

That could be awesome and fancy for the server

 

Thanks for all your help guys :3

 

Roxess.

 

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

-	script	weather npc	-1,{ function ChangeWeather ; function CheckMap ; function CheckBound;
OnInit:
//==================================== *user setup* ===================================================
	setarray .maps$ , "prontera","morocc"; //place the maps you want the weather to be enabled here
	.mapcount = getarraysize(.maps$);
	setarray .weathers$ , "clouds","clouds2","fireworks","fog","leaves","sakura","snow";
	.weathercount = getarraysize(.weathers$);
	.delay = 1; //will change the weather every <.delay> minutes
//================================= *end of user setup*================================================
	bindatcmd "weather",strnpcinfo(0)+"::OnWeather",40;
	initnpctimer;
	end;

OnTimer60000:
	$WeatherTimer++;
	if ($WeatherTimer >= .delay) { $WeatherTimer = 0 ; ChangeWeather(); } //changing weather..
	end;

OnHour18:
	for (.@i = 0 ; .@i < .mapcount ; .@i++) setmapflag .maps$[.@i],mf_nightenabled;
	end;

OnHour08:
	for (.@i = 0 ; .@i < .mapcount ; .@i++) removemapflag .maps$[.@i],mf_nightenabled;
	end;

OnWeather:
	$WeatherTimer = 0;
	ChangeWeather();
	end;

function	ChangeWeather	{
	//change weather
	.@weather$ = getvariableofnpc(.weathers$[rand(getvariableofnpc(.weathercount,"weather npc"))],"weather npc");
	while (.@weather$ == getvariableofnpc(.prev_weather$,"weather npc")) .@weather$ = getvariableofnpc(.weathers$[rand(getvariableofnpc(.weathercount,"weather npc"))],"weather npc");
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++) {
		if (getvariableofnpc(.prev_weather$,"weather npc") != "") removemapflag getvariableofnpc(.maps$[.@i],"weather npc"),getd("mf_"+getvariableofnpc(.prev_weather$,"weather npc"));
		setmapflag getvariableofnpc(.maps$[.@i],"weather npc"),getd("mf_"+.@weather$);
	}
	set getvariableofnpc(.prev_weather$,"weather npc") , .@weather$;
	//reload screen for players not selling/in chatroom
	.@n = query_sql ("SELECT `name` FROM `char` WHERE `online` = 1",.@players$);
	for (.@i = 0 ; .@i < getarraysize(.@players$) ; .@i++) {
		if (attachrid(getcharid(3,.@players$[.@i]))) {
			getmapxy .@map$,.@x,.@y,0;
			if (CheckMap(.@map$) && CheckBound()) warp .@map$,.@x,.@y;
		}
	}
	return;
}

function	CheckMap	{
	getmapxy .@map$,.@x,.@y,0;
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++)
		if (.@map$ == getvariableofnpc(.maps$[.@i],"weather npc")) return 1;
	return 0;
}

function	CheckBound	{
	if (checkchatting(strcharinfo(0)) || checkvending(strcharinfo(0))) return 0;
	return 1;
}

}

Check out the user setup.

 

The weather will be changed on the maps in .maps$ array every <.delay> minutes.

I put all the weathers in the .weathers$ array but you can delete some if you want

 

night mode will be activated from 6pm to 8am but you can change those if you want (just change OnHour18 to OnHour19 for example)

 

players who are not vending or in a chatroom will be warped to their current location to reload their screens so that they can see the effects.

 

Tell me if you want to add/change anything

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

I tried out the weathers and not all of htem seem to be working. Plus, those which work are pretty specials so try this and if you still want to make use of weather tell me exactly what you's want to do.

It'll be a pleasure do make it happen  ;)

/*==================
| 3. Map Effects |
==================
---------------------------------------

*clouds
*clouds2
*fireworks
*fog
*leaves
*sakura
*snow

Displays a weather effect on a map.

---------------------------------------

*nightenabled

Displays night mode effects on a map. This is used on most outdoor maps.

---------------------------------------*/

-	script	weather npc	-1,{
OnInit:
	bindatcmd "weather",strnpcinfo(0)+"::OnTest";
	end;
OnTest:
	.@rid = getcharid(3,strcharinfo(0)) ; getmapxy .@map$,.@x,.@y,0;
	announce "night",0;
	setmapflag .@map$,mf_nightenabled;
	if (attachrid(.@rid)) { getmapxy .@map$,.@x,.@y,0 ; warp .@map$,.@x,.@y; }
	sleep 5000;
	removemapflag .@map$,mf_nightenabled;
	announce "clouds",0;
	setmapflag .@map$,mf_clouds;
	if (attachrid(.@rid)) { getmapxy .@map$,.@x,.@y,0 ; warp .@map$,.@x,.@y; }
	sleep 5000;
	removemapflag .@map$,mf_clouds;
	announce "clouds2",0;
	setmapflag .@map$,mf_clouds2;
	if (attachrid(.@rid)) { getmapxy .@map$,.@x,.@y,0 ; warp .@map$,.@x,.@y; }
	sleep 5000;
	removemapflag .@map$,mf_clouds2;
	announce "fireworks",0;
	setmapflag .@map$,mf_fireworks;
	if (attachrid(.@rid)) { getmapxy .@map$,.@x,.@y,0 ; warp .@map$,.@x,.@y; }
	sleep 5000;
	removemapflag .@map$,mf_fireworks;
	announce "fog",0;
	setmapflag .@map$,mf_fog;
	if (attachrid(.@rid)) { getmapxy .@map$,.@x,.@y,0 ; warp .@map$,.@x,.@y; }
	sleep 5000;
	removemapflag .@map$,mf_fog;
	announce "leaves",0;
	setmapflag .@map$,mf_leaves;
	if (attachrid(.@rid)) { getmapxy .@map$,.@x,.@y,0 ; warp .@map$,.@x,.@y; }
	sleep 5000;
	removemapflag .@map$,mf_leaves;
	announce "sakura",0;
	setmapflag .@map$,mf_sakura;
	if (attachrid(.@rid)) { getmapxy .@map$,.@x,.@y,0 ; warp .@map$,.@x,.@y; }
	sleep 5000;
	removemapflag .@map$,mf_sakura;
	announce "snow",0;
	setmapflag .@map$,mf_snow;
	if (attachrid(.@rid)) { getmapxy .@map$,.@x,.@y,0 ; warp .@map$,.@x,.@y; }
	sleep 5000;
	removemapflag .@map$,mf_snow;
	if (attachrid(.@rid)) { getmapxy .@map$,.@x,.@y,0 ; warp .@map$,.@x,.@y; }
}

load the script and type '@weather'.

It will show you all the weathers available

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   3
  • Joined:  05/01/14
  • Last Seen:  

omg that script is very awesome, that could be better if you add Night and Day mode too :3

 

omg i think im blind x'D

 

i got confuse cuz i was only see night mode, the npc is perfect. My bad

 

Thank you very much sir /ok


how i can repeat @weather unlimited time and for all users?

Edited by roxaskh11
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

It's just a test script xD this has nothing to do with any real script.

 

Just tell me when do you want to change the weather? Every hour, day, 30 minutes, on a special event?

Just so that I know if I'll be using timers or labels.

Also are all the weathers working fine for you?(because not for me^^) If not, which ones do you want to use?

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   3
  • Joined:  05/01/14
  • Last Seen:  

thanks for answering i want to change the weather every 30 minutes and all the weathers work very good for me :3 i want all of it thanks :D !!

 

pd: can you put all the weathers for the night and day? if it isn't much!! anyways whatever you gonna do will be helpful :3 !

 

Waiting for your final script :3 !!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   3
  • Joined:  05/01/14
  • Last Seen:  

Very much thanks again sir /ok  /kis2  !!

 

im so happy :D !!

 

thanks !!

 

Works perfect !!

Edited by Roxess
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

You're welcome  /no1

 

And I forgot to tell you any gm can instantly change the weather by calling the '@weather' command.

It will change the weather randomly and reset the timer.

 

Have fun^^

 

EDIT: I forgot to reset the npctimer after one minute, I fixed it in the previous post you can copy-paste it again

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

oh that's nice but you have to wait 3 months to see another weather, that's a bit long  :lol:

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

-	script	weather npc	-1,{ function ChangeWeather ; function CheckMap ; function CheckBound;
OnInit:
//==================================== *user setup* ===================================================
	setarray .maps$ , "prontera","morocc"; //place the maps you want the weather to be enabled here
	.mapcount = getarraysize(.maps$);
	setarray .weathers$ , "clouds","clouds2","fireworks","fog","leaves","sakura","snow";
	.weathercount = getarraysize(.weathers$);
	.delay = 1; //will change the weather every <.delay> minutes
//================================= *end of user setup*================================================
	bindatcmd "weather",strnpcinfo(0)+"::OnWeather",40;
	initnpctimer;
	end;

OnTimer60000:
	$WeatherTimer++;
	if ($WeatherTimer >= .delay) { $WeatherTimer = 0 ; ChangeWeather(); } //changing weather..
	end;

OnHour18:
	for (.@i = 0 ; .@i < .mapcount ; .@i++) setmapflag .maps$[.@i],mf_nightenabled;
	end;

OnHour08:
	for (.@i = 0 ; .@i < .mapcount ; .@i++) removemapflag .maps$[.@i],mf_nightenabled;
	end;

OnWeather:
	$WeatherTimer = 0;
	ChangeWeather();
	end;

function	ChangeWeather	{
	//change weather
	.@weather$ = getvariableofnpc(.weathers$[rand(getvariableofnpc(.weathercount,"weather npc"))],"weather npc");
	while (.@weather$ == getvariableofnpc(.prev_weather$,"weather npc")) .@weather$ = getvariableofnpc(.weathers$[rand(getvariableofnpc(.weathercount,"weather npc"))],"weather npc");
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++) {
		if (getvariableofnpc(.prev_weather$,"weather npc") != "") removemapflag getvariableofnpc(.maps$[.@i],"weather npc"),getd("mf_"+getvariableofnpc(.prev_weather$,"weather npc"));
		setmapflag getvariableofnpc(.maps$[.@i],"weather npc"),getd("mf_"+.@weather$);
	}
	set getvariableofnpc(.prev_weather$,"weather npc") , .@weather$;
	//reload screen for players not selling/in chatroom
	.@n = query_sql ("SELECT `name` FROM `char` WHERE `online` = 1",.@players$);
	for (.@i = 0 ; .@i < getarraysize(.@players$) ; .@i++) {
		if (attachrid(getcharid(3,.@players$[.@i]))) {
			getmapxy .@map$,.@x,.@y,0;
			if (CheckMap(.@map$) && CheckBound()) warp .@map$,.@x,.@y;
		}
	}
	return;
}

function	CheckMap	{
	getmapxy .@map$,.@x,.@y,0;
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++)
		if (.@map$ == getvariableofnpc(.maps$[.@i],"weather npc")) return 1;
	return 0;
}

function	CheckBound	{
	if (checkchatting(strcharinfo(0)) || checkvending(strcharinfo(0))) return 0;
	return 1;
}

}

Check out the user setup.

 

The weather will be changed on the maps in .maps$ array every <.delay> minutes.

I put all the weathers in the .weathers$ array but you can delete some if you want

 

night mode will be activated from 6pm to 8am but you can change those if you want (just change OnHour18 to OnHour19 for example)

 

players who are not vending or in a chatroom will be warped to their current location to reload their screens so that they can see the effects.

 

Tell me if you want to add/change anything

 

 

 

Could you add also, that the specific map will be announced on the 'Weather' e.g the prontera, so it will be announced.

Thank you for this.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

-	script	weather npc	-1,{ function ChangeWeather ; function CheckMap ; function CheckBound;
OnInit:
//==================================== *user setup* ===================================================
	setarray .maps$ , "prontera","morocc"; //place the maps you want the weather to be enabled here
	.mapcount = getarraysize(.maps$);
	setarray .weathers$ , "clouds","clouds2","fireworks","fog","leaves","sakura","snow";
	.weathercount = getarraysize(.weathers$);
	setarray .announces$ , "It's getting cloudy~~","It's getting cloudy~~","Woah! Fireworks!","That fog came out of nowhere..","Some leaves are falling.","Some pretty leaves are falling.","It's so snowy!";
	.delay = 1; //will change the weather every <.delay> minutes
//================================= *end of user setup*================================================
	bindatcmd "weather",strnpcinfo(0)+"::OnWeather",40;
	initnpctimer;
	end;

OnTimer60000:
	$WeatherTimer++;
	if ($WeatherTimer >= .delay) { $WeatherTimer = 0 ; ChangeWeather(); } //changing weather..
	end;

OnHour18:
	for (.@i = 0 ; .@i < .mapcount ; .@i++) setmapflag .maps$[.@i],mf_nightenabled;
	end;

OnHour08:
	for (.@i = 0 ; .@i < .mapcount ; .@i++) removemapflag .maps$[.@i],mf_nightenabled;
	end;

OnWeather:
	$WeatherTimer = 0;
	ChangeWeather();
	end;

function	ChangeWeather	{
	//change weather
	.@rand = rand(getvariableofnpc(.weathercount,"weather npc"));
	.@weather$ = getvariableofnpc(.weathers$[.@rand],"weather npc");
	while (.@weather$ == getvariableofnpc(.prev_weather$,"weather npc")) .@weather$ = getvariableofnpc(.weathers$[.@rand],"weather npc");
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++) {
		if (getvariableofnpc(.prev_weather$,"weather npc") != "") removemapflag getvariableofnpc(.maps$[.@i],"weather npc"),getd("mf_"+getvariableofnpc(.prev_weather$,"weather npc"));
		setmapflag getvariableofnpc(.maps$[.@i],"weather npc"),getd("mf_"+.@weather$);
	}
	set getvariableofnpc(.prev_weather$,"weather npc") , .@weather$;
	//reload screen for players not selling/in chatroom
	.@n = query_sql ("SELECT `name` FROM `char` WHERE `online` = 1",.@players$);
	for (.@i = 0 ; .@i < getarraysize(.@players$) ; .@i++) {
		if (attachrid(getcharid(3,.@players$[.@i]))) {
			getmapxy .@map$,.@x,.@y,0;
			if (CheckMap(.@map$) && CheckBound()) warp .@map$,.@x,.@y;
		}
	}
	sleep 1000;
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++) mapannounce getvariableofnpc(.maps$[.@i],"weather npc"),getvariableofnpc(.announces$[.@rand],"weather npc"),0,0x00ffff;
	return;
}

function	CheckMap	{
	getmapxy .@map$,.@x,.@y,0;
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++)
		if (.@map$ == getvariableofnpc(.maps$[.@i],"weather npc")) return 1;
	return 0;
}

function	CheckBound	{
	if (checkchatting(strcharinfo(0)) || checkvending(strcharinfo(0))) return 0;
	return 1;
}

}

please edit these because I'm not good at finding cool phrase xD

 

setarray .announces$ , "It's getting cloudy~~","It's getting cloudy~~","Woah! Fireworks!","That fog came out of nowhere..","Some leaves are falling.","Some pretty leaves are falling.","It's so snowy!";

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

-	script	weather npc	-1,{ function ChangeWeather ; function CheckMap ; function CheckBound;
OnInit:
//==================================== *user setup* ===================================================
	setarray .maps$ , "prontera","morocc"; //place the maps you want the weather to be enabled here
	.mapcount = getarraysize(.maps$);
	setarray .weathers$ , "clouds","clouds2","fireworks","fog","leaves","sakura","snow";
	.weathercount = getarraysize(.weathers$);
	setarray .announces$ , "It's getting cloudy~~","It's getting cloudy~~","Woah! Fireworks!","That fog came out of nowhere..","Some leaves are falling.","Some pretty leaves are falling.","It's so snowy!";
	.delay = 1; //will change the weather every <.delay> minutes
//================================= *end of user setup*================================================
	bindatcmd "weather",strnpcinfo(0)+"::OnWeather",40;
	initnpctimer;
	end;

OnTimer60000:
	$WeatherTimer++;
	if ($WeatherTimer >= .delay) { $WeatherTimer = 0 ; ChangeWeather(); } //changing weather..
	end;

OnHour18:
	for (.@i = 0 ; .@i < .mapcount ; .@i++) setmapflag .maps$[.@i],mf_nightenabled;
	end;

OnHour08:
	for (.@i = 0 ; .@i < .mapcount ; .@i++) removemapflag .maps$[.@i],mf_nightenabled;
	end;

OnWeather:
	$WeatherTimer = 0;
	ChangeWeather();
	end;

function	ChangeWeather	{
	//change weather
	.@rand = rand(getvariableofnpc(.weathercount,"weather npc"));
	.@weather$ = getvariableofnpc(.weathers$[.@rand],"weather npc");
	while (.@weather$ == getvariableofnpc(.prev_weather$,"weather npc")) .@weather$ = getvariableofnpc(.weathers$[.@rand],"weather npc");
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++) {
		if (getvariableofnpc(.prev_weather$,"weather npc") != "") removemapflag getvariableofnpc(.maps$[.@i],"weather npc"),getd("mf_"+getvariableofnpc(.prev_weather$,"weather npc"));
		setmapflag getvariableofnpc(.maps$[.@i],"weather npc"),getd("mf_"+.@weather$);
	}
	set getvariableofnpc(.prev_weather$,"weather npc") , .@weather$;
	//reload screen for players not selling/in chatroom
	.@n = query_sql ("SELECT `name` FROM `char` WHERE `online` = 1",.@players$);
	for (.@i = 0 ; .@i < getarraysize(.@players$) ; .@i++) {
		if (attachrid(getcharid(3,.@players$[.@i]))) {
			getmapxy .@map$,.@x,.@y,0;
			if (CheckMap(.@map$) && CheckBound()) warp .@map$,.@x,.@y;
		}
	}
	sleep 1000;
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++) mapannounce getvariableofnpc(.maps$[.@i],"weather npc"),getvariableofnpc(.announces$[.@rand],"weather npc"),0,0x00ffff;
	return;
}

function	CheckMap	{
	getmapxy .@map$,.@x,.@y,0;
	for (.@i = 0 ; .@i < getvariableofnpc(.mapcount,"weather npc") ; .@i++)
		if (.@map$ == getvariableofnpc(.maps$[.@i],"weather npc")) return 1;
	return 0;
}

function	CheckBound	{
	if (checkchatting(strcharinfo(0)) || checkvending(strcharinfo(0))) return 0;
	return 1;
}

}

please edit these because I'm not good at finding cool phrase xD

 

setarray .announces$ , "It's getting cloudy~~","It's getting cloudy~~","Woah! Fireworks!","That fog came out of nowhere..","Some leaves are falling.","Some pretty leaves are falling.","It's so snowy!";

 

 

Great! thanks man + 1 rep.

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