System Fountain

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Do you love fountain?
Some may be say no, but for me, yes. :)

Well..
fountainw.jpg

JASS:
             _________   _______   _     _   ___    __   _______     ___      ______   ___    __  
  |  ______| |  ___  | | |   | | |   \  |  | |       |   / _ \    |__  __| |   \  |  | 
  | |____    | |   | | | |   | | |  | \ |  | |__   __|  / /_\ \     |  |   |  | \ |  | 
  |  ____|   | |   | | | |   | | |  |\ \|  |    | |    / _____ \    |  |   |  |\ \|  |  
  | |        | |___| | \ \___/ / |  | \ \  |    | |   / /     \ \  _|  |_  |  | \ \  |    
  |_|        |_______|  \_____/  |__|  \__ |    |_|  /_/       \_\|______| |__|  \__ |    
  
  *Jass tag is not working well, so the big "FOUNTAIN" does not display properly.

  V1 by kingking
  
  This system allows you to create mass types fountains.
  
  How to use?
  System provides 'fountain' type variable
  
  List of Functions provided :
  CreateFountain() -> fountain
  SetFountainModel(fountain, string path of model)
  SetFountainPos(fountain, real x, real y)
  SetFountainJumpSpeed(fountain, real spd)
  SetFountainJumpRange(fountain,real range)
  SetFountainAngle(fountain, real starting angle)
  SetFountainSpinSpeed(fountain, real spin speed) Put 0 if you dont want it spins.
  SetFountainHeight(fountain, real max height)
  FountainStart(fountain)
  DestroyFountain(fountain)


