Convert Destructable to Triggering player!

Saintbob

New Member
Reaction score
2
Hey guys/gals

Im a little stuck on understanding how to convert a destructable to a player ownd destructable.

Let me explain.

I have a unit that will cast an ability on the destructable called Infest, that will then take 10seconds to cast, when the cast has ended, i want the destructable to become owned by the player casting the ability.
I also want the the new infested destructable to have increased HP and Armor, and lastely so that the player casting the ability cannot cast it on another Human player owned Destructable.
But i do want the other player to be able to destroy the destructable.

Any ideas?

Thanks all.
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
omg just make a unit and remove his attack and add destructable's model.
you ability is channeled, so at event you write a unit finishes casting an ability
the condition must check if the unit "Infested" is the target of the spell.
make an if then else to check if another player owns the unit and then kill it or else you change the unit's owner to the player that casted the ability.Then add some passives that increase the damage and other stats you want of the unit.

Search the triggers man, you will find more interesting comands.
 

Saintbob

New Member
Reaction score
2
omg just make a unit and remove his attack and add destructable's model.
you ability is channeled, so at event you write a unit finishes casting an ability
the condition must check if the unit "Infested" is the target of the spell.
make an if then else to check if another player owns the unit and then kill it or else you change the unit's owner to the player that casted the ability.Then add some passives that increase the damage and other stats you want of the unit.

Search the triggers man, you will find more interesting comands.

Forgive me, but my knowledge of these triggers are quite slim, im ok with basic triggers. But i've not created anything like this before.

How do you mean by Make a unit and remove its attack, and add Destructables model?

Why cant i just create a spell that when attacks the Destructable it turns it into the triggering players building, if not already owned by another player?
And how do i then go onto making that destructable gain HP and increase in defence when i take over it?

Sorry for been dumb, but i cant find any tutorials on this type of triggering.

Thanks :D
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
destructables and units (buildings count as units) have nothing in common, they are completely different, you cant just own a destructable.
what you have to do is creating a new unit in the object editor and change its values/graphics to look like the destructable you were referring.
now either you remove the target destructable of your ability and create that new unit type at its position instead or you just swap all your destructables with the new unit type by default and refer to them as "wanna be" destructables.
if you have many destructables of that kind you are talking about i would recommend the first method else the second.
 

Saintbob

New Member
Reaction score
2
destructables and units (buildings count as units) have nothing in common, they are completely different, you cant just own a destructable.
what you have to do is creating a new unit in the object editor and change its values/graphics to look like the destructable you were referring.
now either you remove the target destructable of your ability and create that new unit type at its position instead or you just swap all your destructables with the new unit type by default and refer to them as "wanna be" destructables.
if you have many destructables of that kind you are talking about i would recommend the first method else the second.

So what you're saying is...

The Spell I have "infest" will 1 shot the destructable, then set it in the triggers to so that when the spell "infest" 1 shots the destructable it will replace that with my new unit that looks like the destructable, in its place?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
kinda. can you code that by yourself? try it and post the code here, we can help you for sure.
 

Saintbob

New Member
Reaction score
2
kinda. can you code that by yourself? try it and post the code here, we can help you for sure.

Trigger:
  • Events
    • unit - a unit finishes casting ability

Trigger:
  • Condition
    • (Ability being cast) Equal to Infest

Actions
Trigger:
  • Unit - Replace (target unit of ability being cast) with a Infestered Stone using The new unit's max life and mana



sorry for the crap posting of the triggers, first time i've posted anything here using those tags. lol

Thats what im using, but it doesnt work
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
first of all, to copy the trigger as a whole just right-click the triggers name and copy as text and paste here instead of copying the events, conditions and actions one by one.
like if your trigger is called "MyVeryFirstTrigger" you have to select the "MyVeryFirstTrigger" text and copy as text:
Trigger:
  • MyVeryFirstTrigger
    • Events
      • Map initialization
    • Conditions
      • True Equal True
    • Actions
      • Do nothing

