1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

This is not easy to trigger...

Discussion in 'World Editor Help Zone' started by Tim Tran, Sep 11, 2020.

  1. Tim Tran

    Tim Tran

    Joined:
    Jul 23, 2020
    Messages:
    37
    Resources:
    0
    Resources:
    0
    Hi, hope you can help me, but checking the old records this must be a tricky thing.
    But it sounds easy: I want to use the Orc Sentry Ward to create a ward and then
    I want to trigger that if an enemy unit comes close to the ward something should happen.
    BUT it does not work. I made even a complety new unit to replace the original ward...
    Here are my triggers:
    upload_2020-9-11_15-13-41.png
    So if a uit uses MyItem (the Sentry Ward), the ward (which is a unit) is created at the position
    which I pointed to, right?
    So I want to set my unit variable ("Einheit") to last created unit.
    After some research I found this trigger modification, because there is apparently no event
    in which I could use a unit variable... ( I also tried to run it during initialization)
    upload_2020-9-11_15-12-22.png
    So now trigger 2 should have an event to trigger a sound
    if any unit comes close to the ward, but there is just silence
    when I move close to it.
    Any idea why such simple things are soooo complicated???
     
    Last edited: Sep 11, 2020
  2. DoomBlade

    DoomBlade

    Joined:
    Feb 5, 2018
    Messages:
    365
    Resources:
    0
    Resources:
    0
    • Ward Cast
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Sentry Ward (Item)
      • Actions
        • Set VariableSet TempPoint = (Target point of ability being cast)
        • Unit - Create 1 Footman for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
        • Set VariableSet TempUnit = (Last created unit)
        • Trigger - Add to Ward unit In range <gen> the event (Unit - A unit comes within 500.00 of TempUnit)
        • Custom script: call RemoveLocation (udg_TempPoint)


    • Ward unit In range
      • Events
      • Conditions
        • ((Triggering unit) belongs to an enemy of (Owner of TempUnit).) Equal to True
      • Actions
        • Sound - Play SoulPreservation <gen> at 100.00% volume, attached to TempUnit


    This is wierd, I made a plain map and made these triggers and the sound does not play.

    Also made sure that in the sound editor I made "use as sound".

    Welp, I hope someone can help you further. @Uncle @Dr Super Good

    I will attach the sound test map here so people can have a look.
     

    Attached Files:

  3. Tim Tran

    Tim Tran

    Joined:
    Jul 23, 2020
    Messages:
    37
    Resources:
    0
    Resources:
    0
    Thanks, that helped to solve the problem. However, I don't know why I spent hours to get things running if the solution
    is everytime somehow the same trigger ;-)
    I had to set life of the original ward within the object editor abilities to 0 and replaced it as you suggested
    so everything works fine now with no changes in trigger2
    upload_2020-9-11_17-29-26.png
    So happy, thank you!!!
     
  4. DoomBlade

    DoomBlade

    Joined:
    Feb 5, 2018
    Messages:
    365
    Resources:
    0
    Resources:
    0
    Glad it worked
     
  5. Tim Tran

    Tim Tran

    Joined:
    Jul 23, 2020
    Messages:
    37
    Resources:
    0
    Resources:
    0
    Well, actually now it works too good. You know that the unit should expire, but that does not account for the original location. I modified trigger 2 and used a third trigger, but it does not work.
    upload_2020-9-11_18-57-14.png

    upload_2020-9-11_18-55-1.png

    I wanted to null the unit variable, but the old location is still active after I create a new ward at different location...
     
  6. [db]east

    [db]east

    Joined:
    Feb 27, 2019
    Messages:
    144
    Resources:
    0
    Resources:
    0
    Thats what happens when you arnt specific. You create a region and you create an event for that region but none of them are ever removed from the game. It has nothing to do with the unit. You could add the event comes within range of unit instead of enters region. It wouldnt be optimal though because the events dont dissapear after the unit dies although the event shouldnt be able to trigger. It may trigger even if the unit is dead though but only for a time, this can be fixed by setting unit object edtor value does not decay, does not rise aswell as changing the death time to a lower value.

    The unit in the event does not change when the variable chages afterwards.

    Another way would be using a unit group.

    Instead of adding the event you can add the unit to a unit group and turn on the second trigger.

    In the second trigger you pick every unit in unit group
    Then pick every unit within range of picked unit matching condition and do actions
    Remove picked unit from unit group
    If number of units in group = 0
    Then turn off this trigger
    Else

    The ward also has to be removed from the group if it dies/is dead
    The second trigger will only trigger one time so unless the ward is suppose to die after a unit is near the rabbit hole may go even deeper in this solution.
     
  7. Tim Tran

    Tim Tran

    Joined:
    Jul 23, 2020
    Messages:
    37
    Resources:
    0
    Resources:
    0
    Oh, that are many ideas and I will try them out. But actually I want my ward to warn me by sound if units are approaching, so it should trigger until time is up or destroyed other way.
    As long as I don't cast the spell a second time, death of the ward causes silence. That works fine with condition#1 in trigger#2.
    I thought the event for trigger#2 is defined in trigger#1 and relying on the unit variable "Einheit", so if I could reset the variable no unit could come near anymore. And after a second casting
    of the spell, only the fresh unit can trigger, but apparently the dead one is still somehow active.
    OMG, I just wanted to create quickly an item and now I'm stuck in a lot of work...
     
  8. Tim Tran

    Tim Tran

    Joined:
    Jul 23, 2020
    Messages:
    37
    Resources:
    0
    Resources:
    0
    After a lot of testing I can happily say your suggestions helped to solve the problem. I guess it was the area making the problems because after I switched
    to the event "comes within range of unit" it was OK. Thank you!!!
     
  9. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,190
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Be aware that events added to triggers leak unless the triggers gets destroyed and created again.

    For 3D sounds to work the sound must have the appropriate 3D related fields filled in with reasonable values. Such as cut-offs and the like.