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

[Snippet] DummySpellcast

JASS:
    //=======================================================================
        private function FuuuILTER takes nothing returns boolean
            call GroupAddUnit(g,GetFilterUnit())
            return false
        endfunction
        
    //=======================================================================
        private function CreateTargetGroup takes real x, real y, real r returns nothing
            call GroupEnumUnitsInRange(g,x,y,r,f)
        endfunction
        
    //=======================================================================
        private module zapdos
            private static method onInit takes nothing returns nothing
                set f=Filter(function FuuuILTER)
            endmethod
        endmodule

You don't need any of this.
GroupEnum puts the units in the group, so that filter is not required. (use null)

Oh and change articuno to moltres :c
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
The reason channeling spells are both useless and idiotic to do on a dummy is because dummies are meant for effects.

Consider this situation. You make a dummy cast a spell after the user runs a spell (why not put the channeling on the user? Who the hell knows >.>). Now you want to cast a spell, but oh no, your channeling is running for 30 seconds. Boom, your entire dummy is now disabled for the next 30 seconds, gg.

You decide to create a queue of dummies to handle the idiotic pointless channeling. Now you have many dummies on the map and you can cast channeling spells, but why? You can easily put the channeling on the unit that is actually casting the spell or on a timer as part of the spell. What's the point of channeling? Who knows.



As it stands, this is currently broken on channeling and I've yet to see any point to ever using channeling on a dummy when timers or putting the channeling on the actual casting unit will suffice without the need for a queue of dummies.
 
Level 7
Joined
Apr 27, 2011
Messages
272
Consider this situation. You make a dummy cast a spell after the user runs a spell (why not put the channeling on the user? Who the hell knows >.>). Now you want to cast a spell, but oh no, your channeling is running for 30 seconds. Boom, your entire dummy is now disabled for the next 30 seconds, gg.

because channeling spells are sometimes annoying for fast-paced games. Don't you think? And what if someone wants to cast a channeling spell but does not want the casting unit to remain pinned on the ground, channeling? And what about that disabled dummy for 30 sec? Who would channel a spell in that duration anyway? be realistic like 0.75-10 sec. man. I for one has a use for channeling spells like dummy casting rain of fire for instance :D i'd rather dummy cast that spell rather than coding it in scratch.

and if someone really wants to dummy cast for 30 sec... that wouldn't even affect the system that much? :O
 
Last edited:
then why channel? that's the purpose of channeling anyway, a spell which you need to focus in order to have its effect... and what's unrealistic with a 30 second channel???

also in most good/advanced map, long-term spells [like ur example, rain of fire] are almost always coded because they need damage to be controllable... so they don't use a dummy to channel spells like RoF when they want it to be instant cast for the user... and for those reasons, I made custom systems like Meteor and Nova...
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
also in most good/advanced map, long-term spells [like ur example, rain of fire] are almost always coded because they need damage to be controllable... so they don't use a dummy to channel spells like RoF when they want it to be instant cast for the user... and for those reasons, I made custom systems like Meteor and Nova...

