• 0

    posted a message on Draw a line between 2 points?

    I wish to draw a line or a beam between 2 arbitrary points. Can anyone lend some assistance on how to acheive this? (The tutorial on beams is not too helpful when I lack any units)

    Posted in: Miscellaneous Development
  • 0

    posted a message on Can Functions Return Arrays?

    @Kenterik: Go

    Since pointers were removed there is no elegant way to do this. The usual approach to returning dynamic objects is to create a global array (or in this case a 2 dimentional array) and associate an index with your object.

    For instance you could have the function RandPoint(int whichArray) and it would assign the 10 random points to an array RandPoints[<your points>][<which array>]. Make the second dimension large enough and reuse indices.

    If you REALLY want it to be on the fly, you could do something ugly like create a unit and store the points in the unit's custom values.

    (Curious to know how your algorithm works)

    Posted in: Triggers
  • 0

    posted a message on When working on a map how do you keep the ideas rolling?

    @gizmachu: Go

    Read a fantasy book or play some immersive RPGs (Baldur's Gate series is great at this. If you play BG2, I guarantee you will never run out of ideas for quests). If you want something more spacey, KOTOR is good.

    If you have a group of imaginative people, role playing is another great way to brainstorm.

    Unless you've got your head flowing full of ideas, there's really no point in working on such maps. Better to stop and let your ideas develop (or work on the technical stuff like inventory systems). Otherwise it makes for a dull experience for both the mapper (hitting blocks frequently, putting off the map for long periods of time, eventually abandoning it) and the person playing it.

    Posted in: General Chat
  • 0

    posted a message on Giving a unique in-editor identifier to units?

    Another way would be to assign a custom value to each unit. You can store a real number in any of the values, and I believe they range from -524 288 to 524 288 in increments of 1/4096.

    So it would be something like

    real x = -524 288.0

    Unit is Created x += 1/4096 Set (Last Created Unit) Custom Value 0 to (x) myProbe1 = x

    With a range of 32 bits, you can assign unique Ids to all your units and never worry about running out.

    Posted in: Miscellaneous Development
  • 0

    posted a message on What does preload and syncronize bank do?

    @PSGMud: Go Purpose of preloading:

    Banks have to be preloaded into the cache at map init before they can be used. In other words you can't open any more banks after the game has finished loading (Imagine if you could! wow, you could inject so much arbitrary data at runtime from third party programs).

    Normally when you open a bank, you address it by its literal name. The game looks for these and automatically preloads them.

    However, if you try to open a bank using some generated scheme like ("bank" + PlayerName(1)), the bank will fail to open. It has to be explicitly preloaded by its literal name before such schemes will work.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Random Algorithm

    @Naim2k10: Go

    That will not give you an unbiased result. That algorithm does N number of random swaps. Thus permutations that require less swaps have more ways to be generated than ones that require close to N swaps. Another way of putting it is that if you were to go through every case of doing N swaps, you would count some permutations more than others, so they would be more likely to come up. It's better to use the Fisher-Yates shuffle (as outlined below), as it counts every permutation only once.

    @BasicGear: Go

    You have a set of locations and you want to assign them to a set of items. The classic way of doing this unbiasedly that everyone is familiar with is to assign them numbers, toss them into a hat and pick them out randomly one by one to generate a permutation. When you do this, it doesn't even matter in what order you assign the numbers to the items. For instance, for 4 items/locations, we randomly generate the sequence a={1,0,3,2} and each item[i] will correspond to Location[a[i]]. The locations have thus been randomly and unbiasedly shuffled (provided your permutation have been randomly and unbiasedly generated).

    The actual generation of the permutation goes as follows. You set up a sequence of numbers 0-24 and pick one randomly (since we're picking randomly it doesn't matter if you have an ordered sequence of numbers or a random distribution in a hat). Then you swap this number with the very last number to keep track of it. Now the remaining unshuffled numbers are in the first 24 elements and your shuffled one is in the last element, which is no longer part of the pool. This is repeated for the remaining pool until no elements are left. The algorithm is then

    Int[N] a = {0,1,2,....,N-1}
    
    For int i From N-1 to 1; i-- do
      int k = RandInt(0, i);
      swap a[k], a[i]
    
    Posted in: Project Workplace
  • 0

    posted a message on Get Camera Yaw/Pitch rounds values

    Prior to phase 2 beta the Get Player Camera Yaw/Pitch functions would tell you the current yaw/pitch of the player whatever that value was. After phase 2, the function failed to work at all (under certain conditions it may have worked).

    After the release of StarCraft II (peace be upon it), the functions seemed to work, however my functions that depended on using it worked noticably sluggishly and made the maps almost unplayable. What I found was that the yaw/pitch would only be reported for certain values. That is it seemed the functions were rounding to a real of a smaller bit size.

    It could be that my triggers are somehow causing this issue, so could anyone confirm this or provide a workaround? I absolutely require these functions to work with as much resolution as possible for my projects.

    -SexLethal

    Posted in: Galaxy Editor Bugs and Feedback
  • To post a comment, please or register a new account.