| 03-07-2010, 11:35 AM | #1 |
If i create a spell that allows either a unit or point target, how do i detect it in a trigger? If i do use GetSpellTargetLoc(), but target a unit, will it take the location of the unit? vice versa, if i use GetSpellTargetUnit(), but target a point, will this return a null? The main question, if i have a spell that targets both units and points, whats the correct way to detect it? |
| 03-07-2010, 11:44 AM | #2 |
basic spell detection via EVENT_PLAYER_UNIT_SPELL_... GetSpellTargetUnit() will return null if you targeted a point -->:local unit u=GetSpellTargetUnit() if u==null then //actions when point was targeted else //actions when unit was targeted endif set u=null and don't use loactions, they're bad cuz you've to destroy and null them |
| 03-07-2010, 11:54 AM | #3 |
GetSpellTargetX() != 0.0 then there is no way to aim on 0.0,0.0 location soo this check will pass. |
| 03-07-2010, 12:19 PM | #4 |
Why not (100.0, 100.0)? That point is just as impossible to aim for as (0.0, 0.0). |
| 03-07-2010, 12:30 PM | #5 | |
Quote:
I understand what you're saying. I forgot to mention however than i need the spell to have the same effect whether or not i target a unit or a point. Either way, I will need to have a point at which I can calculate the spells effects from. Be it a unit position or a direct location. Being so, it seems inevitable that i would have to use GetSpellTargetLoc() (If the target is not a Unit), then destroy it later. Or am I mistaken? =/ Is there another way around? |
| 03-07-2010, 01:24 PM | #6 |
GetSpellTargetX() GetSpellTargetY() works for both units and points. |
| 03-07-2010, 02:00 PM | #7 |
Ah okay, that makes sense. Never knew those functions existed though.. They appear black with my Jasshelper so ive no idea if theyre natives or some special functions built into newgenworldedit. Either ways, thanks for the replies everyone. My question has been cleared. =) |
| 03-07-2010, 02:21 PM | #8 | |
Quote:
update tesh to horus |
