Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list NameList;
- list PosList;
- list HpList;
- key ActiveKey;
- integer On;
- integer Index;
- vector MovePos;
- float Action;
- integer Active;
- integer AttackPhase;
- list MagicList;
- integer ForOn;
- integer Counting;
- default
- {
- state_entry()
- {
- MagicList=[];
- ForOn=0;
- llMoveToTarget(llGetPos(),10);
- vector MovePos=llGetPos();
- On=0;
- ActiveKey=NULL_KEY;
- NameList=[];
- PosList=[];
- HpList=[];
- llListen(99,"","","");
- llListen(30,"","","");
- llListen(40,"Control","","");
- llListen(10,"","","");
- llListen(50,"Control","","");
- llListen(70,"Control","","");
- llListen(60,"Control","","");
- llListen(80,"","","");
- llListen(88,"","","");
- llListen(86,"","","");
- llSetTimerEvent(2);
- llSetStatus(STATUS_PHYSICS|STATUS_ROTATE_X,TRUE);
- llSetStatus(STATUS_ROTATE_Z|STATUS_ROTATE_Y,FALSE);
- llSetText("",<0,0,0>,1);
- }
- on_rez(integer start){
- llResetScript();
- }
- listen(integer chan,string name,key id,string message)
- {
- if(chan==86){
- if(message=="Recieved"){
- if(On==1){
- llOwnerSay("Testing2");
- list TestCount=llDeleteSubList(MagicList,llListFindList(MagicList,["Magic"]),llListFindList(MagicList,["Magic"]));
- Counting =llGetListLength(TestCount); integer ForOn=0;
- llOwnerSay((string)llList2CSV(MagicList));
- llOwnerSay((string)Counting);
- for(;Counting==-1;Counting=Counting-1){
- if(Counting<=-1){ForOn=-1;}
- llSetText((string)Counting,<1,1,1>,1);
- llOwnerSay(llList2String(TestCount,Counting));
- llRezObject(llList2String(TestCount,Counting),llGetPos()+<0,0,3+Counting>,<0,0,0>,ZERO_ROTATION,1);
- }
- }}
- if(message=="Magic"){
- if(On==1){
- llOwnerSay("Testing");
- list Fill=[];
- MagicList=[];
- integer MagicCount=llGetInventoryNumber(6);
- for(;MagicCount>=0;MagicCount=MagicCount-1){
- list Tester=llParseString2List(llGetInventoryName(6,MagicCount),[":"],[]);
- if(llListFindList(Tester,["Magic Spell"])!=-1){
- Fill=Fill+llGetInventoryName(6,MagicCount);
- MagicList=Fill;
- llRegionSay(80,"FireMagicList");
- list MagicListOut=MagicList+"Magic";
- llRegionSay(86,llDumpList2String(MagicListOut,"|"));
- //Channel
- }}
- //Message
- }
- //On
- }
- //For
- }
- if(chan==88){
- if(message=="Backing Off"){
- AttackPhase=0;
- }
- if(message=="Attack"){
- AttackPhase=1;}
- }
- if(chan==99){
- if(name=="Control"){
- Action=(float)message;
- }
- }
- if(chan==30){if(message=="Reset"){
- llResetScript();
- }
- }
- if(chan==80){if(On==1)if(Active==1){
- if(message=="Look Over Here"){
- vector Targ=(vector)llList2String(llGetObjectDetails(id,[OBJECT_POS]),0);
- llLookAt(Targ,1,.75);
- llSleep(2);
- llRezObject("Weapon",llGetPos()+<-.5,0,1>*llGetRot(),<0,0,10>*llGetLocalRot(),ZERO_ROTATION,1);
- Action=Action-1;}
- if(message=="Look At Me"){
- vector Targ=(vector)llList2String(llGetObjectDetails(id,[OBJECT_POS]),0);
- llLookAt(Targ,1,.75);
- On=0;
- }}}
- if(chan==10){
- if(message=="Fire"){
- ActiveKey=id;
- Active=0;
- }}
- if(name=="Control"){
- if(chan==40){
- NameList=llParseString2List(message,[","],[]);
- Index=llListFindList(NameList,[llKey2Name(llGetKey())]);
- }
- if(chan==50){
- PosList=llParseString2List(message,["|"],[]);
- if(Index!=-1)
- {
- if(llVecDist(llGetPos(),(vector)llList2String(PosList,Index))>=.1){
- MovePos =<0,0,.05>+(vector)llList2String(PosList,Index); llLookAt((<0,0,1>*llGetLocalRot())+MovePos,.5,.25);
- llTarget(MovePos,.001);
- }}
- }
- if(chan==60){
- HpList=llParseString2List(message,[","],[]);
- if(Index!=-1){
- }}
- if(chan==70){
- if(message=="Red On")
- {
- Active=0;
- On=0;
- AttackPhase=0;
- }
- if(message=="Blue On")
- {
- Active=0;
- On=1;
- AttackPhase=0;
- }
- }
- }
- }
- timer()
- {
- llSetText((string)On+"
- "+llKey2Name(ActiveKey)+"
- "+(string)AttackPhase,<1,1,1>,1);
- llSetObjectDesc("Hp:"+llList2String(HpList,Index)+" Ap:"+(string)Action);
- llRegionSay(44,"Init");
- list Master =NameList+PosList+HpList;
- // llSetText(llDumpList2String(Master,"~"),<1,1,1>,1);
- }
- touch_start(integer Count)
- {
- if( On==1){
- llRegionSay(18,"Fire");
- llRegionSay(10,"Fire");
- Active=1;
- }
- if(On!=1){if(ActiveKey!=NULL_KEY){if(AttackPhase==1){
- llSay(0,"Attack Check "+llKey2Name(ActiveKey));
- list AttackStats = llParseString2List(llKey2Name(ActiveKey),[":"],[]);
- vector AttackPos =(vector)llList2String(llGetObjectDetails(ActiveKey,[OBJECT_POS]),0);
- float AttackDist = (integer)llList2String(AttackStats,5);
- llSay(0,llList2CSV(AttackStats)+"
- "+(string)AttackDist);
- if(Action>=1){
- if(llVecDist(llGetPos(),AttackPos)<=AttackDist){ llSay(0,llKey2Name(ActiveKey)+" is attacking "+llKey2Name(llGetKey()));
- llRegionSay(10,"Was Attacked");
- AttackPhase=0;
- }}}}}
- }
- not_at_target()
- {
- llMoveToTarget(MovePos,1);
- }
- at_target(integer tnum,vector Target,vector Piece)
- {
- llMoveToTarget(llGetPos(),20);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement