A -DOODAD- is attacked trigger, is it possible?

Rakaesa

Member
Reaction score
5
Okay, so I need a specific kind of trigger.

First, there's the event "A unit is attacked", which is fine.
But then there's no condition to check that said unit is a doodad, obviously because doodads and units are two different things.

So is it possible to have a script of a doodad (Not a specific one, I mean any of said doodad) that if it takes a certain amount of damage from any player, then it drops a certain item? (Wood)

Then I need the same thing for rock chunks aswell.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
I'm not sure but I don't think so. You can do something like that instead.

Set the health of the destructible to 1(Or the amount of health needed to get 1 wood).

When the destructible is destroyed,

Whatever condition you have here

Create destructible at position of destructible
Create wood at position of destructible
 

Rakaesa

Member
Reaction score
5
That could make sense, but as I said, it's not for a specific doodad, it's for ANY doodad. So is it still possible to do the trigger you suggested with all doodads on the map?
 

TomTTT

New Member
Reaction score
44
That could make sense, but as I said, it's not for a specific doodad, it's for ANY doodad. So is it still possible to do the trigger you suggested with all doodads on the map?
It's possible. Acctually pretty easy. If you want each player to have his own count of how much did he damage, and when to drop wood, it's gonna be harder. You need to create 1 integer variable (obviously array if multiplayer) and each time a destructible dies, create a new one instead and set that integer to +1 of it's value. Now make a periodic check, Every 0.10 seconds, If/Then/Else INTEGER is equal to ATTACKS NEEDED then Set Point = Position of UNIT, create 1 Wood at Point.
Sorry it's clumsy, just want you to get the general idea.
EDIT:
I thought it'd be easy for multiplayer, i was wrong, since you can't refer to the unit destroyed the destructible.
Ok, at the initialization, we add all trees to our main trigger:
Trigger:
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Wood <gen> the event (Destructible - (Picked destructible) dies)

Now we need to make the trigger:
Trigger:
  • Wood
    • Events
    • Conditions
    • Actions
      • Set Point = (Position of (Dying destructible))
      • Destructible - Create a (Destructible-type of (Dying destructible)) at Point facing (Random angle) with scale 1.00 and variation 0
      • Trigger - Add to (This trigger) the event (Destructible - (Last created destructible) dies)
      • Set AttackCount = (AttackCount + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AttackCount Equal to 10
        • Then - Actions
          • Set AttackCount = 0
          • Item - Create Wood at Point
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Point)

So lets see. When a destructible dies, we set where he died and create a new one there. We add the event again, to make sure this one will be affected too. Now we set the AttackCount, and check if it's 10 (or any number it takes to make Wood). If it is, we reset the attack count and create a Wood. Then we need to clean leaks of course, and voila!
 

Rakaesa

Member
Reaction score
5
It's possible. Acctually pretty easy. If you want each player to have his own count of how much did he damage, and when to drop wood, it's gonna be harder. You need to create 1 integer variable (obviously array if multiplayer) and each time a destructible dies, create a new one instead and set that integer to +1 of it's value. Now make a periodic check, Every 0.10 seconds, If/Then/Else INTEGER is equal to ATTACKS NEEDED then Set Point = Position of UNIT, create 1 Wood at Point.
Sorry it's clumsy, just want you to get the general idea.


right, thanks for the help though it's a bit hard to understand, And no not each player has their own damage count. (Also sorry for double post, I saw his just as I posted the other msg)


Edit: Also, I may have found a way without using a variable. Could I just do

Event
Destructible-A destructible within (Entire Map) dies
Conditions
(Destructible-type of (Dying Destructible)) Equal to summer tree wall
Actions
Item-Create Wood at position of Dying Destructible
Destructible-Create a Summer Tree Wall at (Position of(Dying Destructible))

I believe this would work?
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
You can use the edit button instead of double posting.

And this is what you need:
Trigger:
  • Wood Gain
    • Events
      • Destructible - A destructible within (Playable map area) dies
    • Conditions
    • Actions
      • Set TempPoint = (Position of (Dying destructible))
      • Destructible - Create a (Destructible-type of (Dying destructible)) at TempPoint facing (Random angle) with scale 1.00 and variation 0
      • Item - Create Bundle of Lumber at TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)


You might want to include a condition like this, if it only works for trees. All trees of the SAME type. Meaning if there are 5 summer tree walls, it works for all 5 trees.

Trigger:
  • Conditions
    • (Destructible-type of (Dying destructible)) Equal to Summer Tree Wall


If there is a summer tree wall, felwood tree wall, ashenvale tree wall, it'll only work for summer tree wall. OR you can include all of them in.

Trigger:
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Destructible-type of (Dying destructible)) Equal to Summer Tree Wall
        • (Destructible-type of (Dying destructible)) Equal to Felwood Tree Wall
        • (Destructible-type of (Dying destructible)) Equal to Ashenvale Tree Wall
 

Rakaesa

