Spell Help (Spell Damage Enhancer)

ReVolver

Mega Super Ultra Cool Member
Reaction score
609
Ok here is a spell I want to make but I don't know how to make it :confused:

The spell works like this

The caster can cast a certain spell many times on a unit depending on how many times the unit casts that spell, he can later use another spell to make an explosion on the unit causing damage * how many times it was cast on. :nuts:
Code:
Using a powerful magic, the Lich can cast a powerful curse that can be add up to cause more damage, the spell can be released separately.

Level 1 - Cast up to 3 times 50 damage per cast.
Level 2 - Cast up to 4 times 60 damage per cast.
Level 3 - Cast up to 5 times 65 damage per cast.
Level 4 - Cast up to 6 times 70 damage per cast.

edit: I want to probably store this unit since I want to make a floating text (for damage) and a special effect, whenever the spell is released.
 

ReVolver

Mega Super Ultra Cool Member
Reaction score
609
Can you show me a quick example on how to use this system on my spell?
 

emjlr3

Change can be a good thing
Reaction score
395
simple sugg would be to use GC

your storing to string would be say

"Spell Name"+H2S(caster)+H2S(target)

you can store/edit the total number of casts, and retrive it later when you want to detonate

the same idea when using PUI, except since you can only attach to the unit itself, I see no way on discerning who casted the spell, or updating different casters numbers independantly, perhaps ask Cohadar for some help with that, if you wan to use PUI, if not, my GC sugg will take care of it
 

ReVolver

Mega Super Ultra Cool Member
Reaction score
609
Well this is what I have at the moment I am learning PUI

JASS:
scope VoodooCurse

globals
    integer array Ticks
    private constant integer ABILITY_ID = 'A00C'
endglobals

public function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == ABILITY_ID
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetSpellTargetUnit()
    local integer pui = GetUnitIndex(u)
    set Ticks[pui] = Ticks[pui] + 1
    if Ticks[pui]>5 then
    set Ticks[pui] = 5
endif
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerAddAction( t, function Actions )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
endfunction
endscope


JASS:
scope VoodooDamage

globals
    private constant integer ABILITY_ID = 'A00B'
endglobals

public function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == ABILITY_ID
endfunction

private function Damage takes nothing returns nothing
    local unit u = GetSpellTargetUnit()
    local integer pui = GetUnitIndex(u)
    call UnitDamageTarget(u,u,pui*60,true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerAddAction( t, function Damage)
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
endfunction
endscope


Now I need to figure out how to damage the right unit, right now I'm causing damage to my caster. :banghead:
 

Cohadar

master of fugue
Reaction score
209
JASS:
//==============================================================================
//  Use this as a starting point for structs that need to be attached to units
//  NOTE: create method is private for a purpose,
//  you should not create nor destroy PUI attached structs directly.
//  Use only GetData function, it will do the rest for you.
//==============================================================================
struct StructName
    unit whichUnit
    private static StructName array PUI

    // add your stuff here
    
    //------------------------------------------------------------------
    private static method create takes unit whichUnit returns StructName
        local StructName dat = StructName.allocate()
        set dat.whichUnit = whichUnit
        // add your stuff here
        return dat
    endmethod
    
    //------------------------------------------------------------------
    static method GetData takes unit whichUnit returns StructName
        local integer index = GetUnitIndex(whichUnit)
        // new struct?
        if StructName.PUI[index] == 0 then
            set  StructName.PUI[index] = StructName.create(whichUnit)
        // recycled struct?
        elseif StructName.PUI[index].whichUnit != whichUnit then
            call StructName.PUI[index].destroy()
            set  StructName.PUI[index] = StructName.create(whichUnit)
        endif
        return StructName.PUI[index]
    endmethod     
    
    //------------------------------------------------------------------
    method onDestroy takes nothing returns nothing
        // add your stuff here
    endmethod    
endstruct
//==============================================================================
//  To actually get a struct from unit simply do:
//  call StructName.GetData(whichUnit)
//==============================================================================
 

ReVolver

Mega Super Ultra Cool Member
Reaction score
609
Thank you very much Cohadar, I just need to read the vjass manual so I can work with this system better ;)
 

