• 🏆 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!

[Trigger] Wait-Problem

Status
Not open for further replies.
Level 6
Joined
Mar 27, 2009
Messages
195
hey ihave got a problem with a wait action:

  • MySpell
    • Events
      • Einheit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Gleich MySpell
    • Actions
      • Custom script: local integer udg_BK_index
      • Set BK_index = (Player number of (Owner of (Triggering unit)))
      • Set BK_loc[BK_index] = (Target point of ability being cast)
      • Set BK_caster[BK_index] = (Triggering unit)
      • Set BK_damagegroup[BK_index] = (Units within 512.00 of BK_loc[BK_index] matching (((Matching unit) belongs to an enemy of (Owner of BK_caster[BK_index])) Gleich True))
      • Specialeffect - Create a special effect at BK_loc[BK_index] using Objects\Spawnmodels\Demon\InfernalMeteor\InfernalMeteor2.mdl
      • Specialeffect - Destroy (Last created special effect)
      • Wait 2.40 seconds
      • Specialeffect - Create a special effect at BK_loc[BK_index] using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
      • Specialeffect - Destroy (Last created special effect)
      • Unitgroup - Pick every unit in BK_damagegroup[BK_index] and do (Actions)
        • Loop - Actions
          • Unit - Cause BK_caster[BK_index] to damage (Picked unit), dealing 1000.00 damage of attack type XY and damage type Normal
      • Unit - Order BK_caster[BK_index] to Stop
      • Custom script: call RemoveLocation (udg_BK_loc[udg_BK_index])
      • Custom script: call DestroyGroup (udg_BK_damagegroup[udg_BK_index])
so my problem is the damage. if i set

  • Unit - Cause BK_caster[BK_index] to damage (Picked unit), dealing 1000.00 damage of attack type XY and damage type Normal
to

  • Unit - Cause (Triggering Unit) to damage (Picked unit), dealing 1000.00 damage of attack type XY and damage type Normal
it works; otherwise not. so how can i fix that? (the wait is necessary because of the effect)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
NEVER use Wait-Actions in spells!!!
Wait in MUI leaks and causes errors!
I think you should use timers, but I'm no speller and don't know exactly how to do this right, but remember!!
NEVER use WAIT in spells!
WTF are you saying? You make no sense...

Anyway, avoid using waits for periods under a few seconds as they are unaccurate. For over a second, use polledwait (wait game time) as that syncs with a timmer so is only a fraction of a second off. Use timers for 100% accuracy. All methods fail if a WC3 game starts with a bugged timing system and fire near instantly (happened to me twice on battlenet).

WC3 supports only 1 local per function to have the same name as a global, anymore cause serious problems.

I have no clue why you are using arrays for this with a local index reference. As it is only 1 function, maybe you should just use pure locals for full MUI? Ofcourse you may wish to scrap GUI then and upgrade to JASS.
 
Level 6
Joined
Mar 27, 2009
Messages
195
WTF are you saying? You make no sense...

Anyway, avoid using waits for periods under a few seconds as they are unaccurate. For over a second, use polledwait (wait game time) as that syncs with a timmer so is only a fraction of a second off. Use timers for 100% accuracy. All methods fail if a WC3 game starts with a bugged timing system and fire near instantly (happened to me twice on battlenet).

WC3 supports only 1 local per function to have the same name as a global, anymore cause serious problems.

I have no clue why you are using arrays for this with a local index reference. As it is only 1 function, maybe you should just use pure locals for full MUI? Ofcourse you may wish to scrap GUI then and upgrade to JASS.

i tried to do it in jass a few times, but failed :cry:. and i thought using arrays and a local index variable makes the spell MUI.

Can I make this in JASS for you?

would be very nice :D i have got a few more spells just with other effects, but it would be nice if you do just this one for me.

EDIT: Child_of_Bodom made the spell in jass. for everyone who is interested here is it:

JASS:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Some Spell by Child_0f_Bodom //
// This spell is made in JASS and doesn't need any World Editor extension //
// To implement it Simply make a trigger called Your Spell and paste my spell there //
// Continue reading comments as they contain instructions how to implement this spell //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//===================== Spell Condition ===============================
// Pur Raw code of your spell instead of 'A000' value
// To get your spell raw code simply hit Ctrl+D in object editor
function SpellCondition takes nothing returns boolean
    return GetSpellAbilityId()=='A000'
endfunction

//===================== Data Initialization ===============================
// Here are some values that affect balance and visual effects
// Effect1 is first effect the spell makes
// If you want to replace its effect, copy the model path and add 1 more slash ("\") after each one in model path
// E.g. "Objects\MyObject.mdl" becomes "Objects\\MyObject.mdl"
function Effect1 takes nothing returns string
    return "Objects\\Spawnmodels\\Demon\\InfernalMeteor\\InfernalMeteor2.mdl"
endfunction

// Here is the second effect in your spell
function Effect2 takes nothing returns string
    return "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
endfunction

// Below is the wait your spell idles before dealing damage
function Wait takes nothing returns real
    return 2.40
endfunction

// AOE is set here
function Radius takes nothing returns real
    return 512.00
endfunction

// Here is the damage value
function Damage takes nothing returns real
    return 1000.00
endfunction

//===================== Spell Filter ===============================
// This filter determinates which units are going to be damaged with spell
// You can change it anytime if you need to
function TargetCheck takes nothing returns boolean
    local unit u = GetFilterUnit()
local boolean b = not(IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE) or IsUnitType(u,UNIT_TYPE_STRUCTURE))
    set u = null
    return b
endfunction

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Here comes the actual Spell code //
// Don't edit it if you don't know what are you doing //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//===================== Spell Action ===============================
// The main part of the Spell
function Your_Spell_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local location target = GetSpellTargetLoc()
    local real x = GetLocationX(target)
    local real y = GetLocationY(target)
    local group g = CreateGroup()
    local unit u
    call RemoveLocation(target)
    call GroupEnumUnitsInRange(g, x, y, Radius(), Filter(function TargetCheck))
    call DestroyEffect(AddSpecialEffect(Effect1(), x, y))
    call PolledWait(Wait())
    loop
        set u = FirstOfGroup(g)
exitwhen u == null
        call GroupRemoveUnit(g, u)
        call UnitDamageTarget(caster, u, Damage(), true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
    endloop
call DestroyGroup(g)
    call DestroyEffect(AddSpecialEffect(Effect2(), x, y))
    set u = null
    set g = null
endfunction

//===================== Event Setup ===============================
// Here is the filter to prevent leaks
function ReturnTrue takes nothing returns boolean
    return true
endfunction

function InitTrig_Your_Spell takes nothing returns nothing
    set gg_trg_Your_Spell = CreateTrigger( )
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(1), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(2), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(3), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(4), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(5), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(6), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(7), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(8), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(9), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(10), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerRegisterPlayerUnitEvent( gg_trg_Your_Spell, Player(11), EVENT_PLAYER_UNIT_SPELL_EFFECT, Condition (function ReturnTrue))
    call TriggerAddCondition( gg_trg_Your_Spell, Condition( function SpellCondition ) )
    call TriggerAddAction( gg_trg_Your_Spell, function Your_Spell_Actions )
endfunction
 
Last edited:
Status
Not open for further replies.
Top