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

Spells & Systems Mini-Contest #16

Status
Not open for further replies.
Level 9
Joined
May 27, 2006
Messages
498
Ouch D: I think you should use jass then, unless you'll find some smart solution :p

But meh, i think you could localize the caster anyway and use another variable to store the unit through triggers. Like

  • Blah
  • Events:
    • Unit - A unit starts effect of an ability
  • Actions:
    • Custom script: local unit udg_AECaster = GetTriggerUnit()
    • Set AECaster_2 = AECaster
    • Unit - Order AECaster to do blah
    • Trigger - Turn on Blah2
    • [...]
  • Blah2
  • Events:
    • Time - Every bleh seconds
  • Actions:
    • Custom script: local unit udg_AECaster = udg_AECaster_2
    • [...]
 
Level 12
Joined
Jun 28, 2008
Messages
688
Hmm well I've started working on localizing some points, I'll try to work some smart way like you said 'cause I really suck at JASS, I just started learning like a week ago lawl.

EDIT: Also this was a guess and it obviously doesn't work, just trying to find the points of units in a unit group.

  • Custom script: local location udg_temppoint = GetUnitLoc(GetPickedUnit())
What's the actual code? (I feel like I'm cheating. =P)
 
Level 9
Joined
May 27, 2006
Messages
498
In jass picked units are called EnumUnits ;p Just change it and it should be ok.

By the way, i started seriously learning jass like 2 weeks ago, and like last weekend i didn't think i'll be able to write anything more complicated than a simple function with a loop any time soon... And now - i've made an entirely MUI jass spell :) You just have to have an idea of what you want to create in jass, and a spell is very good reason to start playing around with it.

Edit:
Uhm, remember that you have to place the custom scripts before any other actions in your trigger, meaning you cant put them inside a group-pick loop.
 
Level 15
Joined
Dec 18, 2007
Messages
1,098
Hey! I comment other people's spells and I don't get any for my own :(.
I have no idea what else to change at the moment so suggestions would be GREATLY appreciated! :D
PS: Paladon and terradont, thanks for the +rep :)
EDIT: Seeing that some people have no idea what to do, lets give some ideas!
Seeds: Throws some seeds at the target point. The seeds may grow into a tree, a treant, roots which entangle people or a poisonous plant which poisons people.
Tree Shield: Creates a shield that surrounds the trees in the target area. The trees will periodically heal allied units and after the shield expires, a burst of energy will damage enemy units and revive some trees.
Nature Cage: Summons a cage that prevents the units in the area from moving out of the cage.
The Hidden Forest: The hero spawns alot of trees which eventually becomes a forest. The forest is somwhat like a maze and there are many traps inside the forest. There may be vines which can disable a unit's movement, thorns to damage units or even poisonous plants to poision units.
EDIT2: I think there will be lots of competitors in the competition :p. Thus, PurplePoot might need to spend lots of time judging, lets +rep him when the contest ends/contest results release:) .
EDIT3: Updated my spell, attached to post :D
 

Attachments

  • Spells&Systems Mini-Contest #16- Rejuvenation Dust.w3x
    37.6 KB · Views: 35
Last edited:
Level 23
Joined
Nov 29, 2006
Messages
2,482
Zack, let me give you a small comment then :]

The concept of the spell is overall good, and seems quite unique (except the spawning of trees which is used more than by just you). However the effects seem rather boring : and/or try to find an ingame sound which boosts the spell.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Berz, I'm not sure about that. You know, when we had the trap theme Redscores (I think it was) set traps and had a dummy ability which was triggering all the traps on the ground. You are right though, it may not fit it, but I think it is allowed.
 
Level 12
Joined
Aug 20, 2007
Messages
866
If your asking if your allowed to use more than one trigger for your spell, some GUI spells you have to, so I'd assume you can
 
Level 5
Joined
Jun 25, 2008
Messages
118
wow my code is giving me a pain in the ass, it litterally wouldnt do something because i used elseif's and presumably my worldeditor doesn't like them ¬¬
and atm the projectile wont move unless i put the setunitposition outside an if... even though it should work inside the if aswell as the if just says "if (not IsUnitInRange(u, targ, 10)) then" .. as in if the projectile isnt within 10... then move it, but it just wont because my worldeditor is cool :hohum:
 
