| 12-01-2007, 01:59 AM | #1 |
JASS:function InitTrig_IndieSummon takes nothing returns nothing endfunction //##Start## //************************************************************************************************** //* //* IndieSummons (header functions) //* ¯¯¯¯¯¯¯¯¯¯¯¯ //* To implement these functions, you must select the contents of this trigger starting //* with the //##Start## and finishing with the //##End##, and copy that TO YOUR MAP's //* CUSTOM SCRIPT SECTION, (it is at the top of the trigger list in the trigger editor) //* //* DON'T JUST COPY THE TRIGGER; copy this to the custom script section //* //* AFTER copying this function to custom script section, copy the next trigger to your map //* //************************************************************************************************** //================================================================================================= // // [url]http://www.wc3jass.com[/url] : The place with tons of JASS scripts // //================================================================================================= function IndieSummon_SetMaster takes unit summon, unit master returns nothing local unit a=bj_ghoul[0] local string k=GetAttachmentTable(summon) if (HaveStoredInteger(CSCache(),"[IndieSummons]",k)) then call SetTableObject("[IndieSummons]",k,master) else call SetTableObject("[IndieSummons]",k,master) set bj_ghoul[0]=summon call ExecuteFunc("IndieSummon_loop") set bj_ghoul[0]=a endif set a=null endfunction function IndieSummon_GetMaster takes unit summon returns unit return GetStoredInteger(CSCache(),"[IndieSummons]",GetAttachmentTable(summon)) return null endfunction function IndieSummon_StopAI takes unit summon returns nothing call FlushStoredInteger(CSCache(),"[IndieSummons]",GetAttachmentTable(summon)) endfunction //##End##[/code] [code]//************************************************************************************************** //* //* Independant Summons (Code + config) //* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ //* You just need to copy this trigger, notice that these functions do nothing without the other //* part which has the header functions and you'll also need to call them. //* //************************************************************************************************** //================================================================================================== // Independant Summons Configuration: // constant function IndieSummon_maxdelay takes nothing returns real return 2.5 //* The max delay betwen orders issued to the summon endfunction constant function IndieSummon_mindelay takes nothing returns real return 1.00 //* The min delay betwen orders issued to the summon endfunction constant function IndieSummon_maxdistance takes nothing returns real return 800.0 //* If the distance betwen the summon and the master is greater than this value, // The summon will move to the position of the master instead of attack move endfunction constant function IndieSummon_cometomaxdist takes nothing returns real return 500.0 //* Max distance for issued orders to approach the master endfunction constant function IndieSummon_cometomindist takes nothing returns real return 100.0 //* Min distance for issued orders to approach the master endfunction //================================================================================================== function IndieSummon_Order takes unit summon, unit master returns nothing local integer o=GetUnitCurrentOrder(summon) local real tx=GetUnitX(master) local real ty=GetUnitY(master) local real angle local real dist set dist=Pow(tx-GetUnitX(summon),2) + Pow(ty-GetUnitY(summon),2) if (dist > (IndieSummon_maxdistance()*IndieSummon_maxdistance()) ) and (o == 0 or o == OrderId("attack") or o == OrderId("move") or o == OrderId("stop") or o==851971) then call IssuePointOrder(summon, "move", tx,ty) elseif dist >= (IndieSummon_cometomindist()*IndieSummon_cometomindist()) and (o == 0 or o == 851971) then set angle = GetRandomReal( GetUnitFacing(master)-80, GetUnitFacing(master)+80) if (ModuloInteger(GetUnitPointValue(summon),2)==0) then set angle=angle * bj_DEGTORAD else set angle=- angle * bj_DEGTORAD endif set dist = GetRandomReal(IndieSummon_cometomindist(), IndieSummon_cometomaxdist() ) set tx=tx+dist*Cos(angle) set ty=ty+dist*Sin(angle) if not IssuePointOrder(summon, "attack", tx, ty ) then call IssuePointOrder(summon, "move", tx, ty ) endif endif set summon=null set master=null endfunction function IndieSummon_AntiSmart_Timer takes nothing returns nothing local timer t=GetExpiredTimer() local string k=GetAttachmentTable(t) local unit s=GetTableUnit(k,"summon") if (GetUnitCurrentOrder(s)!=851971) then call ClearTable(k) call DestroyTimer(t) else call IndieSummon_Order( s, GetTableUnit("[IndieSummons]",GetAttachmentTable(s)) ) call TimerStart(t,0.1,false,function IndieSummon_AntiSmart_Timer) endif set t=null endfunction function IndieSummon_AntiSmart takes nothing returns nothing local timer t if (GetIssuedOrderId() == 851971) then set t=CreateTimer() call AttachObject(t,"summon",GetTriggerUnit()) call TimerStart(t,0,false,function IndieSummon_AntiSmart_Timer) set t=null endif endfunction function IndieSummon_loop takes nothing returns nothing // Executed in another thread local unit summon=bj_ghoul[0] local string k=GetAttachmentTable(summon) local unit master local trigger smart=CreateTrigger() local integer n=0 local triggeraction ac=TriggerAddAction( smart, function IndieSummon_AntiSmart) call TriggerRegisterUnitEvent( smart, summon, EVENT_UNIT_ISSUED_TARGET_ORDER ) call TriggerRegisterUnitEvent( smart, summon, EVENT_UNIT_ISSUED_POINT_ORDER ) loop exitwhen (GetWidgetLife(summon)<=0) set master=GetTableUnit("[IndieSummons]",k) if (master==null) then exitwhen true else call IndieSummon_Order( summon, master) call PolledWait( GetRandomReal( IndieSummon_mindelay(), IndieSummon_maxdelay() )) endif endloop call SetTableObject("[IndieSummons]",k,null) call TriggerRemoveAction(smart,ac) call DestroyTrigger(smart) set ac=null set summon=null set master=null set smart=null endfunction //=========================================================================== function InitTrig_IndieSummon_Code takes nothing returns nothing endfunction So apparently something is wrong. I copied it over like it said too, copied the triggers over like it said to, and managed to pull up this: "332 compile errors" Line 440 Expected a name "local string k=GetAttachmentTable(summon)" I cannot save my map and all the triggers regarding this whole thing (the two above as well as two others) are completely disabled. I'm not very familiar with JASS (I have a shallow knowledge of the subject) so go easy on me please. |
| 12-01-2007, 02:11 AM | #2 |
When the WE compiler tells you there are 300 errors, it is its secret way of asking you to stop using it and move to newgen pack. From the line you have a problem with, I'd say you didn't implement CSCache... |
