• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Attachment removal system

Status
Not open for further replies.
Level 19
Joined
Apr 21, 2013
Messages
1,194
Hey guys i was working on my map about when you take an item it attaches the unit the item. Now i have to do this backwards but i couldn't find a good way to do that because i have to use
  • special effect - destroy a special effect
trigger.

By using this i guess i have to stor all attachments into variables. But is there another way?
 
Level 3
Joined
Feb 9, 2014
Messages
45
Hey guys i was working on my map about when you take an item it attaches the unit the item. Now i have to do this backwards but i couldn't find a good way to do that because i have to use
  • special effect - destroy a special effect
trigger.

By using this i guess i have to stor all attachments into variables. But is there another way?

Hi Bro! is this your problem ?
if so , follow this trigger..
  • Mechanical Attach
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Mechanical
    • Actions
      • Unit Group - Pick every unit in (Units owned by (Owner of (Researching unit)) of type |c00FFFF00Builder|r) and do (Actions)
        • Loop - Actions
          • Unit - Remove Steam Shield from (Picked unit)
          • Unit - Add Mechanical Hand to (Picked unit)
this trigger is from my TD map ^_^ i hope i helped you.. :ogre_hurrhurr:
 
Yes. If you want to trigger all the attachments you either need to store all the models in a special effect variable or in dummy ability variables. I would chose the first option as well in this case.

You can either create a special effect variable for each of your attachments or create a special effect array variable. The "problem" with the latter is that you need to detect which slot in the array you need for a specific attachment.

Anyway.
A simple example:

Map initialization
Special_Effect_Index [1] = Sword
Special_Effect_Index [2] = Axe

Acquire Item
Unit acquires an item
Item being manipulated equal to Sword
Set Weapon_Attach [number of owner of hero manipulating item] = Special_Effect_Index [1]
Create a special effect on "hand, right" of Hero manipulating item using Weapon_Attach [number of owner of hero manipulating item]

Drops Item
Unit loses an item
Destroy Weapon_Attach [number of owner of hero manipulating item]

Special_Effect_Index is a Special Effect array
Weapon_Attach is a Special Effect array


Something along those lines
 
Level 5
Joined
Jan 27, 2014
Messages
164
Hashtable, perhaps?

Code:
Init
    Events
        Map initialization
    Conditions
    Actions
        Hashtable - Create a hashtable
        Set hashtable_sfx = (Last created hashtable)

Code:
Pick
    Events
        Unit - A unit Acquires an item
    Conditions
    Actions
        Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\NightElf\CorrosiveBreath\CorrosiveBreathMissile.mdl
        Hashtable - Save Handle Of(Last created special effect) as (Key (Item being manipulated)) of 0 in hashtable_sfx

Code:
Drop
    Events
        Unit - A unit Loses an item
    Conditions
    Actions
        Special Effect - Destroy (Load (Key (Item being manipulated)) of 0 in hashtable_sfx)
        Hashtable - Clear all child hashtables of child (Key (Item being manipulated)) in hashtable_sfx

Untested but I think it should work.
 
Level 5
Joined
Jan 27, 2014
Messages
164
> But he still needs to index...
Don't really get you here though.
The trigger I posted was just something generic.

All you need to do is create a few triggers conditioned differently for different item.
For example:
Code:
Pick
    Events
        Unit - A unit Acquires an item
    Conditions
        Item-type of (Item being manipulated) Equal to Axe
    Actions
        Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\NightElf\CorrosiveBreath\CorrosiveBreathMissile.mdl
        Hashtable - Save Handle Of(Last created special effect) as (Key (Item being manipulated)) of 0 in hashtable_sfx
Then whenever the unit carries an Axe, the CorrosiveBreathMissile effect will be attached to the unit. This works even if the unit carries multiple Axe and loses the item separately.

If you want a different effect for Sword, then just create another trigger, or just use if/then/else in a single trigger.
 
Level 14
Joined
Nov 17, 2010
Messages
1,265
Is there a reason you want to trigger all of the attachments. If they are only for the items then you can set the attachment you want in the object editor. Find the item you want, add an ability to it that uses the special effect or attachment you want. In the ability set Art- Target to the model you want (special effect, weapon, etc) then in Art- Target Attachment Point 1 put the attachment point you want to use. (Chest, overhead, Hand right, Origin, etc.)

For example if you have a sword with 20 damage you can set the ability to 20 damage and use a sword model attachment in the ability. Now once you pick it up you it shows the sword and once you drop it the sword disappears.

If this is not what you are looking for then hopefully you get it figured out. Otherwise good luck!
 
Level 2
Joined
Mar 20, 2012
Messages
22
I cant get this to work.. tried both by ability and trigger.

Using: Hand, right
a sword model from hiveworkshop on Villager(55 anims)

art - target = model of longsword
art - attachment point 1 = hand, right


What am i missing??
 
Status
Not open for further replies.
Top