Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. list NameList;
  2. list PosList;
  3. list HpList;
  4. key ActiveKey;
  5. integer On;
  6. integer Index;
  7. vector MovePos;
  8. float Action;
  9. integer Active;
  10. integer AttackPhase;
  11. list MagicList;
  12. integer ForOn;
  13. integer Counting;
  14. default
  15. {
  16.     state_entry()
  17.     {  
  18.         MagicList=[];
  19.         ForOn=0;
  20.        
  21.         llMoveToTarget(llGetPos(),10);
  22.         vector MovePos=llGetPos();
  23.         On=0;
  24.         ActiveKey=NULL_KEY;
  25.         NameList=[];
  26.         PosList=[];
  27.         HpList=[];
  28.         llListen(99,"","","");
  29.         llListen(30,"","","");
  30.         llListen(40,"Control","","");
  31.         llListen(10,"","","");
  32.         llListen(50,"Control","","");
  33.         llListen(70,"Control","","");
  34.         llListen(60,"Control","","");
  35.         llListen(80,"","","");
  36.         llListen(88,"","","");
  37.         llListen(86,"","","");
  38.         llSetTimerEvent(2);
  39.         llSetStatus(STATUS_PHYSICS|STATUS_ROTATE_X,TRUE);
  40.         llSetStatus(STATUS_ROTATE_Z|STATUS_ROTATE_Y,FALSE);
  41.         llSetText("",<0,0,0>,1);
  42.     }
  43.     on_rez(integer start){
  44.         llResetScript();
  45.     }
  46.    listen(integer chan,string name,key id,string message)
  47.     {  
  48.         integer i;
  49.  
  50.         if(chan==86){
  51.             if(message=="Recieved"){
  52.                 if(On==1){
  53.                     llOwnerSay("Testing2");
  54.                     list TestCount=llDeleteSubList(MagicList,llListFindList(MagicList,["Magic"]),llListFindList(MagicList,["Magic"]));          
  55.                     Counting =llGetListLength(TestCount);                 integer ForOn=0;
  56.                     llOwnerSay((string)llList2CSV(MagicList));
  57.                     llOwnerSay((string)Counting);
  58.                 for( i = 0; i < Counting; i++ ){
  59.                     if(Counting<=-1){ForOn=-1;}
  60.                    
  61.                     llSetText((string)Counting,<1,1,1>,1);
  62.                     llOwnerSay(llList2String(TestCount,Counting));
  63.                       llRezObject(llList2String(TestCount,Counting),llGetPos()+<0,0,3+Counting>,<0,0,0>,ZERO_ROTATION,1);
  64.                    
  65.                 }
  66.             }}
  67.         if(message=="Magic"){
  68.         if(On==1){
  69.             llOwnerSay("Testing");
  70.            
  71.                  list Fill=[];
  72.                  MagicList=[];
  73.                  integer MagicCount=llGetInventoryNumber(6);
  74.              for(;MagicCount>=0;MagicCount=MagicCount-1){
  75.                   list Tester=llParseString2List(llGetInventoryName(6,MagicCount),[":"],[]);
  76.                  
  77.                   if(llListFindList(Tester,["Magic Spell"])!=-1){
  78.                    Fill=Fill+llGetInventoryName(6,MagicCount);
  79.                 MagicList=Fill;
  80.                llRegionSay(80,"FireMagicList");
  81.                 list MagicListOut=MagicList+"Magic";
  82.              
  83.                 llRegionSay(86,llDumpList2String(MagicListOut,"|"));
  84.           //Channel
  85.             }}
  86.             //Message
  87.         }      
  88.           //On
  89.        
  90.      
  91.     }
  92.         //For
  93.          
  94.                
  95.     }        
  96.    
  97.              if(chan==88){
  98.            
  99.                 if(message=="Backing Off"){
  100.                 AttackPhase=0;
  101.                     }
  102.                 if(message=="Attack"){
  103.                 AttackPhase=1;}
  104.                  }
  105.         if(chan==99){
  106.                 if(name=="Control"){
  107.            Action=(float)message;
  108.                 }
  109.                      }
  110.          if(chan==30){if(message=="Reset"){
  111.             llResetScript();
  112.             }  
  113.                 }
  114.            
  115.           if(chan==80){if(On==1)if(Active==1){
  116.             if(message=="Look Over Here"){
  117.                  vector Targ=(vector)llList2String(llGetObjectDetails(id,[OBJECT_POS]),0);
  118.              llLookAt(Targ,1,.75);
  119.              llSleep(2);
  120.              llRezObject("Weapon",llGetPos()+<-.5,0,1>*llGetRot(),<0,0,10>*llGetLocalRot(),ZERO_ROTATION,1);
  121.         Action=Action-1;}
  122.        
  123.             if(message=="Look At Me"){
  124.            
  125.            vector Targ=(vector)llList2String(llGetObjectDetails(id,[OBJECT_POS]),0);
  126.              llLookAt(Targ,1,.75);
  127.              On=0;
  128.                   }}}
  129.         if(chan==10){
  130.              if(message=="Fire"){
  131.                  ActiveKey=id;
  132.                  Active=0;
  133.                 }}
  134.                
  135.         if(name=="Control"){
  136.               if(chan==40){
  137.                   NameList=llParseString2List(message,[","],[]);
  138.                   Index=llListFindList(NameList,[llKey2Name(llGetKey())]);
  139.                 }
  140.               if(chan==50){
  141.                   PosList=llParseString2List(message,["|"],[]);
  142.                   if(Index!=-1)
  143.                     {
  144.                         if(llVecDist(llGetPos(),(vector)llList2String(PosList,Index))>=.1){
  145.                         MovePos =<0,0,.05>+(vector)llList2String(PosList,Index);       llLookAt((<0,0,1>*llGetLocalRot())+MovePos,.5,.25);
  146.                         llTarget(MovePos,.001);
  147.                     }}
  148.                 }
  149.               if(chan==60){
  150.                  
  151.                   HpList=llParseString2List(message,[","],[]);
  152.                  
  153.                    if(Index!=-1){
  154.                        
  155.                       }}
  156.               if(chan==70){
  157.                   if(message=="Red On")
  158.                     {
  159.                         Active=0;
  160.                         On=0;
  161.                         AttackPhase=0;          
  162.                   }
  163.                   if(message=="Blue On")
  164.                      {
  165.                          Active=0;
  166.                         On=1;
  167.                         AttackPhase=0;
  168.                     }
  169.                        
  170.                 }
  171.              
  172.            
  173.                
  174.                  
  175.            
  176.              }
  177.  }
  178.     timer()
  179.     {
  180.          llSetText((string)On+"
  181.         "+llKey2Name(ActiveKey)+"
  182.         "+(string)AttackPhase,<1,1,1>,1);
  183.          
  184.          llSetObjectDesc("Hp:"+llList2String(HpList,Index)+"   Ap:"+(string)Action);
  185.         llRegionSay(44,"Init");
  186.         list Master =NameList+PosList+HpList;
  187.        // llSetText(llDumpList2String(Master,"~"),<1,1,1>,1);
  188.     }
  189.     touch_start(integer Count)
  190.     {
  191.         if( On==1){
  192.             llRegionSay(18,"Fire");
  193.             llRegionSay(10,"Fire");
  194.             Active=1;
  195.         }
  196.         if(On!=1){if(ActiveKey!=NULL_KEY){if(AttackPhase==1){
  197.             llSay(0,"Attack Check "+llKey2Name(ActiveKey));
  198.             list AttackStats = llParseString2List(llKey2Name(ActiveKey),[":"],[]);  
  199.              vector AttackPos =(vector)llList2String(llGetObjectDetails(ActiveKey,[OBJECT_POS]),0);
  200.              float AttackDist = (integer)llList2String(AttackStats,5);          
  201.             llSay(0,llList2CSV(AttackStats)+"
  202.            "+(string)AttackDist);
  203.    if(Action>=1){
  204.                  if(llVecDist(llGetPos(),AttackPos)<=AttackDist){                   llSay(0,llKey2Name(ActiveKey)+" is attacking "+llKey2Name(llGetKey()));
  205.                       llRegionSay(10,"Was Attacked");
  206.                       AttackPhase=0;
  207.             }}}}}
  208. }
  209.  
  210.     not_at_target()
  211.                 {
  212.                     llMoveToTarget(MovePos,1);
  213.                        
  214.             }
  215.            
  216.              at_target(integer tnum,vector Target,vector Piece)
  217.             {
  218.                
  219.                 llMoveToTarget(llGetPos(),20);
  220.                
  221.             }
  222. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement