Yonko Posted July 1, 2014 Posted July 1, 2014 Hi i would like to request a script on the map like thislet 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! Quote
Capuche Posted July 3, 2014 Posted July 3, 2014 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; } } 1 Quote
Capuche Posted July 3, 2014 Posted July 3, 2014 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; } } 1 Quote
Yonko Posted July 3, 2014 Author Posted July 3, 2014 (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 July 3, 2014 by Xii Quote
Yonko Posted July 3, 2014 Author Posted July 3, 2014 (edited) Seems the script works fine but it still stop sending lightning bolts and i pressumed an error occurs see the image for preferences Edited July 3, 2014 by Xii Quote
Capuche Posted July 3, 2014 Posted July 3, 2014 strange it throws an infinity loop, there is a lot of free cell add a freeloop(1); OnInit: freeloop(1); while(1) { Quote
Yonko Posted July 3, 2014 Author Posted July 3, 2014 okay lemme try again, thank you for your patience =) Quote
Question
Yonko
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.