| 12-09-2009, 01:43 AM | #1 |
Hey. I would like to create a function like IsLightningDestroyed. However right now I have not found a reliable and performant possibility for such a function. I have 2 possibilities until now: 1. DestroyLightning Hook, flag destroyed lightnings. vexorian wrote himself, hook is somewhat unreliable and i dont like to rely on it. Since almost every native which takes lightning crashes the game when the token lightning was already destroyed, most likely every fail of the hook would cause in an instant fatal error for wc3; nothing I want to risk. 2. creating new lightnings until reaching the handle id of the old lightning; if a new lightning's id is the same like the current lightning's, it was destroyed; this seems to work 100 %, lightnings always use the lowest possible handle id, so you can just count up until reaching the current id. However Zinc:
lightning TempLightning[];
function IsLightningDestroyed(lightning bolt)->boolean
{
integer i=GetHandleId(bolt),j=0,k=0;
while (j<i)
{
k+=1;
TempLightning[k]=AddLightning("LEAS",false,0,0,0,0);
j=GetHandleId(TempLightning[k]);
}
for (k=k; k>0;k-=1)
{
DestroyLightning(TempLightning[k]);
}
return i==j;
}
this looks performance-heavy for me, if you call it with 32 fps for every lightning you want to check... anyone knows a better possibility? |
| 12-09-2009, 02:19 AM | #2 | ||
Quote:
Quote:
|
| 12-09-2009, 06:07 AM | #3 |
create your own type lightningEX with security checks... |
| 12-09-2009, 12:16 PM | #4 | ||||
Quote:
Quote:
Quote:
However, I definitely do NOT want to use this, thats why I am asking for another method. Just thought, it might help some people here to think of another method to achieve this. Quote:
But well, if there is no other, simple solution I guess, I have to use either hook or custom functions :-/ |
| 12-09-2009, 12:30 PM | #5 |
Use custom functions. Hooks actually are bad, because of what you already quoted, they do not work everytime. |
| 12-09-2009, 01:42 PM | #6 | |||||
Quote:
Quote:
Quote:
Quote:
Quote:
|
| 12-09-2009, 01:43 PM | #7 | |
Quote:
|
| 12-09-2009, 01:46 PM | #8 |
I am actually just going to close this and keep all discussion within that AdvLightning thread. |
