• 🏆 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!

[Trigger] Trigger troubles.

Status
Not open for further replies.
Level 2
Joined
Feb 10, 2010
Messages
13
Hi there.

I am having trouble with a certain trigger I am trying to accomplish.

What I am trying to do is make a trigger where, when a certain item is dropped onto a region, the item is replaced by a certain hero.

For instance: A paladin has a red egg(item) in his inventory, he goes over to the hatching area and drops it, creating a red egg(hero)

Now comes the problem.

I had thought I had a trigger figured out, but when I tried creating more triggers, it would create more than one hero.

I'll use another example :p
Paladin drops the red egg into the hatching area, and a red, blue, green, and yellow egg appear, all from the red egg item.

Which..totally screws up what I am trying to accomplish. And I think I just need to start from scratch with a new trigger.

Any suggestions for a simple solution?
 
Level 9
Joined
Oct 11, 2009
Messages
477
Hi there.

I am having trouble with a certain trigger I am trying to accomplish.

What I am trying to do is make a trigger where, when a certain item is dropped onto a region, the item is replaced by a certain hero.

For instance: A paladin has a red egg(item) in his inventory, he goes over to the hatching area and drops it, creating a red egg(hero)

Now comes the problem.

I had thought I had a trigger figured out, but when I tried creating more triggers, it would create more than one hero.

I'll use another example :p
Paladin drops the red egg into the hatching area, and a red, blue, green, and yellow egg appear, all from the red egg item.

Which..totally screws up what I am trying to accomplish. And I think I just need to start from scratch with a new trigger.

Any suggestions for a simple solution?

I will provide you with a GUI version of the trigger, you don't need several triggers to execute the action. Here is the trigger:

  • <Name of the Trigger>
    • Events
      • Region - A unit enters <Name of your Region>
    • Conditions
      • Boolean - Unit type of Triggering Unit has (Item-Type of (Red Egg)) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Boolean - Triggering Unit is A Hero Equal to True
        • Then - Actions
          • Unit - Remove Triggering Unit
          • Unit - Create Red Egg at <Name of your Region> for Owner of Triggering Unit facing Default Angle
I hope you understand. Reply to me if you want more info about that or another set of triggers.:grin:
 
sephiroth1234,
Rules said:
Thread Revival - Necroposting

Bumping old or inactive ("dead") threads is occasionally called "necroposting" or "thread necromancy" and the bumping posts referred to as "frankenposts."
Hive Workshop users are permitted to post in threads within six months of the thread's most recent post.
Posting in a thread 15 days after the most recent reply is considered necroposting.
Necroposts are permitted if:
The thread is being revived for a valid reason.
The reviving post asks an important question, adds relevant detail and / or enhances the topic under discussion.
The user alerts moderators prefacing the reviving post with a notation such as: Bump! *revive* [necro]
Posts that violate these rules may be deleted by moderators without warning.
Users who consistently violate these rules may be punished.

And the trigger you gave him is kind of wrong.

  • Trigger
  • Events
    • Unit - A unit loses an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Red Egg
  • Actions
    • Item - Remove (Item being manipulated)
    • Set Point1 = (Position of (Triggering unit))
    • Unit - Create 1 Red Egg (Hero) for (Owner of (Triggering unit)) at Point1 facing default building degrees
    • Custom script: call RemoveLocation (udg_Point1)
 
Level 2
Joined
Feb 10, 2010
Messages
13
Oh hey. I forgot all about this topic. Okaaay. First off.
@Sephiroth,
I tried this trigger, and it did not work, period. When I dropped the item, it stayed as an item instead of swapping for the red egg unit.

@Pharaoh_,
This was closer, however
A) The trigger works outside the region, which is bad. I tried adding "A Unit Enters Region" to the events, but it did not work.
B) It spawned two red eggs for some reason. I would lay down 1 item, and get 2 units in its place instead of one.



Unless I am doing something wrong, there is still something missing. Could one of you or someone else perhaps make me a small map with the trigger incase I am doing it wrong?
 
To check if the unit is in region, use a condition, called Boolean comparison, scroll to Region and then
  • If - Conditions
    • (Your region contains Point1) Equal to True
  • Then - Actions
    • //Actions here
I really don't know why it spawns two eggs, I guess you either make something wrong, or it makes a loop for some weird reason. Try adding
  • Trigger - Turn off (This trigger)
in the beginning of the actions and in the end of the actions
  • Trigger - Turn on (This trigger)
 
Level 2
Joined
Feb 10, 2010
Messages
13
Okay..Well I couldnt find an if, then option under conditions..I found the Boolean Comparison easy enough, but there were no If, Then conditions anywhere..

Heres what I have.

  • Trigger:
    • Event
      • Unit- A unit Loses an item
    • Conditions
      • (Item type of(Item being Manipulated)) Equal to Fire Egg
    • Actions
      • Trigger- Turn off (This trigger)
      • Item - Remove (Item being manipulated)
      • Set loc[1] = (Position of (Triggering unit))
      • Unit- Create 1 Fire Egg for (Owner of (Triggering Unit)) at loc[1] facing (Random point in Hatching Area <gen>)
      • Custom Script: call RemoveLocation(udg_loc[1])
      • Trigger- Turn on (This trigger)
