Convert Destructable to Triggering player!

Saintbob

New Member
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.
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
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
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
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
kinda. can you code that by yourself? try it and post the code here, we can help you for sure.
 

Saintbob

New Member
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
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
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
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

General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    they did not winterize any of the plants and they froze
  • The Helper The Helper:
    it is not that power consumption went up it was available capacity went down with power plants freezing
  • Varine Varine:
    What a fucking disaster. Are all of the Texas people okay? I see TH is, are we the only two?
  • Varine Varine:
    How have the other states held up? I just got power back so I have no idea what's going on, we didn't get warning
  • Varine Varine:
    Why the fuck didn't they fix this ten years ago when it happened?
  • Blackveiled Blackveiled:
    I'm in it with you and TH as well. My power has been in and out, and I have a ruptured pipe that I need to fix, shouldn't be too bad to fix myself.
  • Varine Varine:
    I hope you're staying warm! Apparently the supply is coming up so hopefully we can get back to normal power soon, mine has been on for six hours now.
  • M Mulciberxp:
    My power has been off most of the last 2 days. We had a generator installed 3 years ago though, so we're staying warm. Water is another issue...
  • The Helper The Helper:
    Where I live has a pool so we are using that to get water to flush the toilets. We have enough bottled water to drink and brush teeth and stuff but it has been a few days and no shower though....
  • Varine Varine:
    I had some water in gallon jugs, and got our water back on yesterday. We don't seem to have any leaks, but I haven't crawled down there to look yet.
  • The Helper The Helper:
    still no water I cannot remember when I last showered now I know how they felt in the old west lol
  • Varine Varine:
    My poor plants are happy, they aren
  • Varine Varine:
    aren't used to going this long without water or lights or normal heat. I think a couple of them froze, but they look like they'll make it
  • Varine Varine:
    Well one of them is pretty rough but I think it was sick to begin with, that one always had some problems.
  • jonas jonas:
  • jonas jonas:
    ???
  • Ghan Ghan:
    That is such a Texas thing to say lol
  • midnight8 midnight8:
    a positive could come out of this. So many people trapped at home could put a dent in the covid numbers in Texas
  • Varine Varine:
    That dude, Tom Boyd, is really upset about the backlash from his "it's your fault you're freezing" thing because he claims he resigned before saying it, so it wasn't like he said it in his official capacity or anything.
  • jonas jonas:
    Almost as if he was saying "screw you guys, I'm going home"
  • Varine Varine:
    I'm fairly new here still but that seems to be the analogous message by several of our politicians.
  • vypur85 vypur85:
    Nobody?
  • jonas jonas:
    Hi vypur85, long time no see
  • tom_mai78101 tom_mai78101:
    Hi vypur85, long time no see.
  • The Helper The Helper:
    We are all somebody

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top