Author Topic: Spawned blocks not colliding?  (Read 1404 times)

Eh, im working on a private addon, could someone pm me if they could help me?

are you calling the plant method on the brick
is it really far away from 0 0 0

no we cannot help you without information

no we cannot help you without information
this is true.

posting your code is the best thing you can do to let us help you

nobody is going to steal your code from only one part of it

To be honest, none of us want your idea. I don't care if you've got the most badass idea for the best game ever, we're too lazy to take it. I'll help you if you PM me but I'm not going to go more out of my way than I already have to make your code work.

function createDungeonBrick(%id,%db,%pos,%col,%fx) {
   %pos = getWords(%pos,0,2) SPC getWord(%pos,2) - (-50*%id);
   if($DG::isBrick[%pos])
      return -1;
   if(strLen(%fx) < 1)
      %fx = 0;
   %brick = new fxDTSBrick() {
      position = %pos;
      datablock = %db;
      isPlanted = true;
      colorId = %col;
      colorFxId = %fx;
   };
   %err = %brick.plant();
   MissionCleanup.add(%brick);
   if(!isObject(BrickGroup_88)) {
      new SimGroup(BrickGroup_88) {
         name = "Dungeon Generator";
         bl_id = 88;
      };
      MainBrickGroup.add(BrickGroup_88);
   }
   BrickGroup_88.add(%brick);
   $DG::isBrick[%pos] = true;
   return %brick;
}


This is what plants the bricks, some of the bricks don't collide with the player. How could i fix this?

Invalid position (it has 4 words)

Also, if the brick cannot be planted (%err != 0)
You won't collide with it sometimes

Invalid position (it has 4 words)

The position has three words like it should.

You don't seem to be actually doing anything with %err, so unless you're adding overlap prevention or something, that isn't necessary.

You aren't setting brick scale, rotation, or angleID, but I'm not sure if that's actually a problem or not.

Can we see the part of code that calls createDungeonBrick? I remember running into this issue by doing something almost exactly like this too quickly.

Wait does getword(%var, %1, %2) return all words between %1 and %2 or just words %1 and %2?

You aren't setting brick scale, rotation, or angleID, but I'm not sure if that's actually a problem or not.
This stuff is important

This stuff is important
if angleID isn't set, it's "", which would be 0, and so rotation would be 0 0 0 0 and i'm not sure scale actually does anything anyway, and why would this only cause SOME bricks to not have collision? doesn't quite make sense to me

Wait does getword(%var, %1, %2) return all words between %1 and %2 or just words %1 and %2?
getWords(sourceString, start, end); - gets all words in sourceString between indexes start and end
edit:
just noticed you were right, but i'm pretty sure the fourth word would be ignored anyway

Blocki, stop trying to help if you don't know what you're talking about.

Can we see the part of code that calls createDungeonBrick? I remember running into this issue by doing something almost exactly like this too quickly.

function brickGen_makeRow(%pos,%noObject,%id) {
   %btm = createDungeonBrick(%id,brick4xCubeData,%pos SPC 0 ,7); //makes the floor
   if(!$DG::madeObject[%pos] && !%noObject)
      createDGObjectAtRow(%id,%pos,%btm); //for the chests, pillars, and goblins
   $DG::madeObject[%pos] = true;
   createDungeonBrick(%id,brick4xCubeData,%pos SPC 8,7); //makes the ceiling
}


Warning - while you were typing 4 new replies have been posted. You may wish to review your post.

wat?? 10 mins?

Blocki, stop trying to help if you don't know what you're talking about.
You aren't helping in any way here