HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Another Trigger Question...

10-09-2004, 05:10 PM#1
PatruX
What I want:
Every 2 seconds this trigger will check if any of those items (PotionA,B,C) is in the region called 'Herbs'. IF ANY of those Potions is in the region nothing will happen. But, IF NONE of those potions is in the region, 1 random PotionA, B or C will be created.


Code:
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Item - Pick every item in Herbs <gen> and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-type of (Picked item)) Equal to [b]PotionA[/b]
                        (Item-type of (Picked item)) Equal to [b]PotionB[/b]
                        (Item-type of (Picked item)) Equal to [b]PotionC[/b]
                    Then - Actions
                        Do nothing
                    Else - Actions
                        Set DiceSuccessRate = (Random integer number between 1 and 3)
                        If (DiceSuccessRate Equal to 1) then do (Item - Create [b]PotionA[/b] at (Center of Herbs <gen>)) else do (Do nothing)
                        If (DiceSuccessRate Equal to 2) then do (Item - Create [b]PotionB[/b] at (Center of Herbs <gen>)) else do (Do nothing)
                        If (DiceSuccessRate Equal to 3) then do (Item - Create [b]PotionC[/b] at (Center of Herbs <gen>)) else do (Do nothing)

But it seems that if NONE of those Potions exists in the region the IF, THEN/ELSE action won't run at all!
10-09-2004, 07:03 PM#2
Dead-Inside
Umm... You're checking if the item is ALL of the items (Item A, B and C). You should check if it's ONE of them, use an OR condition and put it before those (Or - Multiple actions).

Problem solved eh?
10-09-2004, 07:10 PM#3
th15
To be precise, you should use an interger comparison as your condition instead of item-type comparison.

It should count the number of items in the specified area with type = to A OR B or C.
10-09-2004, 07:33 PM#4
PatruX
In reply to Dead-Inside:
I've already tried that, however I got about the same result.

In reply to th15:
I've searched but never found that function.
10-09-2004, 08:44 PM#5
Dead-Inside
For This' suggestion, you're going with Integer comparsion.
10-09-2004, 09:26 PM#6
PatruX
Could you be more specific?

I've searched it (as I said) but w/o result.
10-10-2004, 01:30 AM#7
th15
Oh hell, that condition doesn't exist for items, it exists for units so I kinda assumed... This is going to be a little more complex; Lemme re-write that trigger for you...

Code:
Event:
Every 2 seconds

Aciton:
Pick every Item in Herb Area and
     do:
          IF-THEN-ELSE
               Condition: OR-
                                 -Item type of picked item = A
                                 -Item type of picked item = B
                                 -Item type of picked item = C
                Then do: Skip remaining actions
                 Else do: Do nothing
          Create 1 random potion

This code picks all items in the specified area, if it finds a potion type item, it stops the trigger, preventing it from carrying out the next action (which, is NOT part of the if-then-else) which creates a random potion.
10-10-2004, 11:00 AM#8
PatruX
Quote:
Originally Posted by th15
Oh hell, that condition doesn't exist for items, it exists for units so I kinda assumed... This is going to be a little more complex; Lemme re-write that trigger for you...

Code:
Event:
Every 2 seconds

Aciton:
Pick every Item in Herb Area and
     do:
          IF-THEN-ELSE
               Condition: OR-
                                 -Item type of picked item = A
                                 -Item type of picked item = B
                                 -Item type of picked item = C
                Then do: Skip remaining actions
                 Else do: Do nothing
          Create 1 random potion

This code picks all items in the specified area, if it finds a potion type item, it stops the trigger, preventing it from carrying out the next action (which, is NOT part of the if-then-else) which creates a random potion.

Will it work if I set the 'Create 1 random potion' as Else Action?
Since I'm going to use more than one 'Pick every item in region X' in this trigger.
10-10-2004, 01:39 PM#9
Anitarf
Quote:
Originally Posted by PatruX
Will it work if I set the 'Create 1 random potion' as Else Action?
Since I'm going to use more than one 'Pick every item in region X' in this trigger.

No, you can't put it under else actions. Think logically: if you put it there, then a potion will be created for each non-potion item the trigger finds before it finds a potion one (because when it finds a potion item, it stops the trigger). The create item action must be at the end of the trigger, if you use this system.

And you can't use multiple pick-every-item loops with such system, because the moment it finds one potion, it stops the trigger, not running any other actions that come afterwards. With this system, you have to put every item-check in a seperate trigger.
10-10-2004, 04:30 PM#10
PatruX
Alright, I'll guess I need to make a couple of triggers instead then.
Thank you all--
10-10-2004, 07:53 PM#11
PatruX
Seems like it didn't work this time either..

IF any of those items are in the region the trigger will stop.

However if NONE of those exists in the region, the Loop Actions won't be run at all for some unknown reason.

Kinda Weird...
10-10-2004, 09:24 PM#12
Gandalf2349
That trigger won't work either. Think about it. There is a potion A in the zone and a tome X. It picks tome X. It is not potion A, B, or C. So it makes a potion.

What you need to do is at the start nm. I'll explain:
Code:
Events
 Every 2 Seconds
Conditions
Actions
 -Set boolItemInZone = False
  -Pick every item in (Zone)
   -If
    -Condition
     -Or
      -Item Type = Potion A
      -Item Type = Potion B
      -Item Type = Potion C
    -Then
     -Set boolItemInZone = True
    -Else
 -If (boolItemInZone) = False
  -Then
   -Create 1 random potion
  -Else

I'm pretty sure that will work.