HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Argh, Preloading.

10-28-2007, 08:32 PM#1
darkwulfv
Ok. I want to preload my abilities, because they lag on the first cast (which is dreadfully annoying.) So, I've heard to do that you just place and remove a unit (or units) that have said abilities and it's all fine and dandy. Well, it's not.

The units preload so they don't lag on creation, but the abilities still lag. Is it bad that I'm creating the units for Player(15)? Or is there something else I need to be doing to preload my abilities?

Thanks in advance.

PS: The code I'm preloading with is:

RemoveUnit(CreateUnit(...))
10-28-2007, 08:37 PM#2
PipeDream
Have them use the abilities as well
10-28-2007, 08:58 PM#3
CommanderZ
I was using this and it worked well
Collapse JASS:
local unit d = CreateUnit(Player(12),'hfoo',200,200)
call UnitAddAbility(d,'a000')
call UnitRemoveAbility(d,'a000')
.
.
.
call RemoveUnit(d)
10-28-2007, 11:49 PM#4
darkwulfv
I think I might have to go with CommanderZ's option. Having all the heroes cast all their spells at once... yikes. That'd also require dummies and stuff.

However if Z's doesn't work, I'll go with Pipe's. Thanks both of you!
10-29-2007, 03:36 AM#5
Pyrogasm
Usually it's first the ability's existance that causes the lag. If you're still getting first-cast lag then it's the visual effects. You shouldn't need to have the units cast the spells, but rather do this:
Collapse JASS:
call Preload("Path\\Of\\Your\\SFX\\Here.mdl")
10-29-2007, 11:12 AM#6
darkwulfv
That'd be pretty insane, having to preload all those effects.

It's every single spell that needs casting that lags, and even some passives lag for a split second upon being learned, but some lag more than others. I think it's the ability, not the graphic. But I'll try all these methods nontheless.
11-02-2007, 01:28 AM#7
Ignitedstar
Hmm... Can you only preload models? I have this problem, too and it's going to get serious if I have too many people casting a spell the first time all at the same time. Not with abilities, but items, too. Perhaps it is because of the item's abilities?
11-02-2007, 01:38 AM#8
Pyrogasm
You can directly preload abilities and model paths.
11-02-2007, 08:44 AM#9
cohadar
Preloading is overrated.
11-02-2007, 10:09 AM#10
Pheonix-IV
Make a dummy unit which, by default, has ALL the abilities used in your map.

And i mean ALL, all the hero ones, all the dummy ones the player never sees, ALL of them.

Place one of these dummy units somewhere on the map so it's there when the map starts. Remove it at the 0.01 second mark (could probably use map init too, but i tend to prefer to use 0.01 seconds for init stuff.)

In addition, if it's still lagging, you'll need to preload the effects like Pyrogasm said.


If they're hero spells, you may want to preplace a copy of each hero at max level with all abilities learned as well, sometimes just having level 1 on the dummy doesn't work properly.
11-02-2007, 12:51 PM#11
cohadar
Quote:
Originally Posted by Pheonix-IV
Make a dummy unit which, by default, has ALL the abilities used in your map.

And i mean ALL, all the hero ones, all the dummy ones the player never sees, ALL of them.

This will seriously fail you if have 2 abilities using same OrderId.
11-02-2007, 01:28 PM#12
zen87
Collapse JASS:
    function PreloadAbility takes integer abilid returns integer
     local unit u=FirstOfGroup(udg_casters)
        if u==null then
            set u=GetACaster()
            call UnitAddAbility(u, abilid)
            call UnitRemoveAbility(u, abilid)
            call RecycleCaster_Light( u)
        else
            call UnitAddAbility(u, abilid)
            call UnitRemoveAbility(u, abilid)
        endif
     set u=null
     return abilid
    endfunction
from caster system, so far I have no problem with this function preload :)
11-02-2007, 05:41 PM#13
Szythe
Quote:
Originally Posted by cohadar
This will seriously fail you if have 2 abilities using same OrderId.

No it won't the unit never actually needs to cast the abilities, only have the abilities for them to be loaded