Hope that helps to understand whats wrong :(
 
Level 7
Joined
Mar 22, 2010
Messages
228
  • Event
  • Unit Loses an item
  • Condition
  • (Triggering unit)is a Hero equal to true
  • Item Being Manipulated equal to (the item you want to drop)
  • Action
  • If/Then/Else
  • If-Drop(boolean) equal to false
  • Then-(put here what you want to happen)
  • Else-(none)
Sorry i dont know how to put triggers like you are doing ^^
i guess that helped?
coz i dont really understand your prob^^
 
Level 2
Joined
Feb 10, 2010
Messages
13
Okay...
After reading that several times, Im pretty sure that isnt even close, because again, it doesnt specify dropping the item in a specific region.
 
Level 3
Joined
Apr 20, 2010
Messages
46
  • Egg In Nest
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Phoenix Egg (item)
      • ((Item being manipulated) is in (Hatchery)) Equal to True
    • Actions
      • Set pos = (Position of (Item being manipulated))
      • Item - Remove (Item being manipulated)
      • Unit - Create 1 Phoenix Egg (building) for (Owner of (Triggering unit)) at pos facing Default building facing degrees
Perhaps this is what you're after, if I am interpretting correctly.
 
Level 7
Joined
Mar 22, 2010
Messages
228
Oh! i got it...
but i have some question about that...

if your hero drops an item in a certain area, something will spawn or something will happen?

add this condition on the trigger i gave ^^

Condtion:(Boolean - Unit in Region)

(Region or Area you want) contains (Hero Manipulating item) equal to TRUE
 
Level 2
Joined
Feb 10, 2010
Messages
13
@Machris 13, Something will spawn, to answer your question.

@Levadam:

My hopes were up :( I thought you may have finally got it :D
I used this trigger, but unfortunately nothing happened. I dropped my item, but it didnt do anything. It was still an item when I dropped it in the region. You seem to be interpretting it right, however.
 
Level 3
Joined
Apr 20, 2010
Messages
46
I've tested it out, the Position of the Item is being caught from where the item was when it was picked up (the item is lost before it is placed on the ground, firing the trigger before it has it's new position).

Try it out, put the egg down in the region, pick it up and put it back down anywhere (inside Or outside the region) and it'll do it.

However, to do what you want, I found This works:

  • Egg In Nest
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Gem Fragment
    • Actions
      • Wait 0.01 game-time seconds
      • Set Pos = (Position of (Item being manipulated))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 000 <gen> contains Pos) Equal to True
        • Then - Actions
          • Item - Remove (Item being manipulated)
          • Unit - Create 1 Farm for (Triggering player) at Pos facing Default building facing degrees
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Pos)
Though I detest having to use the wait, it is seemingly necessary to avoid picking up the old location of the item. I don't know if this is MUI either, so I'm a touch wary of it myself.
 
Last edited:
Level 2
Joined
Feb 10, 2010
Messages
13
I've tested it out, the Position of the Item is being caught from where the item was when it was picked up (the item is lost before it is placed on the ground, firing the trigger before it has it's new position).

Try it out, put the egg down in the region, pick it up and put it back down anywhere (inside Or outside the region) and it'll do it.

However, to do what you want, I found This works:

  • Egg In Nest
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Gem Fragment
    • Actions
      • Wait 0.01 game-time seconds
      • Set Pos = (Position of (Item being manipulated))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 000 <gen> contains Pos) Equal to True
        • Then - Actions
          • Item - Remove (Item being manipulated)
          • Unit - Create 1 Farm for (Triggering player) at Pos facing Default building facing degrees
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Pos)
Though I detest having to use the wait, it is seemingly necessary to avoid picking up the old location of the item. I don't know if this is MUI either, so I'm a touch wary of it myself.



Alrighty. I have that trigger word for word, and it still is having the same problem (item not being replaced by unit)

Could you perhaps make a map that has that trigger? :cry: Obviously its something on my side if that one works for you.
 
Level 3
Joined
Apr 20, 2010
Messages
46
Uh, first the obligatory question of whether you have changed "Gem Fragment" to the right item in your map, and same for farm.

Here's the map where I made and tested the trigger.
 

Attachments

  • EggInNest.w3x
    17.9 KB · Views: 40
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
If you don't want to use wait, then here's a bit more complicated, yet still simple solution, also MUI:


  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
  • Untitled Trigger 008
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Unit Group - Add (Triggering unit) to group
      • Custom script: call SaveItemHandle( udg_Hash , GetHandleId( GetTriggerUnit()) , StringHash("item") , GetManipulatedItem() )
      • Trigger - Turn on Untitled Trigger 009 <gen>
  • Untitled Trigger 009
    • Events
      • Time - Every 0.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • Custom script: set udg_item = LoadItemHandle( udg_Hash , GetHandleId(GetEnumUnit()) , StringHash("item") )
          • Set loc = (Position of item)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Region 000 <gen> contains loc) Equal to True
            • Then - Actions
              • Unit - Create 1 Footman for (Owner of (Picked unit)) at loc facing Default building facing degrees
              • Item - Remove item
            • Else - Actions
              • Game - Display to (All players) the text: False
          • Custom script: call RemoveLocation(udg_loc)
          • Unit Group - Remove (Picked unit) from group
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (group is empty) Equal to True
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions


