| 10-26-2006, 01:45 AM | #2 | |
I'll answer your first question... kind of: Quote:
|
| 10-26-2006, 02:54 AM | #3 |
1st question will be something like above 2nd question : well of course, jass always looks more neat when it comes to big loop compared to GUI 3rd question : well i think that's barrage ability, no matter what you set, the minimum ammount of missle shoot out is always 3, even you change the number lower it won't do, but you do can reduce the damage shoot out by combine barrage and destroy tower from thinker (dota's medusa way of solving this problem) |
| 10-26-2006, 09:57 AM | #4 | |
Quote:
Thanks for pointing me out =). Anyway, to add onto what he quoted me, heres the post: http://wc3campaigns.net/showpost.php...9&postcount=10 |
| 10-26-2006, 09:05 PM | #5 |
Answer to 2nd question i think: JASS:// if ability level for unit local integer i = GetUnitAbilityLevel(unit) // if level of hero then local integer i = GetHeroLevel(hero) if i = 1 then call function A elseif i = 2 then call function B elseif i = 3 then call function C //etc. endif endfunction Fairly sure that programming an array of functions (if you can) would take you longer than above. |
| 10-26-2006, 09:17 PM | #6 | |
Quote:
NO! Totally, totally wrong. Object Leaks: Objects take up memory. Some objects (eg: units) automatically clear themselves up once they go out of scope. Others, such as locations, do not. As such, whenever you create groups, forces, locations, etc., then you should catch them in a variable, and destroy them later, using functions such as RemoveLocation, DestroyGroup, DestroyForce, etc.. Handle Index Leaks: Handles indexes do not automatically decrement if a variable goes out of scope, only when they are set to something else. This is only really significant for local variables, as globals cannot go out of scope, and so thus are much less of an issue. If the count on a handle index is not decremented, then the index will be permamently counted as taken up, and thus take hostage some memory until the end of the game. As such, unless the variable is pointing to a permament object, you should set local variables of handle type to null at the end of a function. This is not needed if the value has been passed to the function, rather than set within the function itself. These are two radically different types of leak, of which the first is normally the most potent. |
| 10-26-2006, 09:42 PM | #7 | |
Quote:
I dont agree. A unit can still have to be removed, take a dummy for instance, if you dont remove that, it will always be there, a unit is no exception to any other handle, although the main causes might be group and location, a unit still has a possability to needed to be removed. |
| 10-26-2006, 09:48 PM | #8 |
Dummy units don't go out of scope now, do they? When a unit decays (which dummy units, presumably with locust, don't) then they clean up the object memory automatically. Killing a dummy unit would, it decays, have the same effect as removing it. Units have a garbage collector, locations don't (fortunately). |
| 10-26-2006, 09:58 PM | #9 |
Units don't have a garbage collector... Units simply get removed automatically if dead + decay. Then their handle gets replaced by a dummy handle or something like that and that is removed once references == 0 |
| 10-26-2006, 11:08 PM | #10 |
ty everyone for helping me out. 4. Is there really a difference between Unit-Remove Unit and Unit -Kill Unit? if yes, then are there different situations when you use them? 5. Why are BJ things so bad? how would you replace them? like GetAttackedUnitBJ, what would you replace that with? |
| 10-26-2006, 11:19 PM | #11 |
4: Remove unit instantly removes the unit from the game, kill unit lets it decay, plays its death sound etc. Like setting a units hp to 0. 5: BJ's are just functions blizzard made for multiple reasons, some known, some unkown. But lets take KillSoundWhenDoneBJ for example, lets look what it does: JASS:function KillSoundWhenDoneBJ takes sound soundHandle returns nothing call KillSoundWhenDone(soundHandle) endfunction All it does is uses the function call KillSoundWhenDone(soundHandle), but the problem is, why should we do that, when we can just use that function in the first place, its a waste of computing time. It is completly pointless when you can just write call KillSoundWhenDone(soundHandle) and save computing time Some BJ's are good, if you want your code to be neater, such as OrderId2StringBJ, i wouldent really want: JASS:function OrderId2StringBJ takes integer orderId returns string local string orderString // Check to see if it's a generic order. set orderString = OrderId2String(orderId) if (orderString != null) then return orderString endif // Check to see if it's a (train) unit order. set orderString = UnitId2String(orderId) if (orderString != null) then return orderString endif // Unrecognized - return an empty string. return "" endfunction Sticking out in the middle of my code, so sometimes it helps. But TBH, i would reccomend not using them, every single BJ is possible to write itself, 75% of the time they are just wrapper function like my first example which do nothing. Aviod them! Nearly all GUI functions, when converted to Jass, are BJ's, when you clean your map up, convert all your triggers to Jass, and simply remove all the useless BJ's, your map will be alot more professional and cleaner. |
| 10-27-2006, 12:16 AM | #12 |
6. How do i change BJ's into non-BJ's ? Im having some trouble doing so 7. help me fix this...this is creating 92 compiled errors in my map... JASS:function Trig_Drop_Bomb_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A03O' endfunction function Trig_Drop_Bomb_UnitType takes nothing returns boolean return ( GetUnitTypeId(GetFilterUnit()) == 'e004' ) endfunction function Trig_Drop_Bomb_GiveTimer takes nothing returns nothing call UnitApplyTimedLifeBJ( 120.00, 'BTLF', GetEnumUnit() ) endfunction function Trig_Drop_Bomb_Actions takes nothing returns nothing local unit BombCaster = GetSpellAbilityUnit() local integer BombLvl = GetUnitAbilityLevel( BombCaster, 'A03O') local integer NumBomb = 0 if BombLvl == 1 then loop call CreateNUnitsAtLocFacingLocBJ( 1, 'e004', GetOwningPlayer(BombCaster), GetRandomLocInRect(GetPlayableMapRect()), GetUnitLoc(GetTriggerUnit()) ) set NumBomb = NumBomb + 1 exitwhen NumBomb == 20 endloop set bj_wantDestroyGroup = true call ForGroupBJ( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Drop_Bomb_UnitType)), function Trig_Drop_Bomb_GiveTimer ) set NumBomb = 0 elseif BombLvl == 2 then loop call CreateNUnitsAtLocFacingLocBJ( 1, 'e004', GetOwningPlayer(BombCaster), GetRandomLocInRect(GetPlayableMapRect()), GetUnitLoc(GetTriggerUnit()) ) set NumBomb = NumBomb + 1 exitwhen NumBomb == 30 endloop set bj_wantDestroyGroup = true call ForGroupBJ( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Drop_Bomb_UnitType)), function Trig_Drop_Bomb_GiveTimer ) set NumBomb = 0 elseif BombLvl == 3 then loop call CreateNUnitsAtLocFacingLocBJ( 1, 'e004', GetOwningPlayer(BombCaster), GetRandomLocInRect(GetPlayableMapRect()), GetUnitLoc(GetTriggerUnit()) ) set NumBomb = NumBomb + 1 exitwhen NumBomb == 45 endloop set bj_wantDestroyGroup = true call ForGroupBJ( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Drop_Bomb_UnitType)), function Trig_Drop_Bomb_GiveTimer ) set NumBomb = 0 endif set BombCaster = null endfunction //=========================================================================== function InitTrig_Drop_Bomb takes nothing returns nothing set gg_trg_Drop_Bomb = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Drop_Bomb, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Drop_Bomb, Condition( function Trig_Drop_Bomb_Conditions ) ) call TriggerAddAction( gg_trg_Drop_Bomb, function Trig_Drop_Bomb_Actions ) endfunction |
| 10-27-2006, 05:32 AM | #13 |
6. Well try search around and get JassCraft, it has all the native list and you can see what are all those BJ-s are made off and replace them with the most fundemental natives (again, save computing time) 7. Hmmm where your error started ? |
| 10-27-2006, 10:38 AM | #14 |
Yes, as Zen said, get Jasscraft, whenever i look up any function or its BJ i always just open it. The reason why you sometimes get errors is because BJ's normally switch the order of parameters, lets take your ApplyTimedLife The BJ: function UnitApplyTimedLifeBJ takes real duration, integer buffId, unit whichUnit returns nothing And the native: native UnitApplyTimedLife takes unit whichUnit, integer buffId, real duration returns nothing Notice the difference. Anyways, theyre was no errors in your code, it parsed fine. |
| 10-27-2006, 06:40 PM | #15 | |
Quote:
|
