• 🏆 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] Unit Enters Region - Array?

Status
Not open for further replies.
Level 8
Joined
Feb 20, 2007
Messages
338
Can I use a region array variable as an entering region?

I have:

  • Set Mnt_array[1] = Mnt <gen>
  • (through)
  • Set Mnt_array[28] = Mnt Copy 28 <gen>
I need all of these to be 'one region' they over lap here and there. It is necessary for my camera to work properly.

I have tried:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Leaving unit) Equal to (Random unit from (Units in Mnt_array[(Integer A)]))
    • Then - Actions
    • Else - Actions
      • Set CamSetting = 0
As my leaving the region action.

What I want is for the camera to remain "Set CamSetting = 7" if the unit leaves one of those 28 regions entering into an overlapping region of that array, and to reset to CamSetting 0 when it leaves into any other region or area without a region (No region).

It would be great is my event could be something like:

"Unit - A unit enters Mnt_array[(Integer A)] <gen>" (or leaves).

Why I need this is to prevent the low Angle of Attack of my camera from going through hills showing the sky box below/through the hills. For things like hills my AOA and distance from the target unit increases, for flat areas the AOA lowers back down and the distance to target reduces.

This is a single player, camara following (locked to) the player's unit.
 
Level 5
Joined
Jan 25, 2006
Messages
103
I think its possible to achieve your goal without using variables.

Though yes, you can use region array, you just need to set it properly.
Also it might be a good idea, since you are using only 1 player to make it player red leaves region xx
set camsetting=0, instead of random units.

Also isn't there like too much work, like setting the camera angle for every single region?

Anyways from what I understand from your question this is my answer, if it does not answer ur question, please post better formated and clearer question.
 
Level 8
Joined
Feb 20, 2007
Messages
338
Setting the camera is 'relatively' easy. Camsetting is within another trigger that modifies things like FarZ, angle of attack, Z offset, distance to target.

In theory I only need 3 camera settings - the 'default' flattish areas where the camera is near to the ground behind the unit, a lower setting for a special region (under a tree ;-) ), and then the higher, farther camera. All set via setting the variable CamSetting to 0, 1 or 2.

This thread: http://www.hiveworkshop.com/forums/f269/need-help-camera-unit-height-trigger-42324/ unanswered and closed has my triggers for Cam setting. this older version had flying units, had a catapult and various other units the player could use. The 'new version' is being simplified to just a ground unit with high, medium and low cameras.

The Camera z offset has been the biggest problem of mine. I have tried various things like finding and calling the current z position of the unit (that did not work too well), I have tried changing the camera setting by each region.

This thread: http://www.hiveworkshop.com/forums/f269/first-person-camera-set-up-41750/ has screen shots of my on going quest to make a better RPG camera mode. I think I got a few more in my 'threads started'.

I scrapped the project months ago - never fully satisfied with what I got.

Its a mishmash of 'triggering unit' and 'player gray' Initially I wanted a multi-player RPG system until I realized that my map would be to large to host by most hosting computers - so I switched up to just a single player.

My problems have been the limits of an editor map. For instance if the hills are too high, the camera shows what lies beneath. If the camera is too high the end of the world looks like crap.

In 2007 I asked how to combine rects/regions into one rect/region: http://www.hiveworkshop.com/forums/f98/how-do-i-connect-multiple-regions-make-region-44339/

While it appears to work for some things, my camera never ever went up (or down) it remained the same.

Now what I could do is just flatten the map and leave off with changing the AOA and height of the cam.

but then the map looks like a big steamy pile of..... Shaving cream :wink:
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Regions work perfectly fine, you are likely doing it wrong.

JASS:
//assuming you don't use JNGP
function InitTrig_YourTrigger takes nothing returns nothing
    local region r = CreateRegion()
    local trigger t = CreateTrigger()
    call RegionAddRect(r,gg_rct_Mnt)
    call RegionAddRect(r,gg_rct_Mnt_Copy)
    //...
    call RegionAddRect(r,gg_rct_Mnt_Copy_28)//caps matters
    call TriggerRegisterUnitEnterRegion(t,r,null)
    call TriggerAddCondition(t,Condition(function YourConditionFunc))
    call TriggerAddAction(t,function YourActionFunc)
endfunction

Yes, you asked for GUI. Yes, I posted in Jass. Why? Regions are not available for use in GUI (the GUI 'region' is actually a rect).

Also, you are using the wrong approach to check if your unit is in an array. Replace said array with a unit group, then use the Unit Group Contains Unit boolean.
 
Status
Not open for further replies.
Top