Level 5
Joined
Jun 25, 2008
Messages
118
I've got it working just about now, but im sure theres something wrong with the actual world editor here, because 1, my elseifs wouldnt work earlier for no reason, and 2, it seems to believe half my values are negative... when theyre not Oo my targets were getting healed... dno whats going on here but its quite rediculous ><
 
Level 5
Joined
Jun 25, 2008
Messages
118
i really dont know whats going wrong here, spent about an hour and a half tinkering and slowly some parts have started to work but as far as i could tell it shouldve been working all this time anyway, and now it seems to heal the target when i order it to do damage :eekani:

thanks in advance :wink:
 

Attachments

  • Bee Swarm.w3x
    24.5 KB · Views: 80
Level 23
Joined
Nov 29, 2006
Messages
2,482
Hmm... Yeah it looks weird indeed... Let me investigate it further.

Edit: BlackShogun I did not find the whole solution to your problem, but a Debug message inside
JASS:
endif
if IsUnitInGroup(targ, udg_BeeSwarmed) and (not IsUnitType(targ, UNIT_TYPE_DEAD)) then
    call SetUnitPosition(u, x2, y2)
    call BJDebugMsg(R2S((BeeSwarmBaseDPS(lvl)*BeeSwarmInterval())+dmg)) //this was the msg I added
    call UnitDamageTarget(cast, targ, (BeeSwarmBaseDPS(lvl)*BeeSwarmInterval())+dmg, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
   [...]

gave the following result:

0.150
14uaud3.png

and so on...

As you can see something is wrong with your damage input... It goes from positive to negative, and thats why the unit gets healed.
 
Last edited:
Level 12
Joined
Jun 28, 2008
Messages
688
Ahh, this is racking my brain. Could somebody please point out to me why this isn't MUI? I followed wyrmlord's tutorial loosely and configured the concept to what fit my spell but it still isn't MUI.

Also I know there's a leak with AE_TargP, it's because I forgot how to remove array variables. I'll fix that later.
 

Attachments

  • SSMC 16 AStral Enchantment.w3x
    29.3 KB · Views: 45
Level 15
Joined
Dec 18, 2007
Messages
1,098
Actually its rather simple to make it MUI.
Instead of using whatever AoE target spell, use Tornado :p.
That is one.
The second thing is to make the armour/health regeneration thing MUI. That is also rather simple. Instead of giving a fixed unit (I assumed you made a variable which is assigned to the butterfly thing), pick all units in playable map area matching Matching Unit is Alive and Unit-Type of Matching Unit equals to (Your dummy special effect thingy). After that, set the unit to a temporary unit variable (Temp_Unit or something)Then just do whatever other thing it is you did for your current spell except change the variable unit to Temp_Unit or whatever. You could get some examples from my spell pack in siggy :)
 
Level 23
Joined
Oct 18, 2008
Messages
937
Actually its rather simple to make it MUI.
Instead of using whatever AoE target spell, use Tornado :p.
That is one.
The second thing is to make the armour/health regeneration thing MUI. That is also rather simple. Instead of giving a fixed unit (I assumed you made a variable which is assigned to the butterfly thing), pick all units in playable map area matching Matching Unit is Alive and Unit-Type of Matching Unit equals to (Your dummy special effect thingy). After that, set the unit to a temporary unit variable (Temp_Unit or something)Then just do whatever other thing it is you did for your current spell except change the variable unit to Temp_Unit or whatever. You could get some examples from my spell pack in siggy :)

picking stuff makes lag. use unit group variables.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Doom_Sheep, unit groups are actually checking every handle unit on the whole map and checks if it matches your conditions. When picking units in playable map area, sure you have to use unit group variables since it would otherwise leak a unit group, but thats all. (or use set bj_wantDestroyGroup = true). There would be a difference on destructables however, since there are mostly over a thousand of them at the same time.
 
Level 23
Joined
Oct 18, 2008
Messages
937
Doom_Sheep, unit groups are actually checking every handle unit on the whole map and checks if it matches your conditions. When picking units in playable map area, sure you have to use unit group variables since it would otherwise leak a unit group, but thats all. (or use set bj_wantDestroyGroup = true). There would be a difference on destructables however, since there are mostly over a thousand of them at the same time.

i mean add the dummy to group as it is created and remove when its dead. doesnt lag for me. pick all units in playable map area matching condition does
 
