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

[Solved] Not working properly, help?

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set HeroType[1] = Girl Child
      • Set HeroType[2] = Boy Child (blond)
      • Set HeroType[3] = Boy Child (brunette)
      • Set HeroType[4] = Teenage Girl
      • Set HeroType[5] = Teenage Boy
      • Set HeroType[6] = White Woman
      • Set HeroType[7] = White Man
      • Set HeroType[8] = Black Man
      • Set HeroType[9] = Old Man
      • Set HeroRegion[0] = Start Hero Random <gen>
      • Set HeroRegion[1] = Start Hero Girl Child <gen>
      • Set HeroRegion[2] = Start Hero Boy Child Blond <gen>
      • Set HeroRegion[3] = Start Hero Boy Child Brunette <gen>
      • Set HeroRegion[4] = Start Hero Teenage Girl <gen>
      • Set HeroRegion[5] = Start Hero Teenage Boy <gen>
      • Set HeroRegion[6] = Start Hero White Woman <gen>
      • Set HeroRegion[7] = Start Hero White Man <gen>
      • Set HeroRegion[8] = Start Hero Black Man <gen>
      • Set HeroRegion[9] = Start Hero Old Man <gen>
  • Pick Hero
    • Events
      • Unit - A unit enters Start Hero Girl Child <gen>
      • Unit - A unit enters Start Hero Boy Child Blond <gen>
      • Unit - A unit enters Start Hero Boy Child Brunette <gen>
      • Unit - A unit enters Start Hero Teenage Girl <gen>
      • Unit - A unit enters Start Hero Teenage Boy <gen>
      • Unit - A unit enters Start Hero White Woman <gen>
      • Unit - A unit enters Start Hero White Man <gen>
      • Unit - A unit enters Start Hero Black Man <gen>
      • Unit - A unit enters Start Hero Old Man <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Spirit
    • Actions
      • Custom script: local integer int
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local location loc = GetRectCenter(gg_rct_Start_Location)
      • Custom script: local player p = GetOwningPlayer(u)
      • Game - Display to (All players) the text: trigger is running!
      • For each (Integer A) from 0 to 9, do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: loop
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
          • [B] (HeroRegion[(Integer A)] contains (Triggering unit)) Equal to True[/B]
            • Then - Actions
              • Game - Display to (All players) the text: true 1
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer A) Not equal to 0
                • Then - Actions
                  • Game - Display to (All players) the text: true 2
                  • Game - Display to (All players) the text: (String((Integer A)))
                • Else - Actions
                  • Game - Display to (All players) the text: false 2
                  • Custom script: set int = GetRandomInt(1, 8)
                  • Custom script: call DisplayTextToForce( GetPlayersAll(), ( "Random: " + I2S(int) ) )
            • Else - Actions
      • Custom script: set u = null
      • Custom script: set p = null
      • Custom script: call RemoveLocation(loc)

For some reason the regions [0] to [4] isnt working at all.
 
Last edited:
Level 15
Joined
Nov 30, 2007
Messages
1,202
When a unit enters region, the boolean "is unit in region" can still return false.

If you need to detect the entered region, use the system I posted in this thread: http://www.hiveworkshop.com/forums/triggers-scripts-269/checking-region-227234/

Thank you, it worked. One question thought how do I make a function that returns the array of the RectEnter variable?

Hmm isnt the issue that I need the condition which I will be using even with your function? :S
Need to compare the TriggeringRegion with the preset region(loopA)

Nvm this worked:

  • For each (Integer A) from 0 to 2, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (RectEnter[(Integer A)] contains (Position of (Triggering unit))) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: aaa
        • Else - Actions
Thank you again.
 
Last edited:
Level 19
Joined
Aug 8, 2007
Messages
2,765
Thank you, it worked. One question thought how do I make a function that returns the array of the RectEnter variable?

Hmm isnt the issue that I need the condition which I will be using even with your function? :S
Need to compare the TriggeringRegion with the preset region(loopA)

Theres no such thing as Triggering Reigon i dont think..
.
JASS:
GetTriggeringRegion GetTriggeringRect GetTriggerRegion GetTriggerRect

e/ oops im wrong, no idea how to reference it in GUI tho because its a region and not a rect!

you can always do

  • Custom Script: set udg_tempBoolean = Region2Rect(GetTriggeringRegion()) == udg_HeroRegion[bj_forLoopIndexA]
2e/ i have no idea how to convert rect to region

3e/ well i do... make a region and add the rect to it... but i gtg do stuff
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
You need to know which region was entered, right? In my system it will be stored into the variable in enter copy trigger.

I need a number from that region, from my understanding you created a region over it? and then we come back to the comparison;
"(HeroRegion[(Integer A)] contains (Triggering unit)) Equal to True"

Which only works part of the time? Changed to this: "(RectEnter[(Integer A)] contains (Center of Rect)) Equal to True
"


