Jump to content
  • 0

Requesting map effect script


Question

Posted

Hi i would like to request a script on the map like this

let say on prt_fild01 after every 30 seconds a @effect of lightning bolt will shown on randomly on the map and if hits the player the player will die thanks!

6 answers to this question

Recommended Posts

Posted

try

prt_fild01,1,1,0	script	#dummy	111,2,2,{
end;
OnTouch:
	unitkill getcharid(3);
}
-	script	main_bolt	-1,{
OnInit:
	while(1) {
		do {
			.@x = rand(400);
			.@y = rand(400);
		}
		while( !checkcell( "prt_fild01",.@x,.@y,cell_chkpass ) );
		movenpc "#dummy",.@x,.@y;
		enablenpc "#dummy";
		specialeffect EF_LIGHTBOLT,AREA,"#dummy";
		sleep 1000;
		disablenpc "#dummy";
		sleep 30000;
	}
}
  • Upvote 1
Posted (edited)

 

try

prt_fild01,1,1,0	script	#dummy	111,2,2,{
end;
OnTouch:
	unitkill getcharid(3);
}
-	script	main_bolt	-1,{
OnInit:
	while(1) {
		do {
			.@x = rand(400);
			.@y = rand(400);
		}
		while( !checkcell( "prt_fild01",.@x,.@y,cell_chkpass ) );
		movenpc "#dummy",.@x,.@y;
		enablenpc "#dummy";
		specialeffect EF_LIGHTBOLT,AREA,"#dummy";
		sleep 1000;
		disablenpc "#dummy";
		sleep 30000;
	}
}

Thanks Capuche! Works 100% !

EDIT:

there's a problem when i get killed the lightning still fires up to the ground up to 20x after that i use @raise then the lightning strike stops.

Edited by Xii
Posted

hmm maybe using OnTouch is a bit buggy well, try

prt_fild01,1,1,0	script	#dummy_light	111,{
end;
OnAttach:
	addrid 1;
	getmapxy .@map_npc$,.@x_npc,.@y_npc,1;
	getmapxy .@map$,.@x,.@y,0;
	if ( distance( .@x_npc,.@y_npc,.@x,.@y ) < 2 )
		unitkill getcharid(3);
	end;
}

-	script	main_bolt	-1,{
OnInit:
	while(1) {
		do {
			.@x = rand(1,400);
			.@y = rand(1,400);
		}
		while( !checkcell( "prt_fild01",.@x,.@y,cell_chkpass ) );
		movenpc "#dummy_light",.@x,.@y;
		enablenpc "#dummy_light";
		specialeffect EF_LIGHTBOLT,AREA,"#dummy_light";// seems doesn't work with sprite -1
		disablenpc "#dummy_light";
		if ( getareausers( "prt_fild01",(.@x-1),(.@y-1),(.@x+1),(.@y+1) ) > 0 )
			donpcevent "#dummy_light::OnAttach";
		sleep 30000;
	}
}
  • Upvote 1
Posted (edited)

Seems the script works fine but it still stop sending lightning bolts and i pressumed an error occurs see the image for preferences

14c4lky.png

Edited by Xii

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...