• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Unit gaining level from item crash

Status
Not open for further replies.
Level 5
Joined
Sep 21, 2005
Messages
119
Hey guys, I'm sure this has been asked before many times, but how do you make a normal unit NOT crash the game when it uses an item that has a level gain on it?

I've tried every kind of stop action or even removing the unit with triggers, but nothing works..

What should I do?
 
Level 5
Joined
Jan 11, 2006
Messages
110
Just change the items function upon being taken

Stats - Used Automatically W... True
To this
Stats - Used Automatically W... False
Then the item must be clicked instead of being used automatically upon being aquired.
Although, they can still use the item so change their inventory so they cant use items but i guess that conflicts with your previous thing
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Simply make it that the item is not consumed on pick up. You then create a trigger which automatically uses it when a hero picks it up. Thus it will be like auto used when a hero trys to pick it up but it will not be used when a unit tries.

However another system is needed to use it if the hero's inventory is full which probably will need JASS but really it is not needed.
 
Level 5
Joined
Sep 21, 2005
Messages
119
Thanks for the help.. I haven't tried the dummy thing yet like I said I was going to, cause I just got home, Dr, I might try it your way,.. I know what you mean.. but it may be harder than to just make a dummy item, if I AM using triggers in the first place.. because if the item isn't USABLE (it can't be usable at all, because they can't be able to click it), then you need a seperate trigger for another item anyway..

Either way, thanks a lot. If anyone else has a question about this, especially all of you LoaP Fans, then I suggest doing what hawk said, and make a dummy item.
Thanks again... Now I just gotta figure out how to make neutral hostile attack and break down gates =\ lol.
 
Level 5
Joined
Sep 21, 2005
Messages
119
Well the gate question is sort of a thing I would expect someone to be like "Hey yeah, how DO you do that" and continue on..

If you DO have any suggestions, be my guest. I've already tried the order a unitground to attack a destructible of type gate within 500 radius every 5 sec of game time or so.. but it doesn't work with mass units... So yeah if you have an easy way, go right ahead and explain, remember.. something that's scaled up from a small map may not work right on a larger-sized map.
 
Level 5
Joined
Sep 21, 2005
Messages
119
Heh.. it's not that easy..

It's sort of a zombie map, and there are constant zombie spawns at different locations, they are all set to unit groups, but the way the trigger works now is

  • Time - Every 5.5 sec of game time:
  • For each (Integer A) from 1 to Zombie_Counter[1], do (Actions)
    • Loop - Actions
      • Unit Group - Pick every unit in Zombie_Groups[(Integer A)] and do (Actions)
        • Loop - Actions
          • Destructible - Pick every destructible within 500.00 of (Position of (Picked unit)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Diagonal 1)
                      • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Diagonal 2)
                      • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Horizontal)
                      • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Vertical)
                      • (Destructible-type of (Picked destructible)) Equal to Gate (Diagonal 1)
                      • (Destructible-type of (Picked destructible)) Equal to Gate (Diagonal 2)
                      • (Destructible-type of (Picked destructible)) Equal to Gang Door (Horizontal)
                      • (Destructible-type of (Picked destructible)) Equal to Door (Vertical)
                • Then - Actions
                  • Unit - Order (Picked unit) to Attack (Picked destructible)
                • Else - Actions
                  • Do nothing

P.S: I DID NOT WRITE THIS TRIGGER. I wrote one similiar that worked on my smaller map without using the For Next.. I don't know if that's the laggy part or not, but either way, it lags like hell.
 
Last edited by a moderator:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
To expand on hawk900.

  • Destructible - Pick every destructible within 500.00 of (Position of (Picked unit)) and do (Actions)
Leaks 1 location (Position of (Picked unit)) per loop every 5.5 seconds of gameplay. Such a leak could slowly add up and noticably decrease FPS late game.

To remove it I recomend reading that handy leak sticky written by Ralle in the triggers forum section.
 
