• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Can you assist me about making some spells?

Status
Not open for further replies.
Hi all, I have questions in inventing how to create these custom spells:

1.Battle Shout(AP bonus) or Commanding Shout(armor bonus):
I wonder if I can make a temporal buff - for only 15 seconds, that applies every unit in a close range, like the auras, but not permament.
I know there are spells like Devotion aura, but I'm not sure if I set a duration on the aura will it work? If not, what origin spell do I use then?

2. Mind Control: A nit takes player unit under control for 30 seconds.
  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
  • (ability bwing cast) equal to Mind Control
    • Actions
      • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Retain color
then how do I give their control back?(after 30 secs) Something like this?
  • Wait 30.00 seconds
  • Unit - Change ownership of (Target unit of ability being cast) to (Previous owner) and Retain color
 
Level 23
Joined
Oct 12, 2008
Messages
1,783
1.Battle Shout(AP bonus) or Commanding Shout(armor bonus):
I wonder if I can make a temporal buff - for only 15 seconds, that applies every unit in a close range, like the auras, but not permament.

Why cant you use Roar or any AOE buff ability?

2. Mind Control: A nit takes player unit under control for 30 seconds.

You need to set the original owner as variable and save it.
Start a timer that expires in 30 seconds, when it expires you change the ownership back to the saved variable.
 
OK, I dealed with the shouts.

Now, for mind control. The spell has 2 ranks - lasts 20 secs, and 35 secs(I did it to balance 15 levels). Mind control gives the target debuff which indicates it is controlled. How to detect with trigger when the debuff fades so I return the control to the orginal player?
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
You could use a timer for that, But I'd rather use the timer to remove the buff than check for the buff's existence.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Well you don't need to, on cast, you set the timer's timeout to which rank and if you want or need to, you could attach the rank on the timer so you could tell what rank it is.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Use a hashtable.
EDIT: Wait what? You don't need to attach the duration to the timer, since the timer will count the duration. Or maybe you mean you want the duration to be remembered, you can use a hashtable for that.
 
Lighten me please in this "timer counts duration". Whatever of the above you told me about this timer I don't know how to construct it.

  • Mind Control
    • Events
      • Unit - Shadow Hunter 0008 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mind Control
    • Actions
      • Unit - Change ownership of (Target unit of ability being cast) to Player 9 (Gray) and Change color
      • Game - Display to (All players) the text: ((Name of (Target unit of ability being cast)) + |c00FF0000is now controlled by the Shadow Hunter.|r)
      • Countdown Timer - ???
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
  • Countdown Timer - Start SpellTimer as a One-shot timer that will expire in SpellDuration seconds
That's the action in GUI.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
You initialize them on map init.
  • Spell Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- You set the duration of the buff according to the level(rank) of the spell --------
      • Set SpellDuration[1] = 25.00
      • Set SpellDuration[2] = 30.00
Regarding the timer use, I forgot you can't use timers like that in GUI, sorry about that, I think a tutorial would be better at explaining this than me. I think you need to use a periodic trigger here. Better consult the tutorial...
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Well, when your unit casts the ability, you check for the ability's level, then you use that as index for the SpellDuration array. The array indices hold the appropriate value per level (rank?). That's why I suggested you to consult a tutorial haha xD, I don't know much.