Member
Reaction score
5
Right, I overlooked the fact that the way I just showed does if ANY destructible dies, the tree wall will be created there. Thanks for the script, i'll put it into my map now. +rep.

Edit: Problem, I cant find the "Set Tempoint=Position of (Dying Destructible))"
I can find the Set Tempoint thing, but not the position of dying destructible. It doesnt seem to be available for that action.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
TempPoint is a point variable. Create the variable, it should be a point and if you use it, just find Destructible - Position of Destructible
 

DioD

New Member
Reaction score
57
Destructible - A destructible within (Playable map area) dies
Works for fisrst 64 objects ONLY, check GUI comment or code.


its possible to ressurect destructable, you dont need to create new one.

there is no event for unit attacks destructable, i suggest you to use units for this.
 

Rakaesa

Member
Reaction score
5
Works for fisrst 64 objects ONLY, check GUI comment or code.


its possible to ressurect destructable, you dont need to create new one.

there is no event for unit attacks destructable, i suggest you to use units for this.

Did you not read the above posts? We already found the solution (Except to the new fact that creating new only works 64 times) But as you said, i'll just change it to revive destructible.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
I believe he was just offering a better solution, if you have 65 trees or more it might not work properly anymore, whether you create or resurrect the trees.
 

DioD

New Member
Reaction score
57
Did you not read the above posts?
I quote posts above, ofc i dont read em!


event for destructables work ONLY on 64 destructables, if you have more - they ignored and wont trigger any event, you must enum every destructable and add event to trigger, as post 5 states, code from post 8 wont work at all.
 

Rakaesa

Member
Reaction score
5
Ah, I thought you meant Creating destructibles wont work for 64 or more but ressurecting will. God damnit, that's going to cause a problem. I suppose I have no solution to this then, because I'm sure as hell not making a trigger for every tree on the map, and i'm not making all of the trees units.
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
Then you could do as DioD suggested, and make units that look like the destructibles.
 

Rakaesa

Member
Reaction score
5
Ryushi, I just said i'm not going to make a bunch of units to replace destructibles. I don't fancy sitting here for three hours putting units 1 by one in the same places that I have put my trees, and then removing my trees. BUT- I did just think of something people.

This map is sort of a god's land prototype kinda thing that i'm using an older map of mine to make. It was an old D&D Map prototype.

The god in this game can create units and doodads as he wishes.

So I could just have the tree die and the item appear, and then God could just spawn more trees when he wanted.

The only problem is i'm not sure how to make him able to spawn destructibles yet, as they do in Vuen's D&D. I'm looking into that now.

Edit: Okay, I may have found a way to spawn destructibles. Testing it now.
Edit2: Nope, gotta keep looking for another way, though I may be close.
Edit3: Okay, I managed to make it so that they can spawn doodads, but I have to make a seperate script for each kind of doodad unfortunately. And I don't know how to make a mass of trees with one right click, but this will work for now.
Edit4:Nevermind, still having a few problems with it. If I say Summer Tree Wall and right click somewhere, it spawns fine. But then if I say a unit's name like Grunt and try to spawn that, the tree still spawns ontop of it even though I tried to make an action that pervents this. Imma take a break for today, getting impatient with this map.
 

DioD

New Member
Reaction score
57
you can try to read post number 5 with nice 100% working trigger (expect useless recreation of destructables - fix with revive).
and dont looks at post number 8 with trigger usefull only for maps with 64 or less destructables on map.

with code from post 5 you able to replace every destructable on map with unit AFTER, game is started, this will likely to desync players with slow machines if done in multiplayer.

OR try to play with replacement dialog in editor, it allow to replace one object with another.
 

Rakaesa

Member
Reaction score
5
you can try to read post number 5 with nice 100% working trigger (expect useless recreation of destructables - fix with revive).
and dont looks at post number 8 with trigger usefull only for maps with 64 or less destructables on map.

with code from post 5 you able to replace every destructable on map with unit AFTER, game is started, this will likely to desync players with slow machines if done in multiplayer.

OR try to play with replacement dialog in editor, it allow to replace one object with another.

You're confusing me, is post 5 a 100% good trigger that won't cause crashes and will not stop at 64 destructibles or not?
 

TomTTT

New Member
Reaction score
44
You're confusing me, is post 5 a 100% good trigger that won't cause crashes and will not stop at 64 destructibles or not?

If you mean the one i posted and wrote about it, (which by my count was the 5th from the start, including the starting post) then i think it should work without any problems, except that it's not multiplayer, because you cant detect what killed that darn destructible.

BTW, won't putting units instead of trees will cause uber-lags? I mean if you are going to make large forests and stuff, i think it will.

EDIT: Shazam! here's a demo map, works like a charm, but no auto-attack. Check the Object editor and you'll see how the Footman attacks the tree. (Targets allowed, Tree checked). Hope this helps.
 

Attachments

  • Lumber Count.w3x
    14.5 KB · Views: 140
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