Library Here :
JASS:
library Fountain
   
    globals
        private constant real FOUNTAIN_PERIOD = .5
        private constant real DUMMY_SLIDE_PERIOD = .03125
        private constant integer DUMMY_ID = 'h000'
    endglobals

    private struct DummyData
        real x
        real y
        real spd
        real angle
        real cos
        real sin
        real totaldis
        real dis
        real height
        effect e
        unit dummy
        integer ticks
        
        method onDestroy takes nothing returns nothing
            set .dis = 0.
            call DestroyEffect(.e)
            call KillUnit(.dummy)
        endmethod
    endstruct
    
    struct fountain
        real x
        real y
        real spd
        real angle
        real anglerate
        real height
        string path
        boolean stop = false
        integer ticks
        
        method onDestroy takes nothing returns nothing
            set .x = 0.
            set .y = 0.
            set .spd = 0.
            set .angle = 0.
            set .anglerate = 0.
            set .path = null
            set .stop = false
            set .ticks = 0
            set .height = 0.
        endmethod
    endstruct
    
    globals//Struct Stack?
        private timer FountainTimer = CreateTimer()
        private fountain array FountainStack
        private integer FountainCount = 0
        private timer SlideTimer = CreateTimer()
        private DummyData array SlideStack
        private integer SlideCount = 0
    endglobals

    globals//locals
        private integer FountainLoop
        private fountain CurrentFountain
        private integer SlideLoop
        private DummyData CurrentDummy
        private DummyData NewDummy
    endglobals

    private function SlideDummies takes nothing returns nothing
        set SlideLoop = SlideCount
        loop
        exitwhen SlideLoop == 0
            set CurrentDummy = SlideStack[SlideLoop]
            if CurrentDummy.ticks > 0 then
                set CurrentDummy.ticks = CurrentDummy.ticks - 1
                set CurrentDummy.x = CurrentDummy.x + CurrentDummy.cos
                set CurrentDummy.y = CurrentDummy.y + CurrentDummy.sin
                set CurrentDummy.dis = CurrentDummy.dis + CurrentDummy.spd
                call SetUnitPosition(CurrentDummy.dummy,CurrentDummy.x,CurrentDummy.y)
                call SetUnitFlyHeight(CurrentDummy.dummy,4 * CurrentDummy.height * CurrentDummy.dis * (CurrentDummy.totaldis - CurrentDummy.dis) / (CurrentDummy.totaldis * CurrentDummy.totaldis),0.)
            else
                call CurrentDummy.destroy()
                set SlideStack[SlideLoop] = SlideStack[SlideCount]
                set SlideCount = SlideCount - 1
            endif
            set SlideLoop = SlideLoop - 1
        endloop
        if SlideCount == 0 then
            call PauseTimer(SlideTimer)
        endif
    endfunction
    
    private function CreateDummies takes nothing returns nothing
        set FountainLoop = FountainCount
        loop
        exitwhen FountainLoop == 0
            set CurrentFountain = FountainStack[FountainLoop]
            set CurrentFountain.angle = CurrentFountain.angle + CurrentFountain.anglerate
            if CurrentFountain.angle > 360. then
                set CurrentFountain.angle = 0.
            endif
            if not CurrentFountain.stop then
                set NewDummy = DummyData.create()
                set NewDummy.x = CurrentFountain.x
                set NewDummy.y = CurrentFountain.y
                set NewDummy.spd = CurrentFountain.spd
                set NewDummy.angle = CurrentFountain.angle
                set NewDummy.cos = NewDummy.spd * Cos(NewDummy.angle * .0175)
                set NewDummy.sin = NewDummy.spd * Sin(NewDummy.angle * .0175)
                set NewDummy.ticks = CurrentFountain.ticks
                set NewDummy.totaldis = NewDummy.spd * NewDummy.ticks
                set NewDummy.height = CurrentFountain.height
                set NewDummy.dummy = CreateUnit(Player(15),DUMMY_ID,NewDummy.x,NewDummy.y,NewDummy.angle)
                set NewDummy.e = AddSpecialEffectTarget(CurrentFountain.path,NewDummy.dummy,"origin")
                set SlideCount = SlideCount + 1
                set SlideStack[SlideCount] = NewDummy
                if SlideCount == 1 then
                    call TimerStart(SlideTimer,DUMMY_SLIDE_PERIOD,true,function SlideDummies)
                endif
            else
                call CurrentFountain.destroy()
                set FountainStack[FountainLoop] = FountainStack[FountainCount]
                set FountainCount = FountainCount - 1
            endif
            set FountainLoop = FountainLoop - 1
        endloop
        if FountainCount == 0 then
            call PauseTimer(FountainTimer)
        endif
    endfunction
    
    function CreateFountain takes nothing returns fountain
        return fountain.create()
    endfunction
    
    function SetFountainModel takes fountain d, string path returns nothing
        set d.path = path
    endfunction
    
    function SetFountainPos takes fountain d, real x, real y returns nothing
        set d.x = x
        set d.y = y
    endfunction
    
    function SetFountainJumpSpeed takes fountain d, real spd returns nothing
        set d.spd = spd
    endfunction
    
    function SetFountainJumpRange takes fountain d, real range returns nothing
        if d.spd != 0 then //if d.spd = 0, then d.ticks = infinity. <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />
            set d.ticks = R2I(range / d.spd)
        endif
    endfunction
    
    function SetFountainAngle takes fountain d, real angle returns nothing
        set d.angle = angle
    endfunction
    
    function SetFountainSpinSpeed takes fountain d, real spd returns nothing
        set d.anglerate = spd
    endfunction
    
    function SetFountainHeight takes fountain d, real h returns nothing
        set d.height = h
    endfunction
    
    function FountainStart takes fountain d returns nothing
        set FountainCount = FountainCount + 1
        set FountainStack[FountainCount] = d
        if FountainCount == 1 then
            call TimerStart(FountainTimer,FOUNTAIN_PERIOD,true,function CreateDummies)
        endif
    endfunction
    
    function DestroyFountain takes fountain d returns nothing
        set d.stop = true
    endfunction
endlibrary
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Your fountain of fire spell lagged terribly for me, I can only assume this shall do the same.
Do you test the new version? I changed the model... So it will be fine now.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Your description isn't descriping how this 'fountain' is function.
It is just creating a unit there and eye-candy around them? only?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Quit using that convention without knowing what it means.
And this doesn't seem useful. Am I wrong?

Just some note for myself.
Well, this is quite nice when you use it in RPG IMO.

Why doesn't it heal? o_O
You need to make healing trigger yourself. This system only provide the graphic effect. Adding heal effect will complicating the system. If many of other users demand me for heal effect, I will make an add-on. :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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