Level 5
Joined
Jun 25, 2008
Messages
118
thanks for looking at it eccho :) i will have another look tonight at my spell and see if i can fix things up. The thing is the damage can go down aswell as up, it should go down if the unit stays still and up if the unit moves, but it always goes down, whats more confusing is that the moment the overall damage reaches 0 or less the timer should be destroyed, so it should never heal. very confusing, im sure a solution will arrise eventually tho. I may just learn vJass and rewrite it in that, i do want to learn it anyway ^^
 
I just have my first problem...

  • Spell Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Touch of Nature
    • Actions
      • Set UnitVarAlly = (Target unit of ability being cast)
      • Countdown Timer - Start TimerAlly as a One-shot timer that will expire in 10.00 seconds
      • Unit - Add Armor Bonus to UnitVarAlly
      • Unit - Set level of Armor Bonus for UnitVarAlly to (Level of Touch of Nature for (Triggering unit))
      • Unit - Add Damage Bonus to UnitVarAlly
      • Unit - Set level of Damage Bonus for UnitVarAlly to (Level of Touch of Nature for (Triggering unit))
      • Unit - Set life of UnitVarAlly to ((Real((Integer((Life of UnitVarAlly))))) + (90.00 x (Real((Level of Touch of Nature for (Target unit of ability being cast))))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Percentage life of UnitVarAlly))) Less than or equal to 33
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to 33
            • Then - Actions
              • Unit - Set life of UnitVarAlly to 100.00%
              • Special Effect - Create a special effect attached to the origin of UnitVarAlly using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
        • Else - Actions
Ok the problem is that this don't trigger even if the life is 1% and chance 100%

  • If - Conditions
    • (Integer((Percentage life of UnitVarAlly))) Less than or equal to 33
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 33
        • Then - Actions
          • Unit - Set life of UnitVarAlly to 100.00%
          • Special Effect - Create a special effect attached to the origin of UnitVarAlly using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
    • Else - Actions
 
Level 5
Joined
Jun 25, 2008
Messages
118
@-BerZeKeR-: before i mention the second part: the line
  • Unit - Set life of UnitVarAlly to ((Real((Integer((Life of UnitVarAlly))))) + (90.00 x (Real((Level of Touch of Nature for (Target unit of ability being cast))))))
doesnt look right, you are healing the target by 90x(spell level) of the TARGET unit, surely this should be 90x(spell level) of the triggering unit?

The only thing id say about the second part is that, if the first part heals them (which i dont see how it does considering the above comment) then maybe their health is now above 33% and so the
  • If - Conditions
  • (Integer((Percentage life of UnitVarAlly))) Less than or equal to 33
is no longer applicable
 
Level 5
Joined
Jun 25, 2008
Messages
118
Lol it only took me like 2 hours to get down the basics of vJASS and recreate my spell in it >< but theres still problems with it lol. Hopefully easier to fix now tho :con: - ya' know, or harder :gg:

EDIT: hmm yet again i cant find a solution and in my eyes everything looks fine, don't know where else to post this to get feedback on anything i may have missed so here it is:
JASS:
scope BeeSwarm initializer Init

//=========================Bee Swarm by BlackShogun==========================//
//=================================Setup=====================================//

//spell rawcode
private constant function BeeSwarmRawCode takes nothing returns integer
    return 'A000'
endfunction

//dummy unit rawcode
private constant function BeeSwarmModel takes nothing returns integer
    return 'h000'
endfunction

//dummy unit model
private constant function BeeSwarmSFX takes nothing returns string
    return "Abilities\\Weapons\\CryptFiendMissile\\CryptFiendMissile.mdl"
endfunction

//base damage per second
private function BeeSwarmBaseDPS takes integer lvl returns real
    return 5.0*lvl
endfunction

//increase in damage per second for every second the target is moving
private function BeeSwarmIncDPS takes integer lvl returns real
    return 0.5*lvl
endfunction

//decrease in damage per second for every second the target is moving
private constant function BeeSwarmDecDPS takes nothing returns real
    return 0.5
endfunction

//duration of spell
private constant function BeeSwarmDur takes nothing returns real
    return 20.0
endfunction

//the movement and effects interval
private constant function BeeSwarmInterval takes nothing returns real
    return 0.03
endfunction

//distance moved by projectile each interval
private constant function BeeSwarmDist takes nothing returns real
    return 15.0
endfunction

//===============================EndSetup====================================//
//==================NOTE: DO NOT EDIT ANYTHING BEYOND HERE===================//

struct BeeSwarm_Data
    unit cast
    unit targ
    unit u
    real x
    real y
    real dmg
    real time
    effect sfx