This is a decent way to create delays in other cases also, if you need them but don't want to use wait. Such cases could be issuing orders to units.
 

Attachments

  • TestMap.w3x
    19.5 KB · Views: 40
Level 2
Joined
Feb 10, 2010
Messages
13
@Levadam:
Yes :p I changed the items to the right ones, thank you.
Anyways, Okay, I did a copy and paste, and this did not work. And yes, I changed the variables to match what I wanted. I don't have a clue whats going on. Is it possible that it will only create buildings instead of units? It created a farm perfectly, but when switched to the egg, a hero unit, it did not work

@Maker:
That's..One intense set of triggers. lol
I did notice a problem though, the trigger is not set up for a specific item, unless I read it wrong. It will make any item get replaced, correct? I need it specifically target an item.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I did notice a problem though, the trigger is not set up for a specific item, unless I read it wrong. It will make any item get replaced, correct? I need it specifically target an item.

Yes, it works for all items. You have to add the item type to the condition. I left it out because I don't know what item you're using and the item type was trivial when dealing with the problem.
 
Level 3
Joined
Apr 20, 2010
Messages
46
I'm confused as to why my triggers aren't behaving properly for you, as I can make any unit or building. However Maker's trigger is much better, being MUI, and it's working as you require which is the important thing.
 
Why does it need a wait? Why are we using position of item instead of position of triggering unit? Is this the twilight zone?

Just change Pharaoh's trigger to this and, unless your item drop range is something ridiculous like 1000, you can use the location of the triggering unit.

  • Trigger
    • Events
      • Unit - A unit drops an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Red Egg
    • Actions
      • Item - Remove (Item being manipulated)
      • Set Loc_01 = (Position of (Triggering unit))
      • Unit - Create 1 Red Egg (Hero) for (Triggering Player) at Loc_01 facing 0.00 degrees
      • Custom script: call RemoveLocation (udg_Loc_01)
 
Level 13
Joined
May 11, 2008
Messages
1,198
well...there's actually an item drop event in the library GT by Jesus4Lyf.

what you do is...check the x and y reals at the bottom left of the region in question, and check the x and y reals at the top right of the region.

then upon the item drop event, of course make sure it's red egg, and then to check to make sure it's dropped in the region...

do
if cxyi(GetManipulatedItem(),-200,-200,200,200)==true then

//the following function should go in a library probably...
function cxyi takes item x, real x1, real y1, real x2, real y2 returns boolean
if GetItemX(x) > x1 and GetItemX(x) < x2 and GetItemY(x) > y1 and GetItemY(x) < y2 then
return true
endif
return false
endfunction//check x and y of item

in this example, we are using the middle of the map fyi.//the middle of the map is 0,0 which is in between -200,-200 and 200,200
 
Level 2
Joined
Feb 10, 2010
Messages
13
And..Bribe is a genius. Sorta.
His trigger didnt work either, but, it made things click perfectly. My region was too big. So after redoing it, I used Levadam's trigger. And, it works perfectly.
Now just to put rep to all the places it is deserved for helping me on such a frustrating task :)
 
Level 13
Joined
May 11, 2008
Messages
1,198
If you don't want to use wait, then here's a bit more complicated, yet still simple solution, also MUI:


  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
  • Untitled Trigger 008
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Unit Group - Add (Triggering unit) to group
      • Custom script: call SaveItemHandle( udg_Hash , GetHandleId( GetTriggerUnit()) , StringHash("item") , GetManipulatedItem() )
      • Trigger - Turn on Untitled Trigger 009 <gen>
  • Untitled Trigger 009
    • Events
      • Time - Every 0.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • Custom script: set udg_item = LoadItemHandle( udg_Hash , GetHandleId(GetEnumUnit()) , StringHash("item") )
          • Set loc = (Position of item)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Region 000 <gen> contains loc) Equal to True
            • Then - Actions
              • Unit - Create 1 Footman for (Owner of (Picked unit)) at loc facing Default building facing degrees
              • Item - Remove item
            • Else - Actions
              • Game - Display to (All players) the text: False
          • Custom script: call RemoveLocation(udg_loc)
          • Unit Group - Remove (Picked unit) from group
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (group is empty) Equal to True
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions


This is a decent way to create delays in other cases also, if you need them but don't want to use wait. Such cases could be issuing orders to units.

cool. someone claiming to post a simple test map for hashtable. now this i gotta check out! i know very little about hashtables, and it doesn't help that jngp doesn't support post 1.24 gui functionality.

it'll be interesting to see how this gui stuff looks in custom text.

edit: region too big? does that mean the regions were overlapping? ^ ^
 
Status
Not open for further replies.
Top