Announcement

Collapse
No announcement yet.

Placing Units inside a building

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Placing Units inside a building

    Looking at Mr Murray ArmA Editing Guide on page 148 doesn't seem to help trying to get a unit inside a building.

    Can someone explain how to do it? The name of the building is House 21 Big.
    Knowing is not enough, we must apply.

    Willing is not enough, we must DO.

  • #2
    Re: Placing Units inside a building

    Best way I've found is to use buidingPos (link: http://community.bistudio.com/wiki/buildingPos ).

    Example would be like this:

    First, get the house you want to put your soldier in, few ways to do this, I'd recommend to get it's ID number (Show IDs, pick it out) and use the nearestObjects command to reference it.

    Then through trial and error place the unit at the various positions in the house (0 - however many), some example code for that:

    In the unit's init
    Code:
    this setPos (house1 buildingPos 3);
    house1 would have to be declared earlier, an example on how to do that, again, few ways to do it:

    Place an invisible H, in it's init:

    Code:
    house1 = (getPos this) nearestObjects 123456;
    123456 is the ID of the house you want.

    Comment


    • #3
      Re: Placing Units inside a building

      Thanks beita. Will try it today.
      Knowing is not enough, we must apply.

      Willing is not enough, we must DO.

      Comment


      • #4
        Re: Placing Units inside a building

        also are you looking at the short version or the deluxe editing guide? If you have mr murrays I beleive that you are missing about 70% of the info for that guide...the deluxe guide has 332 pages so if you have less than that let us know Im sure someone has the link to armaholic's DL for the deluxe guide



        Fate whispers to the warrior "You will not survive the storm."
        The warrior whispers back, "I AM the storm."

        Comment


        • #5
          Re: Placing Units inside a building

          You can also use the RealtimeEditor to spawn AI anywhere you want, you can even give the AI some sandbags at rooftops or mounted weapons. It saved me around up to 20 hours of work, as in the ArmA editor I would have to edit, preview, adjust, edit, preview, adjust... with RTE it's much more easier und less time-consuming.

          http://www.flashpoint1985.com/cgi-bi...T;f=70;t=73011
          http://rte.jonasscholz.de/download

          See an example here:
          http://www.youtube.com/watch?v=BD8J7...eature=related

          You might also put in some of these commands into the init of the soldiers:

          this disableai "move" (AI likes to jump off buildings)

          this setunitpos "up" / this setunitpos "middle" (will prevent AI from going prone the second fighting starts, which would make AI rooftops positions rather useless)
          Last edited by Skychief; 03-28-2009, 11:59 AM.

          Skychief/Icewind.123/Icewindo
          Stargate Mod / Random stuff

          Comment


          • #6
            Re: Placing Units inside a building

            Well I tried to do it and it seems to not be working. First I place an invisible H on the building and in the init I place

            House1 = (getpos this) nearstObjects 46574;

            46574 is the house ID number

            Now for the POW1, I place him on the building and in the units init I place

            this setPos (House1 buildingPos 20);

            Now when I select preview, POW1 is always on the roof. It seems the problem I'm having is the position number to place the POW inside of the building. The building is three stories tall.

            How do I know what the position number is for placing a unit in the building?

            As for RTE I'm still trying to understand how to use it.
            Knowing is not enough, we must apply.

            Willing is not enough, we must DO.

            Comment


            • #7
              Re: Placing Units inside a building

              Ah, I had a typo in the code there, should be "nearestObject" not "nearestObjects", otherwise you will get an array of objects (even if there is only one).

              As for finding the position number ... there isn't really a reference for the various buildings, my suggestion is to start from 0 and go up by 1 until you find the slot you are looking for. Tedious yes, but there isn't really any other option, aside from RTE.

              Comment


              • #8
                Re: Placing Units inside a building

                As a crappy alternative, you could give him a waypoiny on the house and in the waypoint box, there's a house position you can select for him to go to.
                Jex.

                Comment


                • #9
                  Re: Placing Units inside a building

                  Originally posted by beita View Post
                  Ah, I had a typo in the code there, should be "nearestObject" not "nearestObjects", otherwise you will get an array of objects (even if there is only one).

                  As for finding the position number ... there isn't really a reference for the various buildings, my suggestion is to start from 0 and go up by 1 until you find the slot you are looking for. Tedious yes, but there isn't really any other option, aside from RTE.
                  I've done everything you guys said to do and it is not working so I will try to use RTE. This is ridiculous on trying to get it to work.
                  Knowing is not enough, we must apply.

                  Willing is not enough, we must DO.

                  Comment


                  • #10
                    Re: Placing Units inside a building

                    Originally posted by JohnO View Post
                    I've done everything you guys said to do and it is not working so I will try to use RTE. This is ridiculous on trying to get it to work.
                    I'll make a demo mission for you and post the code so you can see how to do it when I get the time.
                    Should be sometime tonight or tomorrow night.
                    "Never forget that you are there to SERVE the soldiers. Listen to your NCOs and always do the right thing." -My Father
                    "http://www.youtube.com/watch?v=wGNxHMFjigA"
                    "http://www.youtube.com/watch?v=Ce0c6qVnJE4"
                    "http://www.youtube.com/watch?v=i2Lpc9vTnqU"
                    "http://www.youtube.com/watch?v=xEzc9fB8xPo"
                    "http://www.youtube.com/watch?v=4tdCTP_ae_8"
                    "http://www.youtube.com/watch?v=RrmoSZgYaFw"

                    Comment


                    • #11
                      Re: Placing Units inside a building

                      Well, I like to do things abit differently. Not really user friendly nor 'faster.'
                      But I like to check things one by one visually, before moving on to the next.
                      Yes very tedious but you know that they are working and there everytime.

                      What I do is place the AI unit manually by placing this into its INIT field;
                      "this setpos [getpos this select 0,getpos this select 1, X]"
                      (X being the height)

                      Also do not forget to add;
                      so the AIs do not move to another location on their own. Which they all tend to do.
                      doMove=false; this/Name disableAI "Move"

                      If it's applicable;
                      this/name setUnitPos "UP" or "Middle"

                      If you really want to be a sadist, you can add;
                      this knowsAbout player = true;

                      Feel free to correct it folks.

                      TGU Instructor TG Pathfinder

                      Former TGU Dean Former ARMA Admin Former Irregulars Officer

                      "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold

                      Comment


                      • #12
                        Re: Placing Units inside a building

                        Hope this demo mission helps
                        http://www.megaupload.com/?d=39S8LADP
                        You need to enter the code and then wait a min before you can download it

                        Note: The method I'm showing only works for buidlings you can enter, for the ones you can't, you can still place units on the roof using lowspeed's method.

                        Code:
                        bldg1 = nearestbuilding building1
                        
                        p1 setpos (bldg1 buildingPos (25))
                        dostop p1
                        p2 setpos (bldg1 buildingPos (27))
                        dostop p2
                        p3 setpos (bldg1 buildingPos (19))
                        dostop p3
                        The first thing to do is to create an object near the desired building.
                        I prefer to use game logic.
                        I created a game logic named building1.
                        After that, you have to declare a variable to use in the scripts.
                        "bldg1 = nearestbuilding building1". I used bldg1

                        The three guys I created are p1, p2, and p3.
                        I moved them in the building [p1 setpos (bldg1 buildingPos (25))] and told them not to move (dostop p1).

                        In the demo mission,
                        Radio alpha executes the listed code code

                        Radio bravo counts the number of positions in a building, which can be useful to know
                        Code:
                        bldg1 = nearestbuilding building1
                        
                        x=0
                        while { format ["%1", bldg1 buildingPos x] != "[0,0,0]" } do {x = x + 1};
                        hint format ["%2: 0 - %1", x-1, "Available positions"];

                        Radio charlie randomly puts the guys in the building
                        Code:
                        bldg1 = nearestbuilding building1
                        
                        p1 setpos (bldg1 buildingPos (random(37)))
                        dostop p1
                        p2 setpos (bldg1 buildingPos (random(37)))
                        dostop p2
                        p3 setpos (bldg1 buildingPos (random(37)))
                        dostop p3
                        Radio delta tells the guys to patrol the building randomly.
                        Code:
                        bldg1 = nearestbuilding building1
                        #Start
                        ~10+(random 10)
                        p1 domove (bldg1 buildingpos (random(37)))
                        p2 domove (bldg1 buildingpos (random(37)))
                        p3 domove (bldg1 buildingpos (random(37)))
                        
                        ~10+(random 10)
                        p1 domove (bldg1 buildingpos (random(37)))
                        p2 domove (bldg1 buildingpos (random(37)))
                        p3 domove (bldg1 buildingpos (random(37)))
                        
                        ~10+(random 10)
                        p1 domove (bldg1 buildingpos (random(37)))
                        p2 domove (bldg1 buildingpos (random(37)))
                        p3 domove (bldg1 buildingpos (random(37)))
                        
                        ~10+(random 10)
                        
                        goto "Start"
                        I had a better explanation of all this junk, but my computer crashed.
                        What are your questions at this time?
                        "Never forget that you are there to SERVE the soldiers. Listen to your NCOs and always do the right thing." -My Father
                        "http://www.youtube.com/watch?v=wGNxHMFjigA"
                        "http://www.youtube.com/watch?v=Ce0c6qVnJE4"
                        "http://www.youtube.com/watch?v=i2Lpc9vTnqU"
                        "http://www.youtube.com/watch?v=xEzc9fB8xPo"
                        "http://www.youtube.com/watch?v=4tdCTP_ae_8"
                        "http://www.youtube.com/watch?v=RrmoSZgYaFw"

                        Comment


                        • #13
                          Re: Placing Units inside a building

                          Originally posted by Igor View Post
                          Hope this demo mission helps
                          http://www.megaupload.com/?d=39S8LADP
                          You need to enter the code and then wait a min before you can download it

                          Note: The method I'm showing only works for buidlings you can enter, for the ones you can't, you can still place units on the roof using lowspeed's method.

                          Code:
                          bldg1 = nearestbuilding building1
                          
                          p1 setpos (bldg1 buildingPos (25))
                          dostop p1
                          p2 setpos (bldg1 buildingPos (27))
                          dostop p2
                          p3 setpos (bldg1 buildingPos (19))
                          dostop p3
                          The first thing to do is to create an object near the desired building.
                          I prefer to use game logic.
                          I created a game logic named building1.
                          After that, you have to declare a variable to use in the scripts.
                          "bldg1 = nearestbuilding building1". I used bldg1

                          The three guys I created are p1, p2, and p3.
                          I moved them in the building [p1 setpos (bldg1 buildingPos (25))] and told them not to move (dostop p1).

                          In the demo mission,
                          Radio alpha executes the listed code code

                          Radio bravo counts the number of positions in a building, which can be useful to know
                          Code:
                          bldg1 = nearestbuilding building1
                          
                          x=0
                          while { format ["%1", bldg1 buildingPos x] != "[0,0,0]" } do {x = x + 1};
                          hint format ["%2: 0 - %1", x-1, "Available positions"];

                          Radio charlie randomly puts the guys in the building
                          Code:
                          bldg1 = nearestbuilding building1
                          
                          p1 setpos (bldg1 buildingPos (random(37)))
                          dostop p1
                          p2 setpos (bldg1 buildingPos (random(37)))
                          dostop p2
                          p3 setpos (bldg1 buildingPos (random(37)))
                          dostop p3
                          Radio delta tells the guys to patrol the building randomly.
                          Code:
                          bldg1 = nearestbuilding building1
                          #Start
                          ~10+(random 10)
                          p1 domove (bldg1 buildingpos (random(37)))
                          p2 domove (bldg1 buildingpos (random(37)))
                          p3 domove (bldg1 buildingpos (random(37)))
                          
                          ~10+(random 10)
                          p1 domove (bldg1 buildingpos (random(37)))
                          p2 domove (bldg1 buildingpos (random(37)))
                          p3 domove (bldg1 buildingpos (random(37)))
                          
                          ~10+(random 10)
                          p1 domove (bldg1 buildingpos (random(37)))
                          p2 domove (bldg1 buildingpos (random(37)))
                          p3 domove (bldg1 buildingpos (random(37)))
                          
                          ~10+(random 10)
                          
                          goto "Start"
                          I had a better explanation of all this junk, but my computer crashed.
                          What are your questions at this time?
                          Thanks, will try it tonight after work.
                          Knowing is not enough, we must apply.

                          Willing is not enough, we must DO.

                          Comment

                          Connect

                          Collapse

                          TeamSpeak 3 Server

                          Collapse

                          Advertisement

                          Collapse

                          Twitter Feed

                          Collapse

                          Working...
                          X