Jump to content
  • 0

Requesting map effect script


Yonko

Question


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.04
  • Content Count:  789
  • Reputation:   50
  • Joined:  04/16/12
  • Last Seen:  

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!

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.04
  • Content Count:  789
  • Reputation:   50
  • Joined:  04/16/12
  • Last Seen:  

 

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.04
  • Content Count:  789
  • Reputation:   50
  • Joined:  04/16/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

strange it throws an infinity loop, there is a lot of free cell

add a freeloop(1);

OnInit:
	freeloop(1);
	while(1) {
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.04
  • Content Count:  789
  • Reputation:   50
  • Joined:  04/16/12
  • Last Seen:  

okay lemme try again, thank you for your patience =)

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