• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Custom MeatHook

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi! Thanks for reading.

I've wanted to make a Hook like the one Link has in Zelda 64, but a bit different.

I've seen in Pudge Wars they have the "Attachment" Hook Ability, (i forgot the exact name) wich can be bought, and it Moves the Pudge to the target. Also, the common Hook targets the mines in the floor, i need something similar.

I've searched in the Spells sections but they all are for damage and bringing targets to you, and not you to them, besides, right now i'm not in the computer where i work with the map, o si haven't ben able to test them, but i'm omw there.

I need a small range Hook (800) able to:

1) Ignore any unavailable target (Allies, enemies, rocks, other heros, neutrals, etc.)
2) Move THE HERO only to specific targets (Lets say: Only to Ashenvale trees, or targets with an specific ID)
3) Able to Hook specific ITEMS and bring them to the hero.
3) Deal 0 damage.
4) Only one lvl.
5) Of course, the special hook effect :)
6) Inside spellbook

I guess the system would have to detect if the hook is reaching an Available/Unavailable target, and follow the actions as supossed (Come back, or Move hero to point, or bring item in point to hero)

BTW, I don't know A LOOOT of Jass/Variables, but i'm slowly getting into it. (So, please, be reasonable and try to give an understandable answer for uss, the noobs xD)

I'd like to know what's possible, and what isn't, and how can i do it, modifying some existing hook, or making another. Thanks for reading!
 
Level 9
Joined
Aug 2, 2008
Messages
219
Ok i think i created something that fits your requirements.
The spell is coded in Jass, its MUI and most likely leakless.

As you were not really precise on the specific units and items i used my standard unit filter and the spell picks up any item. If tell me which things should be filtered and which not i can do the adjustments.

Known Bug
The spell adds items to a units inventory, so when a non-hero unit hooks an item (most likely a tome) which changes a hero attribute ( like the level or strength, etc. ) the game will crash. You should make sure that you only add this ability to heros.
Further i give credits to PeeKay since i used his Hook Icon

I'd like to post the spell code here but it turned out that coding this spell in plain jass requires more than 500 lines of code, so everyone how wants to take a look at the code withoud downloading this might follow this link to my Paste bin
 

Attachments

  • hook v0.1.w3x
    30.7 KB · Views: 65
Level 20
Joined
Jul 14, 2011
Messages
3,213
I'll test and report

Edit: Report:

- The Demo map works GREAT, its AWESOME, OMG I LOVE IT...

Two things i don't like:

1) The terrain modification/slam through Hooks path
2) Didn't worked when Copy/paste to mine. I followed instructions, imported the ability, then the Dummy, then the Trigger. My unit does the animation, and the terrain deformation, but hook doesn't appear, neither it's effects. Also, I don't find where to set the specific unit reverse-hook (It will be a wood log, like Pudge War) neither the Item hook (One or two in the whole rpg)

Any help on those? :D
 
Last edited:
Level 9
Joined
Aug 2, 2008
Messages
219
The terrain deform is caused because i choosed the Chieftains Shockwave as basic spell. If you want to get rid of the terrain deform you could choose Carrion Swarm as basic spell. In your map copy the default Carrion Swarm and remove all effects (visual effects, damage, etc ). Then you apply the icon for the spell and the tool tips as well as the cooldown and the manacosts and don't forget to set Targets to ground and item. If you did that succesfully you can delete the old hook ability you copied from my map.

The hook effect might not trigger because you forgot to update the rawcodes or you did not create the required globals.

To update the rawcodes go to the object editor and press STRG+D so it will show you the object ID's. Then select the dummy unit, it will now look like "????:hfoo hook dummy" then go to the trigger editor and replace the hkdm in the function TNT_HOOK_DID with the first four letters of the dummys object ID (in this case the ????).
Then do the same again with the ability, replace the Hook with the function TNT_HOOK_SID with the first four letters of the spells object ID. When replacing the object ID's make sure you dont remove the ' !

Fixing the globals thing is easier. In the main editor window go File -> Preferences and make sure you checked "Automatically create unknown variables when pasting trigger" (or whatever blizzard called it). Then just copy the HookGlobals trigger from the test map to your map.

If its still resisting to work upload your map to your paste bin and send me the link via PM and i'll do the importing.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Thanks! Its the first time i mess with objets ID's.

OMG:

The unit throws the hook, and the HookDummy unit is displayed. The sound is great, animations are great, and terrain isn't deformated, BUT:

2) My terrain isn't straigh. Sometimes hook comes out from the unit feets, or head, or overhead, or way overhead (like 100 heith, as ussual flying unit). I changed the Heigh value and still the heigh of the dummy unit changes by random values, based on terrain, i think.
4) I don't know where do I set the units wich I get moved too if hooked.
5) I want the hook to return back if it hits any targets that's not an item, or the pre-set tree i want to be moved to when hooked to it.

I know i'm asking too much, but:

