Advertisement
Guest User

Untitled

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