Okey I'm Done.


  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: local region r
      • Custom script: local trigger t
      • Custom script: local location loc
      • Custom script: local unit u
      • -------- ---------------------------------------------- --------
      • -------- Spawn Selectors --------
      • -------- ---------------------------------------------- --------
      • Custom script: set loc = GetRectCenter(gg_rct_Start_Wisp_Spawn)
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
              • ((Player((Integer A))) controller) Equal to User
            • Then - Actions
              • Custom script: call CreateNUnitsAtLoc( 1, 'Hdgo', ConvertedPlayer(GetForLoopIndexA()), PolarProjectionBJ(loc, 128.00, 270.00), bj_UNIT_FACING )
              • Custom script: set u = GetLastCreatedUnit()
              • Custom script: set loc = GetUnitLoc(u)
            • Else - Actions
      • Custom script: call RemoveLocation(loc)
      • Custom script: set u = null
      • Unit - Add Invulnerable (Neutral) to Girl Child 0033 <gen>
      • Unit - Add Invulnerable (Neutral) to Boy Child (blond) 0034 <gen>
      • Unit - Add Invulnerable (Neutral) to Boy Child (brunette) 0035 <gen>
      • Unit - Add Invulnerable (Neutral) to Teenage Girl 0039 <gen>
      • Unit - Add Invulnerable (Neutral) to Teenage Boy 0055 <gen>
      • Unit - Add Invulnerable (Neutral) to White Woman 0025 <gen>
      • Unit - Add Invulnerable (Neutral) to Black Man 0038 <gen>
      • Unit - Add Invulnerable (Neutral) to White Man 0030 <gen>
      • Unit - Add Invulnerable (Neutral) to Old Man 0027 <gen>
      • Set HeroType[1] = Girl Child
      • Set HeroType[2] = Boy Child (blond)
      • Set HeroType[3] = Boy Child (brunette)
      • Set HeroType[4] = Teenage Girl
      • Set HeroType[5] = Teenage Boy
      • Set HeroType[6] = White Woman
      • Set HeroType[7] = White Man
      • Set HeroType[8] = Black Man
      • Set HeroType[9] = Old Man
      • -------- ---------------------------------------------- --------
      • -------- Pick Hero Setup --------
      • -------- ---------------------------------------------- --------
      • Custom script: set t = gg_trg_Pick_Hero
      • Hashtable - Create a hashtable
      • Set WispRegionHash = (Last created hashtable)
      • Set WispRegionOption[0] = Start Hero Random <gen>
      • Set WispRegionOption[1] = Start Hero Girl Child <gen>
      • Set WispRegionOption[2] = Start Hero Boy Child Blond <gen>
      • Set WispRegionOption[3] = Start Hero Boy Child Brunette <gen>
      • Set WispRegionOption[4] = Start Hero Teenage Girl <gen>
      • Set WispRegionOption[5] = Start Hero Teenage Boy <gen>
      • Set WispRegionOption[6] = Start Hero White Woman <gen>
      • Set WispRegionOption[7] = Start Hero White Man <gen>
      • Set WispRegionOption[8] = Start Hero Black Man <gen>
      • Set WispRegionOption[9] = Start Hero Old Man <gen>
      • For each (Integer A) from 0 to 9, do (Actions)
        • Loop - Actions
          • Custom script: set r = CreateRegion()
          • Custom script: call RegionAddRect(r, udg_WispRegionOption[bj_forLoopAIndex])
          • Custom script: call TriggerRegisterEnterRegion(t, r, null)
          • Custom script: call SaveRectHandle(udg_WispRegionHash , GetHandleId(r), 0, udg_WispRegionOption[bj_forLoopAIndex] )
      • Custom script: set r = null
      • -------- ---------------------------------------------- --------
  • Pick Hero
    • Events
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Spirit
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local integer int
      • Custom script: local player p = GetOwningPlayer(u)
      • Custom script: local location loc = GetRectCenter(gg_rct_Start_Location)
      • Custom script: set udg_WispRegion = LoadRectHandle(udg_WispRegionHash , GetHandleId(GetTriggeringRegion()) , 0)
      • Custom script: call RemoveUnit(u)
      • For each (Integer A) from 0 to 9, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (WispRegionOption[(Integer A)] contains (Center of WispRegion)) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer A) Not equal to 0
                • Then - Actions
                  • Custom script: call CreateNUnitsAtLoc( 1, udg_HeroType[GetForLoopIndexA()], p, loc, bj_UNIT_FACING )
                  • Custom script: set u = GetLastCreatedUnit()
                • Else - Actions
                  • Custom script: set int = GetRandomInt(1, 9)
                  • Custom script: call CreateNUnitsAtLoc( 1, udg_HeroType[int], p, loc, bj_UNIT_FACING )
                  • Custom script: set u = GetLastCreatedUnit()
            • Else - Actions
      • Custom script: call PanCameraToTimedLocForPlayer(p, loc, 0 )
      • Custom script: call SelectUnitForPlayerSingle( u, p )
      • Custom script: set udg_HeroUnit[GetConvertedPlayerId(p)] = u
      • -------- --------
      • Custom script: call RemoveLocation(loc)
      • Custom script: set u = null
      • Custom script: set p = null
 