You don't seem to get that channel breaks this system until you account for it -.-. You can say all you want that it doesn't, but it does >.>. You can not cast other spells while channeling. You can say channel is useful (even though it isn't), but it still breaks your entire thing regardless, unless you like a system that things can disable for however long they want. I even told you how to account for this.
 
HMMMM

ur module is named moltress but you do: implement moltres
JASS:
//=======================================================================
        private module moltress
            private static method onInit takes nothing returns nothing
                call TriggerAddCondition(DEALLOCATOR,Condition(function DeallocationProcess))
            endmethod
        endmodule
        
...

//===========================================================================
    private struct s extends array
        implement moltres//you lack an s here
        
    endstruct
    
//===========================================================================
 
Level 7
Joined
Apr 27, 2011
Messages
272
I tested the separated version vs the original version... it seems that using a "UnitRemoveAbility" function right after issuing an order is slower compared to an event driven deallocation (my original method). so i think i'll be leaving the library as is and intact. :D

This one is slower (separated lib)
JASS:
	function CastOnTargetLvl takes unit u1, unit u2, integer id, integer oid, integer lvl returns nothing
		//! runtextmacro DummyCasterUtils__AddSpellLeveled("u1","id","lvl")
		//! runtextmacro DummyCasterUtils__SetUnitXY("u1","GetUnitX(u2)","GetUnitY(u2)")
		call IssueTargetOrderById(u1,oid,u2)
        call UnitRemoveAbility(u1,id) //<- this thing is slower... compared to the deallocation method i use... (which relies on a trigger executes via the EVENT_UNIT_SPELL_ENDCAST event)
	endfunction
Compared to this (the intact and original one)
JASS:
	//=======================================================================
		private function DeallocationProcess takes nothing returns boolean
                 // the lines here below execute before the "UnitRemoveAbility" above the first example
                 // NOTE: they are event driven.
			set cs=GetTriggerUnit()
			set rcs[w]=cs
			set w=w+1
			call UnitRemoveAbility(cs,GetSpellAbilityId())
			call SetUnitOwner(cs,DEFAULT_OWNER,false)
			return false
		endfunction
	
	//=======================================================================
		private module moltres
			private static method onInit takes nothing returns nothing
				call TriggerAddCondition(DEALLOCATOR,Condition(function DeallocationProcess)) 
			endmethod
		endmodule
i tested it by replacing the "UnitRemoveAbility" functions on both libs by "BJDebugMsg" and assuming that the first one who executes is faster... and guess what that's the result, the automated deallocation wins.
 
Level 5
Joined
Dec 12, 2011
Messages
116
You guys are discussing the scripts, I'm here just for a tiny help:

It's written "-This library's purpose is to make dummycasting more easier." at the beginning of the documentation.

Change "more easier" to "easier". (=
 
Level 6
Joined
Jun 20, 2011
Messages
249
Well first of all xecast is broken (lol)
second this aims to support channeling dummies
If I were a mod i would have already graveyard'd this, and i think Nes did a good job explaining why
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Actually, the use of multiple dummies can be a good thing. It can support spell effects like chain lightning (move the dummy). Channeling can also be there for spell effects.


Think of it like this... you do an attack and it creates various lightning rods everywhere (these lightning rods could be dummy units o-o). The lightning rods then shoot off lightning via chain lightning spell : ).


Now... my only thoughts at this point are applying models to the dummy units via attachments (like making it look like a peasant model by attaching peasant model to chest) and so on. Essentially, I think that is the way that dummy casters are going now. I was sort of doing this with the Particle system I was doing, but it can be taken further ; ). They can be used for projectiles or anything really : D.


I think that this should be a standalone resource rather than a huge thing part of a huge caster lib (even if that caster lib can have different features enabled/disabled)). Splitting it up into many smaller resources just seems like a smarter way to go.



So no longer think of DummyCaster as the simple buffer applier. Now think of it as anything. There should also be a constant dummy caster for simple buff application. This could use the general Dummy library. In fact, it should go Dummy (for general stuff) and then DummyCaster : D.
 
Level 7
Joined
Apr 27, 2011
Messages
272
hmmm... the sole purpose of this system while i was making it is just for dummy casting stuff (without attaching fx to the dummy caster)

but for the lightning spell issue, i'll be adding:
> "AllocateCasterEx" -> allows the user to set x,y,z coordinates
> "EnableAutoPlacement" -> enables/disables the auto placement of dummy casters.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
Alain.Mark said:
my looping code is only for multicasting instant spells. (it works)

btw what i meant earlier was my code only uses one dummy caster when casting MULTIPLE times (for instant spells) and recycles dummy casters when casting MULTIPLE times (for channeled/timed spells). try it. it is faster and more efficient since it doesn't use timers and attaching. i meant my post earlier specifically for my libs "CastOnAreaLvl" function.

I dont think so, the 'w' is always 0 at first so if multiple times at first then it will create also multiple times...
The caster also is at the location of the target, what if the user wants it as a
missile unit-target-spell, from angle of caster and target, surely the system
doesnt support that...

JASS:
if(w==0)then
   //put debug messages and see what I mean...
   set cs=CreateUnit(pl,DUMMY_CASTER_ID,0,0,0)
.......

I said it coz Ive tested it...
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
yes really...see how many fruit salad it created by pressing it fast...

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    local unit d=AllocateCaster(Player(0))
    call CastOnArea(d,0,0,1000.00,'Aenr',OrderId("entanglingroots"),false)
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call Cheat("iseedeadpeople")
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Untitled_Trigger_001, Player(0) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
 

Attachments

  • ck.jpg
    ck.jpg
    77.4 KB · Views: 108
Level 17
Joined
Apr 27, 2008
Messages
2,455
Hmm, so it is "lot of" or "few" ?

That's a big difference.
So far it seems that it doesn't work with some special abilities which don't require a cast, nor mana, but not really with "spells".
Since this library is for "spells" i don't see the issue, until you provide me a "spell" where the endcast event never fire.
Now, pointing that in the comments of the library wouldn't hurt :)
 
Top