6) Is there a way to make the hook not start from position of unit (Since the model of the hook unit is placed over the Hero and looks bad) but with a bit of offset to where tue unit is facing? (So the effect looks more realistic?.

The Pre-set target to get attached to is is an specific tree (ID's).

This is because Hook could go through trees or walls and get items on the other sides. Hook should only get items in a freepath, and the unit should only be attached to an specific tree, as i said.

FOUND A BUG:

When you get a powerup, the position of the powerup when it's picked gets saved, or remains in the same position. Somehow if you get a powerup with the hook, you can get it all the times you want just by hooking where the PowerUp was when you picked it. Same happens with the treelogs of the demo map. You can pick them, and if you shoot the same position where you picked it, you will get it again.

EDIT: I Found that new PowerUps aren't created. It's the same PowerUp (AutoUsableItem, like Runes) that moves to wherever you picked it via Hook. Being like this, i guess that using "Destroy Las Picked Item" would work, with the condition of the "Las Picked Item" being a PowerUp :)

2EDIT. Using "Remove Last Picked Item" doesn't remove the item. Bug continues, and Hook continues making the unit able to pick Invisible PowerUps, wich remains where they where picked. Using "Hide" doesn't work either. Removing "Last dropped item" doesn't work either. Ehm... i think anything works, and I don't know how to mess with JASS to prevent this...

Thanks for everything BTW!
 
Last edited:
Level 4
Joined
Feb 17, 2007
Messages
121
I have a question going to the hook map. When you hook the bundle of lumber, and stay in the same area, and hook in different directions without moving u get lumber over and over?

opps didnt see the msg ^^^^ above me ^^^ but thats what i meant
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Edit: Yeah :)

I'll guest we just wait for Thanathos to come back and helps us with this =/ I was cheking the JASS code, but undertood almost none of it :)
 
Level 9
Joined
Aug 2, 2008
Messages
219
To 2)
Well i guess the terrain problem is not really solveable. Although i could make the hook stay in the same height while its moving (lets say a height of 100) it is possible that the hook "goes through" terrain which is higher than 100.
If you want to change the height of the dummy unit (or any other flying unit) you need to adjust the field Minimal Flying Height to decrease a units actual flying height, since the actual flying height cannot drop below the minimal height.

To 4) You left out 3 xD
If you want to specify which units can be hooked in particular you need to go to the function TNT_HOOK_UnitFilter. For example if you want the spell to affect only heros you must check if the unit is really a hereo.

JASS:
function TNT_HOOK_UnitFilter takes nothing returns boolean

    local unit u = GetFilterUnit()
    local player p = xxGetTempPlayer()
    
    if IsUnitEnemy(u, p ) and not ( GetWidgetLife(u) < 0.405 or IsUnitType(u, UNIT_TYPE_STRUCTURE) or IsUnitType(u, UNIT_TYPE_FLYING) or IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) or IsUnitType(u, UNIT_TYPE_ANCIENT) or IsUnitInvisible(u, p ) ) then

        //Add an if-block with your specifications here
        if IsUnitType( u, UNIT_TYPE_HERO ) then 
             call TNT_HOOK_SetTempUnit(u)
        endif

    endif

    set u = null
    set p = null
    return false
    
endfunction
To 5)
Actually it is possible to make the hook return if it hits any kind of obstacle (An obstacle is everything which prevents ground units to walk over it). So the hook will return if it hits a tree, a wall or any ground unit which is not specified as a valid target.

To 6)
Very easy to install, will be included in hook v0.2.

Spartipilo said:
The Pre-set target to get attached to is is an specific tree (ID's).
Sorry i dont understand...


Ultimately that stupid bug. It appears this is a blizzard side bug since the powerups stay on the map even if you order a unit to pick it up regularly (Try picking up some lumber and then cast the hook in the direction where the lumber was.)
However i guess i figured out a way to eliminate that bug. First i changed the spell so it wont detect any invisible item (which i should have done earlier). Then you need to add a simple trigger to your map which hides a powerup when it is acquired by a unit. I think that should solve it.
  • PowerUpFix
    • Event
      • Unit - A unit acquires an Item
    • Condition
      • ((Item-type of (Item being manipulated)) is PowerUp ) equals True
    • Action
      • Item - Hide (Item being manipulated)
The trigger text might be a bit inexact since i had to translate it but it should be sufficient.
I'll update to Hook v0.2 when you tell me how i should handle your requests.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I Got It!

Base the ability in a Unit-Selection one (Chain Lightning, Heal, etc.), and targets allowed are Items and Wards. Flying height, as you said, is easy to do modifying those values.
That way (IF) Target selected is an item, (THEN) get SELECTED TARGET to the CASTER, (ELSE), if Selected target is a ward, (THEN) move CASTER to SELECTED TARGET. (In my mind it works that way, you'll know how to set it in JASS xD). Aditionally, the "Hook Returns if there's something between Caster and Target.

You said
Actually it is possible to make the hook return if it hits any kind of obstacle (An obstacle is everything which prevents ground units to walk over it). So the hook will return if it hits a tree, a wall or any ground unit which is not specified as a valid target.
But water and valleys are unpahtable terrain, and would be interpreted as obstacles?

3) I'm not sure about how to do it. I know almost nothing of JASS, I just apply some logic and read for info, but i'm never sure xD So, i'm afraid of messing the codes and screw everything up.

6) Great! Awesome! But Why "Hide" and not "Remove". Hiding PowerUps would cause leak.

-------------- The pre-set-thing -----------------

I mean, i'll make a Ward look like a Wood Log half-buried in the ground to make it an Attachment Point (Move the hero to it), and I want the hook to attach only to items, and that ward (since I will place several of these). Think of Zelda Grappling Hook =). And with "Pre-set" i mean that target's allowed are not ALL wards, but only THAT ward.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hey! Thanatus!

Bribe made a trigger to remove those dead tomes that remain in the game... So the Hook wont hook them!

Here's the link!
 
Status
Not open for further replies.
Top