Destructibles

sentrywiz

New Member
Reaction score
25
Hi. I've been having troubles with these two triggers.

A region in map has 4 crates. When a crate dies, the unit that killed it has a X% chance to get an item. Then the crate respawns at that region after some random between time. All works well the first two times. But after two times, crates just quit respawning.

Here are the triggers:

Trigger:
  • Crate Gives Item Random
    • Events
      • Destructible - A destructible within Bandits Lair <gen> dies
    • Conditions
      • (Destructible-type of (Dying destructible)) Equal to Crates
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to 50.00
        • Then - Actions
          • Item - Create (Random level 1 item-type) at (Position of (Dying destructible))
        • Else - Actions


And...

Trigger:
  • Respawn Crate
    • Events
      • Destructible - A destructible within Bandits Lair <gen> dies
    • Conditions
      • (Destructible-type of (Dying destructible)) Equal to Crates
    • Actions
      • Wait 5.00 seconds
      • Destructible - Create a (Destructible-type of (Dying destructible)) at (Position of (Dying destructible)) facing (Random angle) with scale 1.00 and variation 1


Where and what am I doing wrong? Besides using GUI :p
 

tommerbob

Minecraft. :D
Reaction score
110
Combine the two triggers. I don't know if that would fix your problem, but its pointless to have 2 triggers. Just put the actions int he second trigger right after the actions of the first.
 

sentrywiz

New Member
Reaction score
25
Pointless? One creates items when destructible dies, the other respawns the crate after some time.

Suggest how to combine them.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Trigger:
  • Crate Gives Item Random
    • Events
      • Destructible - A destructible within Bandits Lair <gen> dies
    • Conditions
      • (Destructible-type of (Dying destructible)) Equal to Crates
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to 50.00
        • Then - Actions
          • Item - Create (Random level 1 item-type) at (Position of (Dying destructible))
        • Else - Actions
      • Wait 5.00 seconds
      • Destructible - Create a (Destructible-type of (Dying destructible)) at (Position of (Dying destructible)) facing (Random angle) with scale 1.00 and variation 1


this is what tommerbob said.
but i dont see the problem either.

besides, your trigger is leaking, here is a fixed version:
Trigger:
  • Crate Gives Item Random
    • Events
      • Destructible - A destructible within Bandits Lair <gen> dies
    • Conditions
      • (Destructible-type of (Dying destructible)) Equal to Crates
    • Actions
      • set TempPoint = (Position of (Dying destructible))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to 50.00
        • Then - Actions
          • Item - Create (Random level 1 item-type) at TempPoint
        • Else - Actions
      • Wait 5.00 seconds
      • Destructible - Create a (Destructible-type of (Dying destructible)) at TempPoint facing (Random angle) with scale 1.00 and variation 1
      • custom script: call RemoveLocation (udg_TempPoint)
 

Jinxx

New Member
Reaction score
4
Are you sure some other trigger isn't interfering with these two? They look okay, but if you've got something else running in the background, it could be screwing with these two triggers.
 

sentrywiz

New Member
Reaction score
25
I see tommerbob's advice useful. Applied. Made the trigger into one

But that didn't solve my problem.

Ok, lets try what you say.

EDIT: Nope, the leakless version doesn't solve the problem. Any other advice?
 

tommerbob

Minecraft. :D
Reaction score
110
Do you have any other destructibles in your Bandit Lair region that can die? If another destructible in that region dies, it would interfer with this trigger. (I think)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Do you have any other destructibles in your Bandit Lair region that can die? If another destructible in that region dies, it would interfer with this trigger. (I think)
it would not, thats why the condition is there.

What i would advice you to do is the following, add in a debug message and test again, it helps alot to see whether, at least, the event is running and the conditions return true. because as far as i can see the triggers are perfectly fine.
 

sentrywiz

New Member
Reaction score
25
No the rest of them are doodads. AKA 1x campfire, 2x pile of treasure and 2x torch.

Maybe... I say maybe if you kill the crates slowly and not hit one then run and hit the other, the trigger would work. I think... that maybe the trigger doesn't work the same way if a unit would die - it doesn't save that a crate died when a new one is killed.

Am I making any sense? :S
 

sentrywiz

New Member
Reaction score
25
it would not, thats why the condition is there.

What i would advice you to do is the following, add in a debug message and test again, it helps alot to see whether, at least, the event is running and the conditions return true. because as far as i can see the triggers are perfectly fine.

How do I do that?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Actually, that trigger isn't leakless, nor is it MDI (MUI but with Destructables :p).

