• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Can i have some help ?

Status
Not open for further replies.
Level 2
Joined
Dec 24, 2016
Messages
15
I am trying to make a ability that make casting unit(hero) invulnerable and repeat it every 1s (depending on level) but when i attempt to do it i can't repeat it. Something wrong with the code here ? ;'(
My project is : StarfallwonderV1.6a3.w3x
Ability is Rapier Divison.
 

Attachments

  • bandicam 2016-12-24 11-23-46-361.jpg
    bandicam 2016-12-24 11-23-46-361.jpg
    266.5 KB · Views: 43
  • bandicam 2016-12-24 11-24-49-454.jpg
    bandicam 2016-12-24 11-24-49-454.jpg
    196.9 KB · Views: 44
  • bandicam 2016-12-24 11-25-15-207.jpg
    bandicam 2016-12-24 11-25-15-207.jpg
    401.2 KB · Views: 79
Level 10
Joined
Sep 16, 2016
Messages
269
Well, I cant see your 3rd trigger, but maybe that won't be necessary. Your idea is very close to the ability Phase Shift, if you can't understand the mistakes below, you should use that default ability.

  • Your idea is not complete: the effect happens every 1s, but how long will the "shield" last?
  • Your trigger is difficult to understand: trigger LV1 isn't needed, you can turn those two on beforehand and leave them that way (they only run when the event fits). Adding the timer to the event itself will make it run continuously, but nothing will happen since (periodic timer event) doesn't produce (casting unit) or (triggering unit) (btw you should use the later only).

You want something to run for a long time, use a variable. Save the unit with it, then every X seconds do stuffs with the variable until time runs out.
 

Rheiko

Spell Reviewer
Level 26
Joined
Aug 27, 2013
Messages
4,214
Yes, many things wrong with your code.

Your first trigger, the condition is incorrect. It should be something like this
  • YourTrigger
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Rapier Division (Level 1)
    • Actions
but as @Athur12A2 said, the trigger itself is not needed.

Your second trigger, it's best to use
  • Unit - A unit Starts the effect of an ability
than
  • Unit - A unit Begins casting an ability
because this^ one can be spammed.

Triggering unit and Casting unit are basically the same in this case.
Make a separate trigger for the periodical timer.
Do not use waits.
Store location into variable before you use it and destroy it when it's no longer used to prevent leaks.

Useful tutorials:
Casting Events Guide
Visualize Dynamic Indexing
Memory Leaks
 
Last edited:
Level 2
Joined
Dec 24, 2016
Messages
15
Well, I cant see your 3rd trigger, but maybe that won't be necessary. Your idea is very close to the ability Phase Shift, if you can't understand the mistakes below, you should use that default ability.


    • Your idea is not complete: the effect happens every 1s, but how long will the "shield" last?
    • Your trigger is difficult to understand: trigger LV1 isn't needed, you can turn those two on beforehand and leave them that way (they only run when the event fits). Adding the timer to the event itself will make it run continuously, but nothing will happen since (periodic timer event) doesn't produce (casting unit) or (triggering unit) (btw you should use the later only).
You want something to run for a long time, use a variable. Save the unit with it, then every X seconds do stuffs with the variable until time runs out.
No no no my idea about the ability is:
Make a unit invulnerable about 1/2/3.5/6 seconds and vulnerable about 1/1.75/3.0/5.25 and repeat.
Also i want to make a level system like when i type (ex: -levelupRD) or something, the old level one will
be removed and replace to another. And can i ask a question, Athur 12A2. How can i make every X seconds do stuffs swith the variable until time runs out like that. Although i create Warcraft III world for so long, i still can't create a spell that actually have
custom variable.

Any way i already fix it, is this actually can cause bug/error,... ??
  • Rapier Divison LVL1
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Rapier Divison (Level 1)
    • Actions
      • Trigger - Turn on Rapier Divison LVL1 Shield <gen>
      • Game - Display to (All players) the text: |c00FF0000Type -lev...
  • Rapier Divison LVL1 Shield
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Rapier Divison (Level 1)
    • Actions
      • Unit - Remove All buffs from (Casting unit)
      • Unit - Make (Casting unit) Invulnerable
      • Special Effect - Create a special effect at (Position of (Casting unit)) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
      • Unit - Add Buff Ability to (Casting unit)
      • Wait 1.00 seconds
      • Unit - Make (Casting unit) Vulnerable
      • Special Effect - Destroy (Last created special effect)
      • Unit - Remove Buff Ability from (Casting unit)
      • Trigger - Add to (This trigger) the event (Time - Every 1.00 seconds of game time)[/B][/B]

 
Last edited:
Level 14
Joined
Nov 30, 2013
Messages
926
The 2nd trigger can cause a bug by running it two times before the wait action is even finished.
It can also can cause a leak from the Point at Special Effect action. (The special effect can cause leak as well if it ran two times before finishing the wait action)

Using local variables can solve out the bug and removing/destroy point and sp.effect can solve the leaks.
 
Level 2
Joined
Dec 24, 2016
Messages
15
The 2nd trigger can cause a bug by running it two times before the wait action is even finished.
It can also can cause a leak from the Point at Special Effect action. (The special effect can cause leak as well if it ran two times before finishing the wait action)

Using local variables can solve out the bug and removing/destroy point and sp.effect can solve the leaks.
Can you show me a example ? Idk how to do it ;-;
 
Level 14
Joined
Nov 30, 2013
Messages
926
  • Local_Trigger
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to <Ability>
    • Actions
      • Custom script: local unit caster = GetSpellAbilityUnit()
      • Custom script: local effect sp_effect = null
      • Custom script: call SetUnitInvulnerable(caster, true)
      • Custom script: call UnitRemoveBuffBJ(bj_REMOVEBUFFS_ALL, caster)
      • Custom script: set udg_TempLoc = GetUnitLoc(caster)
      • Custom script: set sp_effect = AddSpecialEffectLocBJ(udg_TempLoc, "Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl")
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Wait 1.00 seconds
      • Custom script: call SetUnitInvulnerable(caster, false)
      • Custom script: call DestroyEffect(sp_effect)
      • Custom script: call UnitRemoveBuffBJ(<Ability ID>, caster)
You may be confused if you aren't experienced with Jass.
Also I noticed in your 2nd trigger, the last action (Trigger - Add to (This Trigger) the event <Event> ) is useless.
 
Level 10
Joined
Sep 16, 2016
Messages
269
@bear_369 if you do that much custom scripts, then use it fully then, remove those BJ and use UnitX UnitY. Tome of retraining is an instant effect, you can destroy it immediately when creating without local var. And should you change "begin casting" into "start effect"?

No no no my idea about the ability is:
Make a unit invulnerable about 1/2/3.5/6 seconds and vulnerable about 1/1.75/3.0/5.25 and repeat.

And can i ask a question, Athur 12A2. How can i make every X seconds do stuffs swith the variable until time runs out like that. Although i create Warcraft III world for so long, i still can't create a spell that actually have
custom variable.

Is your idea about an passive ability? It doesn't end and it seems there is no point for the caster to cast it. This is where you create the variable:
Untitled.png

This is a simple use of integer variable. You can guess what it does.
  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • Set Second = (Second + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Second Equal to 59
      • Then - Actions
        • Set Minute = (Minute + 1)
        • Set Second = 0
      • Else - Actions
    • Game - Display to (All players) for 2.00 seconds the text: ((String(Minute)) + minutes has passed.)
 
Last edited:
Level 2
Joined
Dec 24, 2016
Messages
15
@bear_369 if you do that much custom scripts, then use it fully then, remove those BJ and use UnitX UnitY. Tome of retraining is an instant effect, you can destroy it immediately when creating without local var. And should you change "begin casting" into "start effect"?



Is your idea about an passive ability? It doesn't end and it seems there is no point for the caster to cast it. This is where you create the variable:

This is a simple use of integer variable. You can guess what it does.
  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • Set Second = (Second + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Second Equal to 59
      • Then - Actions
        • Set Minute = (Minute + 1)
        • Set Second = 0
      • Else - Actions
    • Game - Display to (All players) for 2.00 seconds the text: ((String(Minute)) + minutes has passed.)
YES! Exactly what i want! And btw
Ông chỉ tôi mấy cái mã đơn giản cái :))
Thank you guys for helping me :)
 
Status
Not open for further replies.
Top