ReVolver

Mega Super Ultra Cool Member
Reaction score
609
Well I tried "another method" to make the spell, now it doesn't harm my caster but it now it doesn't damage it just sets Ticks back to 0

JASS:
scope VoodooCurse

globals
    integer array Ticks
    private constant integer ABILITY_ID_DAMAGE = 'A00B'
    private constant integer ABILITY_ID = 'A00C' 
endglobals

private function Cast takes nothing returns boolean
    return GetSpellAbilityId() == ABILITY_ID
endfunction

private function Damage takes nothing returns boolean
    return GetSpellAbilityId() == ABILITY_ID_DAMAGE
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetSpellTargetUnit()
    local integer pui = GetUnitIndex(u)
    if ( Cast() ) then
    set Ticks[pui] = Ticks[pui] + 1
    call BJDebugMsg("Spell Cast")
    call BJDebugMsg(I2S(Ticks[pui]))
        if Ticks[pui]>5 then
        set Ticks[pui] = 5
        endif
    else
        if ( Damage() ) then
        call BJDebugMsg("Damage")
        call UnitDamageTarget(GetTriggerUnit(),u,I2R(Ticks[pui]*60),true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
        call BJDebugMsg(I2S(Ticks[pui]))
        else
        endif
    endif
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerAddAction( t, function Actions )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
endfunction
endscope
 

Cohadar

master of fugue
Reaction score
209
JASS:

//===========================================================================
//  Demo spell for using PUI in combination with global arrays
//  to create counters that are attached to unit
//
//  Author: Cohadar
//  Date: 2008.03.08
//===========================================================================

scope FleshHeap

globals
    private constant integer AID_FLESH_HEAP = 'A001'
    private constant integer AID_STR_BONUS  = 'A002'
    
    private constant integer HERO_PERCENT = 30
    private constant integer UNIT_PERCENT = 3
endglobals

globals    
    // do NOT use this arrays directly, use below functions
    private unit array PUI_unit
    private integer array PUI_counter
endglobals

//===========================================================================
private function GetCount takes unit whichUnit returns integer
    local integer index = GetUnitIndex(whichUnit)
    if PUI_unit[index] != whichUnit then
        set PUI_unit[index] = whichUnit
        set PUI_counter[index] = 0
    endif
    return PUI_counter[index]
endfunction

//===========================================================================
private function AddCount takes unit whichUnit, integer count returns nothing
    local integer index = GetUnitIndex(whichUnit)
    if PUI_unit[index] != whichUnit then
        set PUI_unit[index] = whichUnit
        set PUI_counter[index] = count
    else
        set PUI_counter[index] = PUI_counter[index] + count
    endif
endfunction

//===========================================================================
private function SetCount takes unit whichUnit, integer count returns nothing
    local integer index = GetUnitIndex(whichUnit)
    set PUI_unit[index] = whichUnit
    set PUI_counter[index] = count
endfunction

//===========================================================================
private function Actions takes nothing returns nothing
    local unit pudge = GetKillingUnit()
    local integer level = GetUnitAbilityLevel(pudge, AID_FLESH_HEAP)
    
    if IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) then
        call AddCount(pudge, level*HERO_PERCENT)
    else
        call AddCount(pudge, level*UNIT_PERCENT)
    endif
    
    if GetCount(pudge) >= 100 then
        call SetCount(pudge, 0)
        debug call BJDebugMsg("|c0000FF00" + "strength increased")
        call IncUnitAbilityLevel(pudge, AID_STR_BONUS) // green stat way
        //call SetHeroStr(pudge, GetHeroStr(pudge, false)+1, true)  // Dota way
    endif
    
    set pudge = null
endfunction

//===========================================================================
private function Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetKillingUnit(), AID_FLESH_HEAP) > 0
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
    set trig = null
endfunction

endscope
 

emjlr3

Change can be a good thing
Reaction score
395
seriosuly follow that method there
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top