• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

This is not easy to trigger...

Status
Not open for further replies.
Level 3
Joined
Jul 23, 2020
Messages
39
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:
Level 12
Joined
Feb 5, 2018
Messages
521
  • 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.
 

Attachments

  • SoundTest.w3m
    17.6 KB · Views: 20
Level 3
Joined
Jul 23, 2020
Messages
39
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!!!
 
Level 3
Joined
Jul 23, 2020
Messages
39
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...
 
Level 20
Joined
Feb 27, 2019
Messages
594
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.
 
Level 3
Joined
Jul 23, 2020
Messages
39
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...
 
Level 3
Joined
Jul 23, 2020
Messages
39
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!!!
 
Status
Not open for further replies.
Top