bold in this conotation:
Code:
[B][I]MyVeryFirstTrigger[/I][/B]
    Events
        Map initialization
    Conditions
        True Equal True
    Actions
        Do nothing

now to your problem, using (target unit of ability being cast) will obviously not work because the target of the ability is a destructable and not a unit.
what you need should look somewhat like this:
Trigger:
  • MyVeryFirstTrigger
    • Events
      • Unit - A unit starts the effect of an Ability
    • Conditions
      • (Ability being cast) Gleich MyAbility
    • Actions
      • Set TempPoint = (Position of (Target destructible of ability being cast))
      • Destructable - Remove (Target destructible of ability being cast)
      • Unit - Create 1 MyUnitType for (Owner of (Triggering unit)) at TmpPnt facing 270.00 degrees
      • Custom script: call RemoveLocation (udg_TempPoint)

if you wonder:
MyAbility is the custom ability of yours
MyUnitType is the type of the new unit which you want the destructable to be replaced with
TempPoint is a point variable which is needed to avoid memory leaks
the custom script line is needed to avoid memory leaks together with the point
 

Saintbob

New Member
Reaction score
2
now to your problem, using (target unit of ability being cast) will obviously not work because the target of the ability is a destructable and not a unit.
what you need should look somewhat like this:

Trigger:
  • Trigger:
    • MyVeryFirstTrigger
    • Events
    • Unit - A unit starts the effect of an Ability
    • Conditions
    • (Ability being cast) Gleich MyAbility
    • Actions
    • Set TempPoint = (Position of (Target destructible of ability being cast))
    • Destructable - Remove (Target destructible of ability being cast)
    • Unit - Create 1 MyUnitType for (Owner of (Triggering unit)) at TmpPnt facing 270.00 degrees
    • Custom script: call RemoveLocation (udg_TempPoint)


if you wonder:
MyAbility is the custom ability of yours
MyUnitType is the type of the new unit which you want the destructable to be replaced with
TempPoint is a point variable which is needed to avoid memory leaks
the custom script line is needed to avoid memory leaks together with the point

ok so ive tried this and this is the best i can come up with lol, sorry for the fail attempt!

Trigger:
  • Untitled Trigger 003
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Infest (Warlock)
    • Actions
      • Set Destructable = (Last created destructible)
      • Destructible - Remove (Target destructible of ability being cast)
      • Unit - Create 1 Infestered Stone for (Triggering player) at (Position of (Target destructible of ability being cast)) facing Default building facing degrees


I cant get my head arround the Variable, and the Custom script you've done.
Could ya explain how to do them both?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
ok so ive tried this and this is the best i can come up with lol, sorry for the fail attempt!

Trigger:
  • Untitled Trigger 003
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Infest (Warlock)
    • Actions
      • Set Destructable = (Last created destructible)
      • Destructible - Remove (Target destructible of ability being cast)
      • Unit - Create 1 Infestered Stone for (Triggering player) at (Position of (Target destructible of ability being cast)) facing Default building facing degrees


I cant get my head arround the Variable, and the Custom script you've done.
Could ya explain how to do them both?

nothing you have to be sorry about.

first of all, your trigger cannot work cause there is no position of a targeted destructable after you removed the destructable one line before. your trigger should "work" if you switch both lines.

about the TempPoint, this is something about wc3 triggering which is rather hard to understand for beginners. each time you use a certain type of variable, points, unitgroups, forces, rects, special effects, you lose a little memory. this memory can only be freed with a custom script line like i did.
if you dont remove memory leaks in your triggers they might cause your map to lag after they ran frequently because your computer will run short on memory.

Edit: Added a demo map
 

Attachments

  • [Z]MorphDestructableIntoUnit.w3x
    17.7 KB · Views: 110
General chit-chat
Help Users
  • No one is chatting at the moment.

      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