EDIT: The type is a real array. The definition is the one I posted (post #17) earlier.
 
It seems like you can help me only on theory. The prob is I don't have much practice. SO you don't hep me much right now.

So what if you set real arrays = 15.00? where is the spell in this, or the spell rank?

-------- You set the duration of the buff according to the level(rank) of the spell --------
wtf, the buff duration is fixed. I dont wanna change its duration. Better check it.

the solution will be either to check buff/spell duration or spell rank
. Since you can't help me(by suggesting a tutorial), let another dude post in this topic.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Yeah, that's why you set it at map init, so you can reference it later when the unit casts. The duration is indeed fixed.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821

  • MC Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- duration per level --------
      • Set MC_Duration[1] = 5.00
      • Set MC_Duration[2] = 10.00
      • -------- hashtable --------
      • Custom script: set udg_MC_HT=InitHashtable()
      • Custom script: endfunction
      • -------- ----------------------------------------------------------------------------------------------- --------
      • -------- Spell timer callback --------
      • -------- ----------------------------------------------------------------------------------------------- --------
      • Custom script: function MC_callback takes nothing returns nothing
      • Set MC_TimerKey = (Key (Expiring timer))
      • Set MC_Target = (Load 1 of MC_TimerKey in MC_HT)
      • Set MC_Owner = (Load 2 of MC_TimerKey in MC_HT)
      • Unit - Change ownership of MC_Target to MC_Owner and Change color
      • Custom script: call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl",udg_MC_Target,"origin"))
      • Custom script: call DestroyTimer(GetExpiredTimer())
      • Custom script: call RemoveSavedHandle(udg_MC_HT,udg_MC_TimerKey,1)
      • Custom script: call RemoveSavedHandle(udg_MC_HT,udg_MC_TimerKey,2)
      • Custom script: set udg_MC_Target=null
      • Custom script: set udg_MC_Owner=null

  • MC onCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mind Control
    • Actions
      • Custom script: local unit udg_MC_Target=GetSpellTargetUnit()
      • Custom script: local player udg_MC_Owner=GetOwningPlayer(udg_MC_Target)
      • Custom script: local timer t=CreateTimer()
      • Custom script: set udg_MC_TimerKey=GetHandleId(t)
      • Custom script: //call DisplayTimedTextToPlayer(Player(0),0,0,60.00,"Id is "+I2S(udg_MC_TimerKey))
      • Hashtable - Save Handle OfMC_Target as 1 of MC_TimerKey in MC_HT
      • Hashtable - Save Handle OfMC_Owner as 2 of MC_TimerKey in MC_HT
      • Custom script: call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl",udg_MC_Target,"origin"))
      • Unit - Change ownership of MC_Target to (Triggering player) and Change color
      • Custom script: call TimerStart(t,udg_MC_Duration[GetUnitAbilityLevel(GetTriggerUnit(),'A000')],false,function MC_callback)
      • Custom script: set t=null
      • Custom script: set udg_MC_Target=null
      • Custom script: set udg_MC_Owner=null

The testmap is attached.
 
Last edited:

  • MC Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- duration per level --------
      • Set MC_Duration[1] = 5.00
      • Set MC_Duration[2] = 10.00
      • -------- hashtable --------
      • Custom script: set udg_MC_HT=InitHashtable()
      • Custom script: endfunction
      • -------- ----------------------------------------------------------------------------------------------- --------
      • -------- Spell timer callback --------
      • -------- ----------------------------------------------------------------------------------------------- --------
      • Custom script: function MC_callback takes nothing returns nothing
      • Set MC_TimerKey = (Key (Expiring timer))
      • Set MC_Target = (Load 1 of MC_TimerKey in MC_HT)
      • Set MC_Owner = (Load 2 of MC_TimerKey in MC_HT)
      • Unit - Change ownership of MC_Target to MC_Owner and Change color
      • Custom script: call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl",udg_MC_Target,"origin"))
      • Custom script: call DestroyTimer(GetExpiredTimer())
      • Custom script: call RemoveSavedHandle(udg_MC_HT,udg_MC_TimerKey,1)
      • Custom script: call RemoveSavedHandle(udg_MC_HT,udg_MC_TimerKey,2)
      • Custom script: set udg_MC_Target=null
      • Custom script: set udg_MC_Owner=null

  • MC onCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mind Control
    • Actions
      • Custom script: local unit udg_MC_Target=GetSpellTargetUnit()
      • Custom script: local player udg_MC_Owner=GetOwningPlayer(udg_MC_Target)
      • Custom script: local timer t=CreateTimer()
      • Custom script: set udg_MC_TimerKey=GetHandleId(t)
      • Custom script: //call DisplayTimedTextToPlayer(Player(0),0,0,60.00,"Id is "+I2S(udg_MC_TimerKey))
      • Hashtable - Save Handle OfMC_Target as 1 of MC_TimerKey in MC_HT
      • Hashtable - Save Handle OfMC_Owner as 2 of MC_TimerKey in MC_HT
      • Custom script: call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl",udg_MC_Target,"origin"))
      • Unit - Change ownership of MC_Target to (Triggering player) and Change color
      • Custom script: call TimerStart(t,udg_MC_Duration[GetUnitAbilityLevel(GetTriggerUnit(),'A000')],false,function MC_callback)
      • Custom script: set t=null
      • Custom script: set udg_MC_Target=null
      • Custom script: set udg_MC_Owner=null

The testmap is attached.

Yep, this definetely worked. I just tested your map. Thanks, you have +rep from me.
 
Status
Not open for further replies.
Top