| 03-04-2007, 08:04 PM | #1 |
GUI: I need to buff all units matching a condition instantly, and make it so the buff can be removed later independent of the other units( so not an aura). I tried having a fireball based spell and have a dummy unit cast it on each unit, but it never actually casts. I can manually cast it, and it works, but it won't work automated. I have no attachments to what I've already tried, so if it's easier to do it some other way please explain it that way. |
| 03-04-2007, 08:17 PM | #2 |
Obviously you cannot create buffs out of thin air..you have to have a spell. That being said, I would suggest you base an ability off of slow and later on, use a purge-based spell to remove that spell/buff. You can automatically cast this slow-based spell, just make sure it has NO mana cost and NO cooldown, and make sure you have a dummy unit (with no model, shadow, attack or movement,) WITH the special slow ability, Invulnerability, and Locust in its "Normal abilities" field in the OE, then use the following code: JASS:local unit u = GetTriggerUnit() // the unit getting the buff local real x = GetUnitX( u ) local real y = GetUnitY( u ) // 4 digit code for dummy unit local unit dummy = CreateUnit( GetOwningPlayer( u ), 'o000', x, y, 0 ) // 4 digit code for special ability w/ buff call IssueOrderTarget( dummy, 'A000', u ) call RemoveUnit( dummy ) call RemoveUnit( u ) set dummy = null set u = null |
| 03-04-2007, 08:30 PM | #3 |
Well Ok, I did say GUI, but I'll give this a try. However one thing I noticed is that you are using a function to get the triggering unit? I want it to do it to all units matching a condition(For example, non-mechanical and owned by enemy players). I will post back when I have tried this out though to see if it worked. EDIT: Yeah I really have no idea what you want me to do with that bit of code. I converted a blank trigger to custom text, and then I realized I have no idea what those functions do, or what I'm supposed to send them. |
| 03-04-2007, 08:40 PM | #4 |
Well, that function by itself won't work...the GUI trigger: Trigger: Converts to jass as: JASS:function Trig_Test_Conditions takes nothing returns boolean return IsUnitType(GetTriggerUnit(), UNIT_TYPE_MECHANICAL) == true endfunction function Trig_Test_Actions takes nothing returns nothing call KillUnit( GetKillingUnitBJ() ) endfunction //=========================================================================== function InitTrig_Test takes nothing returns nothing set gg_trg_Test = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Test, EVENT_PLAYER_UNIT_DEATH ) call TriggerAddCondition( gg_trg_Test, Condition( function Trig_Test_Conditions ) ) call TriggerAddAction( gg_trg_Test, function Trig_Test_Actions ) endfunction |
| 03-04-2007, 08:45 PM | #5 | |
How can I make the function work in such a way so that when a trigger occurs it calls this JASS function. And again, is JASS really necessary? It should be noted the targeted unit is already stored in a variable. EDIT: Does this look right? Quote:
It doesn't work at all. Wtf? |
| 03-04-2007, 09:01 PM | #6 |
Sorry for the double post but I really need to say that none of that worked. It gives me compile errors saying "Expected a code statement" "Expected a Name" "Expected a variable name" etc. How do I fix this. EDIT: Yeah unless you can actually give me a bit of working code, or what I need to make that code work, I'm just going to ctrl+Z and continue with GUI. To tell you the truth your bit of code doesn't seem to do anything GUI doesn't do. Except make pointless variables. Yes I am the definition of impatient. I got it to work using the principal of creating a new unit ontop of the target rather than using an already existing hidden buffer in the corner. Thank you for this idea as it seems to have worked with moderate success. I hope you aren't offended by my dislike of completely unnecessary JASS. |
| 03-04-2007, 09:26 PM | #7 |
I have no idea what WNxCryptic is trying to get you to do ...but there's an easy way to do this.Base an ability off of "Slow Aura (Tornado)". This is a rather useful ability because it can be used to attach buffs and SFX to units without worrying if they die. Change all the fields so that it does absolutely nothing at all. Setting targets allowed to "Self", and the "Stats - Area of Effect" to 0.01. Then, if you would like an effect attached for units with this buff, change the "Art - Target" field to the desired special effect. Next, go to the "Stats - Buffs" field, look at the buff listed there, and then go into the buff editor, find the buff, and base a new custom buff off of that. Change the buff text, icon, and all that stuff to whatever you may need to fit your buff. The buff art does not matter, as it will not affect the unit with the buff. When this is all said and done, add the ability to the units that should get the buff, and remove it/the buff (with the trigger function "Remove Buff from...") when it should be removed. You need to remove the buff in addition the ability because the ability is an aura. Thus, it will take a few seconds for the buff to be removed because of the aura refresh rate. The above process will create a "hostile" or "red-text" buff. If you would like a "friendly" or "green-text buff", repeat the above process with Devotion Aura, but set the ability to a "unit ability" and change the number of levels to 1. |
| 03-04-2007, 09:31 PM | #8 |
Yea..I can't give instruction in GUI...my head might explode :( Sorry I couldn't help you out more Kal..hopefully Pyro's method will be of more help. |
| 03-04-2007, 09:46 PM | #9 |
Why? Because you never learned it? I help for sympathy. While your method acutally does work just fine, there are flaws (purge would remove other buffs), ways it could be optimized, and things he just won't be able to understand. Actually, the method I posted has nothing to do with GUI... it's all object editor stuff and 3 lines of code. Rep'd for your help anyway, though. |
| 03-04-2007, 09:50 PM | #10 |
Wow that actually seemed to work quite well. Will this cause any problems if there is more than one ability based on Slow Aura(Tornado) affecting the same unit? Because if that is the case I will need to figure out a different way to give buffs. EDIT: I figured firebolt was the wrong ability to base it off of lol. EDIT2: Yes this aura thing does infact work as I hoped it would, that is going to help me make a lot of abilities I couldn't previously. Rep added :) |
| 03-04-2007, 10:04 PM | #11 |
You're welcome. |