Level 24
Joined
May 9, 2007
Messages
3,563
Yes, or look at this.
  • Villager Spawn
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set RandomNumber = (Random real number between 0.00 and 1.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomNumber Less than or equal to 0.15
        • Then - Actions
          • Set TempPoint = (Random point in (Playable map area))
          • Unit - Create 1 Villager for Neutral Hostile at TempPoint facing Default building facing degrees
          • Cinematic - Ping minimap for (All players) at TempPoint for 1.00 seconds
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions

This trigger is from one of the maps that I am working on. Ignore the effect and focus on the call RemoveLocation(udg_TempPoint).

TempPoint is a point variable that is assigned at the start of the game.

call RemoveLocation is the function

also call DestroyGroup is another one

then (udg_YourVariable)

udg_ precedes your variable name.
 
Level 5
Joined
Sep 21, 2005
Messages
119
Sry.. for some reason, my post showed up way too late :S...
That was supposed to be right after your "Make leakless" post..

Anyway, yeah I know how to clean it up... it's not that.. I think that that's NOT the case though.. I don't think it's a leak problem, I think it's a single-time execution problem because it starts to lag right on the first time, and I Don't want to go through making it leakless if I know it's still going to lag afterwards... any easier suggestions vs using every time of gametime?
I WILL go through either way aand test it, it may work... If you have no more ideas, I'll get back to you guys about if it worked or not.
 
Level 5
Joined
Sep 21, 2005
Messages
119
Okay so I looked through the "Things that Leak" thread, couldn't find anything to help me with picking destructibles, any ideas?

Also, I now destroy the unit group variable after each run, what else can i optimize in there?

This is what I have so far btw:
  • Zombies Attack Gates
    • Events
      • Time - Every 5.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to Zombie_Counter[1], do (Actions)
        • Loop - Actions
          • Set ZombieGateAttackGroups = Zombie_Groups[(Integer A)]
          • Unit Group - Pick every unit in ZombieGateAttackGroups and do (Actions)
            • Loop - Actions
              • Destructible - Pick every destructible within 500.00 of (Position of (Picked unit)) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Diagonal 1)
                          • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Diagonal 2)
                          • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Horizontal)
                          • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Vertical)
                          • (Destructible-type of (Picked destructible)) Equal to Gate (Diagonal 1)
                          • (Destructible-type of (Picked destructible)) Equal to Gate (Diagonal 2)
                          • (Destructible-type of (Picked destructible)) Equal to Gang Door (Horizontal)
                          • (Destructible-type of (Picked destructible)) Equal to Door (Vertical)
                    • Then - Actions
                      • Unit - Order (Picked unit) to Attack (Picked destructible)
                      • Custom script: call DestroyGroup(udg_ZombieAttackGroups)
                    • Else - Actions
                      • Do nothing
 
Level 5
Joined
Sep 21, 2005
Messages
119
Okay well it doesn't matter cause I re-did the trigger a little, it looks like this now:

  • Attack gates
    • Events
      • Time - Every 5.50 seconds of game time
    • Conditions
    • Actions
      • Set ZombieGateAttackGroups = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Zombie (Real Zombie)) or ((Unit-type of (Matching unit)) Equal to Hunter)))
      • Unit Group - Pick every unit in ZombieGateAttackGroups and do (Actions)
        • Loop - Actions
          • Destructible - Pick every destructible within 500.00 of (Position of (Picked unit)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked destructible) is alive) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Diagonal 1)
                          • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Diagonal 2)
                          • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Horizontal)
                          • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Vertical)
                          • (Destructible-type of (Picked destructible)) Equal to Gate (Diagonal 1)
                          • (Destructible-type of (Picked destructible)) Equal to Gate (Diagonal 2)
                          • (Destructible-type of (Picked destructible)) Equal to Gang Door (Horizontal)
                          • (Destructible-type of (Picked destructible)) Equal to Door (Vertical)
                    • Then - Actions
                      • Unit - Order (Picked unit) to Attack (Picked destructible)
                      • Custom script: call DestroyGroup(udg_ZombieGateAttackGroups)
                    • Else - Actions
                      • Custom script: call DestroyGroup(udg_ZombieGateAttackGroups)
                • Else - Actions
                  • Custom script: call DestroyGroup(udg_ZombieGateAttackGroups)
 
Level 5
Joined
Sep 21, 2005
Messages
119
So after quite a long time, the trigger now looks like this:

  • Attack gates
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set ZombieGateAttackGroups = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Zombie (Real Zombie)) or ((Unit-type of (Matching unit)) Equal to Hunter)))
      • Unit Group - Pick every unit in ZombieGateAttackGroups and do (Actions)
        • Loop - Actions
          • Set Temp_Point = (Position of (Picked unit))
          • Destructible - Pick every destructible within 500.00 of Temp_Point and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked destructible) is alive) Equal to True
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Horizontal)
                      • (Destructible-type of (Picked destructible)) Equal to Elven Gate (Vertical)
                      • (Destructible-type of (Picked destructible)) Equal to Gate (Diagonal 1)
                      • (Destructible-type of (Picked destructible)) Equal to Gate (Diagonal 2)
                      • (Destructible-type of (Picked destructible)) Equal to Gang Door (Horizontal)
                      • (Destructible-type of (Picked destructible)) Equal to Door (Vertical)
                • Then - Actions
                  • Unit - Order (Picked unit) to Attack (Picked destructible)
                • Else - Actions
      • Custom script: call DestroyGroup(udg_ZombieGateAttackGroups)
It still lags in multiplayer x_X... I posted it as a request, and as a seperate thread.. looks like noone here really knows how to make units attack gates that are destructibles without leaking. Maybe it's the fact that there are a lot of units on the map of the type but w/e...
 
Status
Not open for further replies.
Top