You should use this instead:
Trigger:
  • Crate Gives Item Random
    • Events
      • Destructible - A destructible within Bandits Lair <gen> dies
    • Conditions
      • (Destructible-type of (Dying destructible)) Equal to Crates
    • Actions
      • Set TempPoint = (Position of (Dying destructible))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to 50.00
        • Then - Actions
          • Item - Create (Random level 1 item-type) at TempPoint
        • Else - Actions
      • Custom Script: call RemoveLocation (udg_TempPoint)
      • Wait 5.00 seconds
      • 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 1
      • Custom Script: call RemoveLocation (udg_TempPoint)



But for the problem, I have no idea :S

Try to look through any other triggers you might have which are either using the region "Bandits Lair" in it, or the "Crates" and see if one of these might interfere with what's happening here :S

Am I making any sense? :S

Yeah, you're making sense but it doesn't work like that in this case ;)
So that shouldn't be the problem...

And for the debugging, just add a normal player-message, saying anything in there between each action, and see how many of those messages come up when you kill a crate ;)
 

sentrywiz

New Member
Reaction score
25
Actually, that trigger isn't leakless, nor is it MDI (MUI but with Destructables :p).

You should use this instead:
Trigger:
  • Crate Gives Item Random
    • Events
      • Destructible - A destructible within Bandits Lair <gen> dies
    • Conditions
      • (Destructible-type of (Dying destructible)) Equal to Crates
    • Actions
      • Set TempPoint = (Position of (Dying destructible))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to 50.00
        • Then - Actions
          • Item - Create (Random level 1 item-type) at TempPoint
        • Else - Actions
      • Custom Script: call RemoveLocation (udg_TempPoint)
      • Wait 5.00 seconds
      • 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 1
      • Custom Script: call RemoveLocation (udg_TempPoint)



But for the problem, I have no idea :S

Try to look through any other triggers you might have which are either using the region "Bandits Lair" in it, or the "Crates" and see if one of these might interfere with what's happening here :S



Yeah, you're making sense but it doesn't work like that in this case ;)
So that shouldn't be the problem...

And for the debugging, just add a normal player-message, saying anything in there between each action, and see how many of those messages come up when you kill a crate ;)

Well the thing is... why two setTempPoint and removeLocation? That confuses me :S

I'll try something like adding a player message like you said. Lets see if it works, I really start to hate these crates. EDIT: I HATE THE CRATES!

Try to look through any other triggers you might have which are either using the region "Bandits Lair" in it, or the "Crates" and see if one of these might interfere with what's happening here :S

That is the only trigger I have. I just tested everything now, with including new leakless version. Still same story. Crates respawn twice and never again... and the second time they don't even drop items, or maybe my 50% chance is against me.

DID WITH THE DEBUG: Added the normal message "TEST" and it only works for the first time the crates get destroyed. After they respond, I kill them and no message. So the problem is the system somehow doesn't see them as crates. How cool is that? :confused:
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Actually, that trigger isn't leakless, nor is it MDI (MUI but with Destructables :p).

[...]
well, okay, it wasnt 100% leakless but MDI is yours still not. if another crate dies within the 5 seconds the variable "Dying Destructible" is still overwritten. i guess you would need a hashtable for 100% MDI-ness.

@sentrywiz:if a crate dies there is a global variable called "Dying Destructible" in which the dying crate will be saved in.
now the problem is, if, lets say, "CrateA" dies the variable "Dying Destructible" will save "CrateA", it will create an item (or not depending on the random factor) and wait 5 seconds doing nothing. BUT if another crate, lets say, "crateB" dies within these 5 seconds the global variable "Dying Destructible" will be overwritten, now it will save "crateB". this is a common problem with waits in GUI triggers.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
No, there are a number of Event Responses which will work after waits ;)

Can't remember them though XD
 

sentrywiz

New Member
Reaction score
25
well, okay, it wasnt 100% leakless but MDI is yours still not. if another crate dies within the 5 seconds the variable "Dying Destructible" is still overwritten. i guess you would need a hashtable for 100% MDI-ness.

@sentrywiz:if a crate dies there is a global variable called "Dying Destructible" in which the dying crate will be saved in.
now the problem is, if, lets say, "CrateA" dies the variable "Dying Destructible" will save "CrateA", it will create an item (or not depending on the random factor) and wait 5 seconds doing nothing. BUT if another crate, lets say, "crateB" dies within these 5 seconds the global variable "Dying Destructible" will be overwritten, now it will save "crateB". this is a common problem with waits in GUI triggers.

I understand what you say. And I support that theory, as it works in practice. System saves them one by one, neverminding when they are killed. Now there are two problems:

-It only works once, after the initial crates die... but after the newly (2nd) created crates die, they don't respawn
-New crates aren't recognized as crates when they die that is why the trigger fails

:confused:

EDIT: I am going to bed guys. Thanks for the comments and please, any ideas are good. Keep it up. I just got an idea that if I label each crate with a variable then the trigger would work. But that's so much work now :S
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top