1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. The Results have come out of the old ARENA oven. Check out who won the 30th Texturing Contest!
    Dismiss Notice
  4. Hey guys, we've posted the Results for the 30th Modeling Contest. Check them out!
    Dismiss Notice
  5. The 15th Mini-Mapping Contest came to an end. The Secrets of Warcraft 3 are soon to be revealed! Come and vote in the public poll for your favorite maps.
    Dismiss Notice
  6. The 12th incarnation of the Music Contest is LIVE! The theme is Synthwave. Knight Rider needs a song to listen to on his journey. You should definitely have some fun with this theme!
    Dismiss Notice
  7. Join other hivers in a friendly concept-art contest. The contestants have to create a genie coming out of its container. We wish you the best of luck!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Arcing Loot

Submitted by Chaosy
This bundle is marked as pending. It has not been reviewed by a staff member yet.
[​IMG]
GIF by @Killcide

Based on Zephyr Contest #14 - Unique Summoning along with ArcingLoot which I wrote in Zinc a few years back.

Uses my Recipe system and ArcingTextTag by Maker, converted to wurst by me.


Put items in the cauldron and press esc to make it it spit out a crafted item!​

code

Code (WurstScript):

package ArcingLoot

import LinkedListModule
import TimerUtils
import Fx

constant real arc          = 75 //modifies the  arcing shape
constant real arcHeight    = 350 //how high the arc reach at its peak
constant real travelTime   = 0.9 //time it takes for the arc to reach destination
constant real convertArc   = arc / 100.00 // do not touch
constant string sfx        = "Objects\\InventoryItems\\TreasureChest\\treasurechest.mdl" //effect, the item chest in this case
constant real loopSpeed    = 0.03 //how often the system runs its loop. Higher value equals better perfomance

constant location loc = Location(0,0)

function vec2.getZ() returns real
    MoveLocation(loc, this.x, this.y)
    return GetLocationZ(loc)

public class ArcingItem
    use LinkedListModule

    static timer t

    integer id

    Fx fx
    angle angle

    real distance
    real maxDistance
    real arc
    real speed

    effect e

    vec2 pos
    vec2 destination
    construct(integer itemId, vec2 start, vec2 dest)
        pos          = start
        fx           = new Fx(pos, angle(0), sfx)
        angle        = pos.angleTo(dest)
        distance     = pos.distanceTo(dest)
        maxDistance  = distance
        speed        = distance / (travelTime / loopSpeed)
        destination  = dest
        arc          = distance * convertArc

        id           = itemId

        e = fx.getDummy().addEffect("Abilities\\Spells\\NightElf\\Rejuvenation\\RejuvenationTarget.mdl", "chest")

        if(t == null)
            getTimer()
            ..startPeriodic(loopSpeed, function ArcingItem.onLoop)

    static function onLoop()
        thistype current = ArcingItem.first
        while(current != null)
            current.update()
            current = current.next
   
    function update()
        pos.x = pos.x + speed * Cos(angle.radians)
        pos.y = pos.y + speed * Sin(angle.radians)

        distance = pos.distanceTo(destination)

        real one     = (4.00 * arc) / maxDistance
        real two     = maxDistance - distance
        real three   = distance / maxDistance
        real four    = pos.getZ()

        real height  = (one * two * three) + (four)

        fx.getDummy().setPosFly(vec3(pos.x, pos.y, height))
        if(height <= 0)
            e.destr()
            createItem(id, pos)
            destroy fx
            destroy this
 
Code (WurstScript):

package ArcingText

import LinkedListModule
import TimerUtils

// Arcing Text Tag v1.0.0.3 by Maker
// Converted to wurst by Chaosy

constant    real    SIZE_MIN        = 0.018         // Minimum size of text
constant    real    SIZE_BONUS      = 0.012         // Text size increase
constant    real    TIME_LIFE       = 1.0           // How long the text lasts
constant    real    TIME_FADE       = 0.8           // When does the text start to fade
constant    real    Z_OFFSET        = 50            // Height above unit
constant    real    Z_OFFSET_BON    = 50            // How much extra height the text gains
constant    real    VELOCITY        = 2             // How fast the text move in x/y plane

timer   TMR            = getTimer()

public class ArcingTextTag
    use LinkedListModule

    private texttag tt
    private real as         // angle, sin component
    private real ac         // angle, cos component
    private real ah         // arc height
    private real t          // time
    private vec3 pos
    private string s        // text

    private function update()
        real p
        p = Sin(bj_PI * t)
        t = t - 0.03125
        pos.x = pos.x + ac
        pos.y = pos.y + as
        pos.z = Z_OFFSET + Z_OFFSET_BON * p
       
        tt.setPos(pos)
        tt.setText(s, (SIZE_MIN + SIZE_BONUS * p) * 434.78)
       
        if t <= 0
            destroy this
            if this.next == null
                TMR.pause()
           
    private static function onLoop()
        thistype current = ArcingTextTag.first
        while(current != null)
            current.update()
            current = current.next


    construct(string msg, unit u)
        real a = GetRandomReal(0, 2*bj_PI)

        s = msg
        pos.x = GetUnitX(u)
        pos.y = GetUnitY(u)
        t = TIME_LIFE
        as = Sin(a) * VELOCITY
        ac = Cos(a) * VELOCITY
        ah = 0.
       
        if IsUnitVisible(u, GetLocalPlayer())
            tt = CreateTextTag()
            ..setPermanent(false)
            ..setLifespan(TIME_LIFE)
            ..setFadepoint(TIME_FADE)
            ..setText(s, SIZE_MIN)
            ..setPos(pos)

       
        if ArcingTextTag.first == this
            TMR.startPeriodic(0.03125, function ArcingTextTag.onLoop)

 


