| 01-08-2003, 11:10 PM | #1 |
Guest | Im creating a trigger using the Unit Issued Order. Im having a problem with this. When you are not in range to cast the spell and you order your unit to cast the spell, the trigger will turn on, before the spell is casted. It is because you already ordered your unit to cast the spell even though he has not performed it yet. Is there anyway to create a trigger without having this problem? I want the trigger to turn on when the spell is being performed, not when you first issued the order for the spell. |
| 01-09-2003, 10:27 AM | #2 |
Try making a condition that checks if the unit is in range of the target. |
| 01-09-2003, 02:42 PM | #3 |
Check the effect of the spell. |
| 01-09-2003, 11:46 PM | #4 |
Guest | I have tried a condition where it says the distance between the triggering unit and the target had to be less than a certain distance. When you cast the spell and you are out of range and the unit moves in range and casts the spell, it wont turn on the trigger. However if he was in range when you casted the spell it will turn on the trigger. Its still half broken. I could check the effect of the spell but its a custom spell so it will be too difficult, or I really dont know where to start. Anyone else know how I can fix this? |
| 01-10-2003, 12:07 AM | #5 |
You can try: Trigger(Check for Casting) Event: Unit is issued order targeting an object Condition: order = spell Action: Set Variable( Target = ( Targeted unit ) ) Trigger:Turn On(Check For Range) Trigger:Run(Check For Range, checking conditions) Trigger(Check for Range) (initially OFF) Event: Unit is in Range (Range of spell) of Target Condition: Unit = Casting Unit Action Do what you want Trigger:Turn Off(Check For Range) Trigger(Check for Cancel) Event: Unit is issued an order targeting an object Unit is issued an order targeting a point Unit is issued an order with no Target Unit Dies //(I think, but not shure if this will have any effect) Condition: order is not equal the_spell_you_want Action Trigger:Turn Off(Check For Range) I haven't tryed iet, but I think that's pretty much it. A little messy, and you wil have to work around some stuff like the diference between Unit and Unit-Type, sometimes you can have several people casting this same spell, and if it's an auto-target spell, you will have to change stuff, if it's casted by the computer, you prob. will have to change stuff. |
| 01-10-2003, 12:51 AM | #6 |
What you were asking was a bit too complicated to explain in text, so i made you a map with the triggers in it for you to look at. You may also play this map and see if it works the way you want it to. Please take note, that the way i programmed this map was to only respond to the regular 'attack' command. If you use spells it will not detect that you have attacked the unit. If you want it to detect spells, you will have to edit some of the conditions to make it work. I hope i have helped! Enjoy! |
| 01-10-2003, 01:31 AM | #7 |
Guest | algumacoisaqq thanks for the trigger. I will give it a try. MrDoomMaster thanks for the map. I will try it out. |
| 01-10-2003, 04:12 AM | #8 |
Guest | Thanks for everyones help. I figured it out. I basically followed what you guys layed out. I used the Range condition and it worked. A little problem existed on it though. When you cast the spell and all conditions are true then you hurry up and cancel the spell, the triggers will still continue to turn on. So instead of a Range check, I used a mana check and that worked out really good. You could not cancel the spell because the mana was not used. I would not have known where to start thanks to you guys. One more thing. In the trigger to check for cancel. I had it set for each player. Is there a way to just say Unit owned by a Human player is issued an order...blah blah.. instead of writing each one for each player? I tried variables but for some reason it wont let me used variables in the Event section but I can in the Action. Its not big deal but I just wanted the trigger a little bit more clean. |
| 01-10-2003, 06:14 PM | #9 |
Download Warcraft 2.3 from http://www.geocities.com/boddozerg/, you can open it up and look at the triggers. It's fairly well commented and should show you all you need to know about making custom-trigger spells. The basic procedure is as follows: When a unit is ordered to cast a spell, it checks whether he's in range and has the mana. If so, the spell effect is created immediately. If he lacks the mana, the order is ignored. If he has the mana but is out of range, a timer is set to go off every 0.2 seconds. Every time the timer is activated, it checks whether the unit is in range to cast the spell, and has the mana to cast it. If the unit is in casting range, the spell effect is created... otherwise, the timer is reset for another 0.2 seconds. When a unit is given an order that is NOT to cast a spell, the game searches for any timers attached to that unit and stops the timer. This prevents the unit from casting the spell even after you've told it to stop or move somewhere else. This allows Warcraft 2 mages and deathknights to cast Fireball, Deathcoil, Unholy Armor, Blizzard, and Death and Decay the same way they did in Warcraft 2. More creative usage of the same procedure can create virtually any spell effect you want. The "check every 0.2 seconds" timer is what I have used to keep performance reasonable with many Mages/Deathknights in a game. If you only have to check for spellcasting on a few units (like in an RPG where only Heros get powerful spells) then you can check every 0.1 seconds to make the spell effect more consistent with the graphics. The actual casting range of spells is not always equal to the range you set in AbilityData.slk. It is always greater, sometimes much greater. For example, you can set the range on Lightning Shield to 600 in AbilityData.slk, but its actual in-game range will be 700. To detect the actual range in game, make a single Mage with 400 mana and use this trigger: Every 0.1 seconds Conditions - Mage's mana becomes less than 400 Actions - Display text to All Players "Distance = R2S(Distance between Mage and SpellQueueTarget(Mage))" |
| 01-11-2003, 01:38 AM | #10 |
Guest | BoddoZerg Sounds great. Ill check it out. |
| 01-11-2003, 02:34 AM | #11 |
neat map. the runes dont seem to damage your own units when they step on them. hmm and you can exorcise non undead units, like your fellow paladins. |
| 01-11-2003, 04:37 AM | #12 |
i can get the map to work all it does is show me a dialog to select recources then it shows the 1/2 mask map and does nothing |
