| 03-15-2008, 10:12 AM | #2 | |
Quote:
Make them locals instead and store them in a gamecache |
| 03-15-2008, 02:29 PM | #3 | |
Quote:
By making 'ChainFrostPreviousUnit' or 'ChainFrostTempPoint' local in function 'Trig_Chain_Frost_Actions', it cannot be used in other functions like 'ChainFrost_ChainNextTarget' and 'ChainFrost_PickNewTargetCondition'. Anyway, can game cache be used through the battle.net/local area network? From this tutorial (http://www.wc3campaigns.net/showthread.php?t=81478), it says 'Remember that Game Caches can not be used on Battle Net, and are almost only ever used for campaigns.' By the way, I have tried the game caches and I can't seem to 'refer' to a unit without restoring it at a location in the map, unlike other types like real, where I can use the value like this (for example): Trigger: If possible, can you show me how to store local variables (especially units) in game caches and use them -or- are there any workarounds for the problems mentioned above? |
| 03-15-2008, 04:53 PM | #4 |
Game Caches CAN be used in b.net. Most people dont think so, because gamecaches was meant to store files from one game to another. But that's not true. Storing files between games is the primary objective of gamecaches. But they are also used for MUI spellmaking. I will look at the spell and post a code later. Could you tell more about which dummy and buff etc. you use? |
| 03-15-2008, 05:24 PM | #5 |
Gamecahce can be used on bnet, At least on my maps. You can take a look at my(IceFrog's) OLD Chain Frost script (based on DotA, I just changed special effect to dummy projectile). There is no need for global nor handing variables. JASS:// *** Script from DotA map *** //Object Used //A000 = Chain Frost (Hero Spell) //A001 = Chain Frost Effect (Dummy Spell) //hfoo = Dummy Cast Spell //h000 = Chain Frost Effect Unit function ChainFrostFilter takes nothing returns boolean if(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE))then return false endif if(GetUnitAbilityLevelSwapped('A002',GetFilterUnit())==1)then return false endif if(IsUnitAliveBJ(GetFilterUnit())==false)then return false endif return true endfunction function Trig_Chain_Frost_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A000' endfunction function Trig_Chain_Frost_Actions takes nothing returns nothing local unit ltU=GetTriggerUnit() local unit lstU=GetSpellTargetUnit() local unit ledU local unit llU local unit lnX local group lSx=CreateGroup() local group lSX=CreateGroup() local integer ldtI local integer lbtI=7 //** adjust this to config the bounce time ** local real lurR=750.0 //** adjust this to config next bounce range ** set ledU=CreateUnitAtLoc(GetOwningPlayer(ltU),'h000',GetUnitLoc(ltU),GetUnitFacing(ltU)) set ldtI=R2I(DistanceBetweenPoints(GetUnitLoc(ltU),GetUnitLoc(lstU))) call IssuePointOrderLoc(ledU,"move",GetUnitLoc(lstU)) loop exitwhen lbtI <= 0 set lbtI=lbtI-1 loop exitwhen ldtI <= 225 call IssuePointOrderLoc(ledU,"move",GetUnitLoc(lstU)) set ldtI = R2I(DistanceBetweenPoints(GetUnitLoc(ledU),GetUnitLoc(lstU))) call PolledWait(0.1) endloop call RemoveUnit(ledU) call UnitShareVision(lstU,GetOwningPlayer(lstU),true) set llU=CreateUnitAtLoc(GetOwningPlayer(ltU),'hfoo',GetUnitLoc(lstU),GetUnitFacing(ltU)) call UnitAddAbility(llU,'A001') call SetUnitAbilityLevel(llU,'A001',GetUnitAbilityLevel(ltU,'A000')) call IssueTargetOrder(llU,"frostnova",lstU) call UnitApplyTimedLife(llU,'BTLF',1.0) call UnitShareVision(lstU,GetOwningPlayer(lstU),false) if(lbtI>0)then call GroupClear(lSx) call DestroyGroup(lSX) set lSX=GetUnitsInRangeOfLocMatching(lurR,GetUnitLoc(lstU),Condition(function ChainFrostFilter)) loop set lnX=FirstOfGroup(lSX) exitwhen lnX==null if(IsUnitEnemy(lnX,GetOwningPlayer(ltU)))then if(lnX!=lstU)then if(IsUnitVisible(lnX,GetOwningPlayer(ltU)))then call GroupAddUnit(lSx,lnX) endif endif endif call GroupRemoveUnit(lSX,lnX) endloop if(IsUnitGroupEmptyBJ(lSx)==false)then set ledU=CreateUnitAtLoc(GetOwningPlayer(ltU),'h000',GetUnitLoc(lstU),GetUnitFacing(lstU)) set lstU=GroupPickRandomUnit(lSx) set ldtI=R2I(DistanceBetweenPoints(GetUnitLoc(ledU),GetUnitLoc(lstU))) call IssuePointOrderLoc(ledU,"move",GetUnitLoc(lstU)) loop exitwhen ldtI <= 225 call IssuePointOrderLoc(ledU,"move",GetUnitLoc(lstU)) set ldtI = R2I(DistanceBetweenPoints(GetUnitLoc(ledU),GetUnitLoc(lstU))) call PolledWait(0.1) endloop else set lbtI=0 endif endif endloop call DestroyGroup(lSx) call DestroyGroup(lSX) endfunction |
| 03-15-2008, 05:42 PM | #6 |
Also you could take a look at this tutorial, which will learn you the basics of game caches and MUI. http://wc3campaigns.net/showthread.php?t=83337 |
| 03-16-2008, 05:25 AM | #7 | |||
Quote:
I have attached the map which I used to test out the spell as I find it hard to describe. Thank you for your time on helping me with the code. Quote:
Thanks, I will take this as a reference later. Quote:
Thanks for this link too, I think I have missed out this tutorial. Even though I have tried using the game caches, I have yet to succeed in using them properly. However, I have learnt some effective ways of using JASS by learning to shorten some codes (I am new to JASS but learning it now). |