Demo


Code (WurstScript):

package demo

import ObjectIdGenerator
import ChannelAbilityPreset
import UnitObjEditing
import ObjectIds

import Crafting
import ArcingLoot
import ArcingText

string onCraftEffect = "Abilities\\Spells\\Other\\Transmute\\GoldBottleMissile.mdl"

integer testUnit = compiletime(UNIT_ID_GEN.next())

@compiletime function generate()
    new UnitDefinition(testUnit, 'hkni')
    ..setName("Witch's Cauldron")
    ..setModelFile("Doodads\\LordaeronSummer\\Props\\CauldronWithHeads\\CauldronWithHeads.mdl")
    ..setHitPointsMaximumBase(1)
    ..setMovementType(MovementType.None)
    ..setSpeedBase(0)
    ..setNormalAbilities("AInv,Avul")
    ..setArmorType(ArmorType.Unarmored)
    ..setDefenseBase(0)
    ..setAttack1DamageBase(0)
    ..setAttack1DamageNumberofDice(0)
    ..setAttack1DamageSidesperDie(0)
    ..setAttack1AttackType(AttackType.Unknown)
    ..setUnitSoundSet("")
    ..setScalingValue(1.5)
    ..setSightRadiusDay(0)
    ..setSightRadiusNight(0)

unit cauldron

constant string yellow = "|c00FFFF00"
constant string blue   = "|c007EBFF1"

init
    // Create recipe and add components
    new ItemRecipe('shar')
    ..addComponent('whwd', 2)
    ..addComponent('pghe', 1)
    ..addComponent('phlt', 1)

    // Crafting Demo
    cauldron = createUnit(players[0], testUnit, vec2(0, 0), angle(0))
    createUnit(players[0], 'Hpal', vec2(0, 0), angle(0))
   
    // try to craft on esc press

    CreateTrigger()
    ..registerPlayerEvent(players[0], EVENT_PLAYER_END_CINEMATIC)
    ..addAction() ->
        new ArcingTextTag("|c007EBFF1" + GetUnitName(cauldron) + "|r is Crafting", cauldron)
        while(cauldron.canCraft())
            addEffect(onCraftEffect, cauldron.getPos()).destr()
            let recipes = cauldron.craft()
            for r in recipes
                let id = r.craftable
                cauldron.removeRecipeCompnents(r)
                new ArcingItem(id, cauldron.getPos(), cauldron.getPos().polarOffset(angle(GetRandomDirectionDeg()), GetRandomReal(200, 400)))
                break
               
        print("No more items can be crafted")

    CreateTrigger()
    ..registerAnyUnitEvent(EVENT_PLAYER_UNIT_PICKUP_ITEM)
    ..addAction() ->
        if(GetManipulatingUnit() == cauldron)
            item i = GetManipulatedItem()
            new ArcingTextTag(blue + "Added: " + yellow + i.getName(), cauldron)
Contents

Arcing Loot (Map)

  1. Diegoit

    Diegoit

    Joined:
    Apr 8, 2017
    Messages:
    1,195
    Resources:
    1
    Models:
    1
    Resources:
    1
    Waaaaa, what a good idea for a better Drop system :D, that effect can be changed?
     
  2. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,575
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    Uhhh.. I should have added that to the config.
    I'll try to remember to update it soon TM.
     
  3. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,259
    Resources:
    6
    Models:
    1
    Icons:
    1
    Spells:
    3
    JASS:
    1
    Resources:
    6
    A bit of info on how to activate the Arcing Loot is appreciated. Currently, one has to figure out how many of these things are required in the test map without looking at the demo code.
     
    Last edited: Jul 19, 2019 at 4:19 AM
  4. BossGengar

    BossGengar

    Joined:
    Apr 18, 2016
    Messages:
    409
    Resources:
    8
    Models:
    8
    Resources:
    8
    This reminds me of Diablo III! Cool!
     
  5. doomhammer99

    doomhammer99

    Joined:
    Dec 5, 2011
    Messages:
    319
    Resources:
    5
    Models:
    1
    Spells:
    3
    Tutorials:
    1
    Resources:
    5
    Perfect for RPGs, well done!
     
  6. Oh this is so sweet... flying coins and items. Gonna test!