endstruct

globals
    private timer t = CreateTimer()
    private BeeSwarm_Data array ar
    private integer total = 0
endglobals

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == BeeSwarmRawCode()
endfunction

private function Effects takes nothing returns nothing
    local BeeSwarm_Data dat
    local integer i=0
    local real x1=GetUnitX(dat.u)
    local real y1=GetUnitY(dat.u)
    local real x2=GetUnitX(dat.targ)
    local real y2=GetUnitY(dat.targ)
    local real a=Atan2(y2-y1, x2-x1)
    local real mx=BeeSwarmDist()*Cos(a)
    local real my=BeeSwarmDist()*Sin(a)
    local integer lvl=GetUnitAbilityLevel(dat.cast, BeeSwarmRawCode())
    
    loop
        exitwhen i>=total
        set dat=ar[i]
        
        if not IsUnitInRange(dat.u, dat.targ, 50) then
            call SetUnitX(dat.u, x1+mx)
            call SetUnitY(dat.u, y1+my)
            call SetUnitFacing(dat.u, 57.29583*a)
        endif
        
        if IsUnitInRange(dat.u, dat.targ, 50) and (not IsUnitType(dat.targ, UNIT_TYPE_DEAD)) then
            call SetUnitX(dat.u, x2)
            call SetUnitY(dat.u, y2)
            call UnitDamageTarget(dat.cast, dat.targ, (BeeSwarmBaseDPS(lvl)*BeeSwarmInterval())+dat.dmg, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
            if dat.x!=null then
                if IsUnitInRangeXY(dat.targ, dat.x, dat.y, 5) then
                    set dat.dmg=dat.dmg-(BeeSwarmDecDPS()*BeeSwarmInterval())
                else
                    set dat.dmg=dat.dmg+(BeeSwarmIncDPS(lvl)*BeeSwarmInterval())
                endif
            endif
            set dat.x=x2
            set dat.y=y2
        endif
        
        if (BeeSwarmBaseDPS(lvl)+dat.dmg<=0) or (dat.time>=BeeSwarmDur()) or (IsUnitInRange(dat.u, dat.targ, 50) and IsUnitType(dat.targ, UNIT_TYPE_DEAD)) then
            call DestroyEffect(dat.sfx)
            call RemoveUnit(dat.u)
            set ar[i]=ar[total-1]
            set total=total-1
            call dat.destroy()
        endif
        
        set dat.time=dat.time+(1*BeeSwarmInterval())
        set i=i+1
    endloop
    
    if total==0 then
        call PauseTimer(t)
    endif
endfunction

private function Actions takes nothing returns BeeSwarm_Data
    local BeeSwarm_Data dat=BeeSwarm_Data.create()
    local player p
    local real a
    
    set dat.cast=GetTriggerUnit()
    set p = GetOwningPlayer(dat.cast)
    set dat.targ=GetSpellTargetUnit()
    set a=57.29583*Atan2(GetUnitY(dat.targ)-GetUnitY(dat.cast), GetUnitX(dat.targ)-GetUnitX(dat.cast))
    set dat.u=CreateUnit(p, BeeSwarmModel(), GetUnitX(dat.cast), GetUnitY(dat.cast), a)
    set dat.sfx=AddSpecialEffectTarget(BeeSwarmSFX(), dat.u, "chest")
    set dat.dmg=0
    set dat.time=0
    set p=null
    
    if total==0 then
        call TimerStart(t, BeeSwarmInterval(), true, function Effects)
    endif
    
    set total=total+1
    set ar[total-1]=dat
    
    return dat
endfunction

private function Init takes nothing returns nothing
    local trigger T = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(T, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(T, function Actions)
    call TriggerAddCondition(T, Condition(function Conditions))
endfunction

endscope
I'm guessing it would help if i explain the spell so: Its based on channel and is single target. Creates dummy unit that acts as projectile homing in on the target unit. Once it reaches the target it deals damage over time. When the target is moving the periodic damage increases, when the target stands still the periodic damage decreases, lasts 20 seconds or until damage per second drops to 0.

EDIT: Attachment removed.
 
Last edited:
Level 12
Joined
Apr 27, 2008
Messages
1,228
I got an interesting idea :)
And I reached my first problem - tree fading. Unfortunately there is no way to fade one, only with triggers, without editing it's model.
 
Status
Not open for further replies.
Top