Last edited:
Level 15
Joined
Nov 30, 2007
Messages
1,202
  • Custom script : call SaveInteger(udg_WispRegionHash , GetHandleId(r), 1, bj_forLoopAIndex)
  • Custom script : set udg_integer = LoadInteger(udg_WispRegionHash , GetHandleId(GetTriggeringRegion()), 1)

  • Pick Hero
    • Events
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Spirit
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local integer int
      • Custom script: local player p = GetOwningPlayer(u)
      • Custom script: local location loc = GetRectCenter(gg_rct_Start_Location)
      • Custom script: set udg_integer = LoadInteger(udg_WispRegionHash , GetHandleId(GetTriggeringRegion()), 1)
      • Custom script: call RemoveUnit(u)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WispRegionOption[integer] contains (Center of WispRegion)) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • integer Not equal to 0
            • Then - Actions
              • Game - Display to (All players) the text: 1
              • Custom script: call CreateNUnitsAtLoc( 1, udg_HeroType[udg_integer], p, loc, bj_UNIT_FACING )
              • Custom script: set u = GetLastCreatedUnit()
            • Else - Actions
              • Game - Display to (All players) the text: 2
              • Custom script: set int = GetRandomInt(1, 9)
              • Custom script: call CreateNUnitsAtLoc( 1, udg_HeroType[udg_integer], p, loc, bj_UNIT_FACING )
              • Custom script: set u = GetLastCreatedUnit()
        • Else - Action
I tried that and the if then else didnt work?
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
This is not related to the topic, but to the hashtable I belive.

I have two variables udg_unit and udg_unit1[x] or...

I need to extract the x intiger by comparing the two units but I'm not sure exactly how to do it but I'm assuming it is related to a similar thing done above. (So I dont have to loop through the entire series.)

As you can see this looks really messy...
  • Door Open
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Options
      • (Ability being cast) Equal to Open Door
    • Actions
      • Game - Display to (All players) the text: Open Door!
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • InteractionSelectedDest[(Player number of (Triggering player))] Equal to (Picked destructible)
            • Then - Actions
              • Game - Display to (All players) the text: Destruct Found!
              • For each (Integer A) from 0 to 999, do (Actions)
                • Loop - Actions
                  • Destructible - Pick every destructible in DoorRect[(Integer A)] and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • InteractionSelectedDest[(Player number of (Triggering player))] Equal to (Picked destructible)
                        • Then - Actions
                          • Custom script: call RemoveUnit(udg_InteractionOptionsUnit[GetConvertedPlayerId(GetTriggerPlayer())])
                          • Custom script: set udg_InteractionOptionsUnit[GetConvertedPlayerId(GetTriggerPlayer())] = null
                          • Game - Display to (All players) the text: Array Found!
                          • Destructible - Pick every destructible in DoorRect[(Integer A)] and do (Actions)
                            • Loop - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Destructible-type of (Picked destructible)) Equal to Gate Closed (Elven)
                                • Then - Actions
                                  • Destructible - Open (Picked destructible)
                                  • Destructible - Hide (Picked destructible)
                                • Else - Actions
                                  • Destructible - Show (Picked destructible)
                          • Skip remaining actions
                        • Else - Actions
            • Else - Actions
I need to compare picked destructible with the region it is in.
 
Last edited:
Level 19
Joined
Aug 8, 2007
Messages
2,765
well you can use avl trees to create dynamic groups in every region... but your using gui... so thats the best you got
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
well you can use avl trees to create dynamic groups in every region... but your using gui... so thats the best you got

Okay, too bad. I updated it slightly but didnt get rid of the loop.

  • Door Open
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Options
      • (Ability being cast) Equal to Open Door
    • Actions
      • For each (Integer A) from 0 to 200, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • InteractionSelectedDest[(Player number of (Triggering player))] Equal to DoorDestClosed[(Integer A)]
            • Then - Actions
              • Custom script: call SelectUnitRemove(udg_InteractionOptionsUnit[GetConvertedPlayerId(GetTriggerPlayer())])
              • Destructible - Open DoorDestClosed[(Integer A)]
              • Destructible - Hide DoorDestClosed[(Integer A)]
              • Destructible - Show DoorDestOpen[(Integer A)]
              • Set DoorLocked[(Integer A)] = False
              • Custom script: return
            • Else - Actions
 
Status
Not open for further replies.
Top