• 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.

Two awkward questions.

Status
Not open for further replies.
Level 4
Joined
Jul 25, 2007
Messages
71
1. (I posted it in my old thread but got no response) A unit picks up a "Lurker skull". And then, the unit tries o pick up another one. I want a message to say "You can only hold one of this item". Here's what I have so far, but it doesn't work. Instead, each time a unit picks up the skull, it drops it. No matter what.
  • onlyOneLurkerSkull
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to |cffEEE8AAFragment of the Lurker's skull|r
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Hero manipulating item)) Equal to (Player((Integer A)))
              • ((Hero manipulating item) has an item of type |cffEEE8AAFragment of the Lurker's skull|r) Equal to False
            • Then - Actions
              • Do nothing
            • Else - Actions
              • Hero - Drop (Item being manipulated) from (Hero manipulating item)
              • Game - Display to (Player group((Player((Integer A))))) the text: |cff696969You may o...

2. I was going to make the minimap on my game completely black. I know how to do that.. (My map is huge, and it's an RPG). Later on in the game, I'd like to make an item named "Map". And when you use the map, a giant fade filter that I'll make in photoshop will cover the screen. But the problem I'm worried about.. Is individual player filters. Can a fade filter be applied for ONLY the owner of casting unit? Or must it apply to all players?
 
Level 11
Joined
Jun 20, 2009
Messages
880
What for that For each Integer A is there? Just replace it with If / Then / Else, Multible functions.

  • Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Crown of Kings +5
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has an item of type Crown of Kings +5) Equal to True
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
          • Game - Display to (All players) for 104.00 seconds the text: You already have th...
        • Else - Actions
 
Level 4
Joined
Jul 25, 2007
Messages
71
Thank you very much for your input, but as I was saying before... That trigger seems like it would work, but instead the hero drops the item (Even if they don't already have one). Here's how it works..

1. Hero obtains skull
2. If hero has item (skull) then drop (skull)

See the issue? As soon as the hero picks up a skull, it is forced to drop it. Because he has only one. There needs to be some way to check if he has 2 skulls, otherwise it won't work.
 
Level 4
Joined
Jul 25, 2007
Messages
71
Just for kicks, I've tested exactly what you coded, and it doesn't work. Because when the trigger checks if the unit has an item, it sees the item it recently picked up (The item that tiggered the trigger to run), and drops it.
 
Level 2
Joined
Jul 9, 2008
Messages
25
You need two triggers. Here is an example I'm using in my map. It uses item classes rather than item types, but that can easily be changed. The example I am using is only meant to apply to one hero. You need to make a different copy of the trigger and the variable for each hero that might pick it up.

TRIGGER 1
Events
Unit - A unit Acquires an item
Conditions
(Triggering unit) Equal to YOUR HERO <gen>
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item being manipulated)) Equal to Artifact
BOOLEAN VARIABLE Equal to False
Then - Actions
Set BOOLEAN VARIABLE = True
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item being manipulated)) Equal to Artifact
BOOLEAN VARIABLE Equal to True
Then - Actions
Trigger - Turn off TRIGGER 2 <gen>
Item - Move (Item being manipulated) to (Position of (Triggering unit))
Game - Display to (All players) the text: Only one weapon can...
Wait 0.01 game-time seconds
Trigger - Turn on TRIGGER 2 <gen>
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item being manipulated)) Equal to Artifact
BOOLEAN VARIABLE Equal to False
Then - Actions
Set BOOLEAN VARIABLE = True
Else - Actions
Do nothing


TRIGGER 2
Events
Unit - A unit owned by Player 1 (Red) Loses an item
Conditions
(Triggering unit) Equal to YOUR HERO <gen>
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-class of (Item being manipulated)) Equal to Artifact
BOOLEAN VARIABLE Equal to True
Then - Actions
Set BOOLEAN VARIABLE = False
Wait 0.01 game-time seconds
Else - Actions
Do nothing

That should work, it has for me. the only problem is that it ends up being a lot of work if you have more than a few heroes.
 
Level 8
Joined
Jun 26, 2010
Messages
530
I never knew that "unit has item" event, i always used the one i posted on the other trigger lol. Too simple...it's good to know this one ;D
Also, modding the trigger Kala showed so it works is VERY simple. There you got only 1 trigger that apply to all the itens you want (simply using conditions - or).
I don't tested it, but i "tested it's logic". It WILL work ;D

[TRIGGER="Item"]
Events
Unit - A unit Acquires an item
Conditions
((Triggering unit) has an item of type (item being manipulated) Equal to True
Conditions - OR
(Item-type of (Item being manipulated)) Equal to Crown of Kings +5
---insert the same condition with other itens here for the other itens you want to limit for 1 per hero---
Actions
Hero - Drop (Item being manipulated) from (Hero manipulating item)
Game - Display to (All players) for 104.00 seconds the text: You already have a (item name of item being manipulated)[/TRIGGER]
 
Level 4
Joined
Jul 23, 2008
Messages
99
With loop from 1 to 6, check all inventory slots. Then, each slot that find "item", udg_counter value is added by 1. Next, if udg_counter >1 then drop item in "Integer A" and Skip Remaining Actions.

Understand?
(actually I have built this function, but now I browse this page with Cell Phone, not PC... Sorry for these limitations...)
 
Level 8
Joined
Jun 26, 2010
Messages
530
With loop from 1 to 6, check all inventory slots. Then, each slot that find "item", udg_counter value is added by 1. Next, if udg_counter >1 then drop item in "Integer A" and Skip Remaining Actions.

Understand?
(actually I have built this function, but now I browse this page with Cell Phone, not PC... Sorry for these limitations...)

I used to use Loop from 1 to 6 too. Untill i sow someone talking 'bout a "Unit has item" condition here. I suppose that by posting by your phone you overlooked the trigger i posted. It's simpler and works :)
 
Status
Not open for further replies.
Top