Page 1 of 1

Is there any way to...

Posted: Mon Jul 07, 2008 3:39 pm
by Poi
I want for staff to be able to place houses over things such as rocks and little flowery things, is there any way I can do this?

Posted: Mon Jul 07, 2008 5:59 pm
by ncrsn
Use the different flags to make it possible (CRMULTI_IGNORE_OBJECTS): http://docs.polserver.com/pol097/single ... AtLocation.

Code: Select all

const STAFFLEVEL := 2;

var flags := 0;

if (who.cmdlevel > STAFFLEVEL)
    flags := CRMULTI_IGNOREALL;
endif

var multi := CreateMultiAtLocation(targ.x, targ.y, targ.z, multitype, flags, targ.realm);

Posted: Mon Jul 07, 2008 7:05 pm
by Poi
ok, got it to work, thanks.

One question though...

so, with
const CRMULTI_IGNORE_MULTIS := 0x0001; //ignore intersecting multis
const CRMULTI_IGNORE_OBJECTS := 0x0002; //ignore dynamic objects
const CRMULTI_IGNORE_WORLDZ := 0x0004; //ignore standability,relative Z,world height
const CRMULTI_IGNORE_ALL := 0x0007;


If all does all of them, does world do objects and multis? and objects to multi's?

Posted: Mon Jul 07, 2008 9:34 pm
by CWO
CRMULTI_IGNORE_MULTIS - Ignores other houses and multis so you can essentially place 2 within eachother.

CRMULTI_IGNORE_OBJECTS - Ignores items and characters in a spot and places the multi anyway.

CRMULTI_IGNORE_WORLDZ - Ignores uneven terrain, rocks, flowers, and the world height.

and of course CRMULTI_IGNORE_ALL does all of them.

Posted: Wed Jul 09, 2008 2:21 pm
by oenone
Poi wrote:If all does all of them, does world do objects and multis? and objects to multi's?
No, ALL is binary OR of MULTIS, OBJECTS, and WORLDZ. You can combine them yourself if you like.. for example

Code: Select all

flags := CRMULTI_IGNORE_MULTIS | CRMULTI_IGNORE_WORLDZ;

Posted: Fri Jul 11, 2008 2:17 am
by CWO
flags := CRMULTI_IGNORE_MULTIS | CRMULTI_IGNORE_WORLDZ;
isn't that supposed to be
flags := CRMULTI_IGNORE_MULTIS + CRMULTI_IGNORE_WORLDZ;

Posted: Fri Jul 11, 2008 3:44 am
by oenone
CWO wrote:
flags := CRMULTI_IGNORE_MULTIS | CRMULTI_IGNORE_WORLDZ;
isn't that supposed to be
flags := CRMULTI_IGNORE_MULTIS + CRMULTI_IGNORE_WORLDZ;
No. If you would do something like

Code: Select all

flags := CRMULTI_IGNORE_MULTIS;
...
flags := flags | CRMULTI_IGNORE_ALL;
...
it would be wrong if you used +. if you use flags, always use binary OR (or AND, depending on what you're trying to do.

Posted: Fri Jul 11, 2008 2:28 pm
by Luth
In this special case, because in binary each flag is its own bit:

Code: Select all

CRMULTI_IGNORE_MULTIS  = 0001
CRMULTI_IGNORE_OBJECTS = 0010
CRMULTI_IGNORE_WORLDZ  = 0100
using a binary OR ( | ) or using normal addition ( + ) will result in the same value.
1 | 2 = 3
0001 | 0010 = 0011

-and-

1+2=3
0001 + 0010 = 0011

However, because these are flags, only the binary OR operation is acceptable, and addition can lead to errors. eg:

Code: Select all

(CRMULTI_IGNORE_ALL + CRMULTI_IGNORE_MULTIS) != (CRMULTI_IGNORE_ALL | CRMULTI_IGNORE_MULTIS)
0111 + 0001 = 1000 (8)
0111 | 0001 = 0111 (7)
So, in short, when combining flags, ALWAYS ALWAYS use the OR operator, and not the addition operator.