Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → problems identifying Thing Flags
problems identifying Thing Flags
2008-01-12, 12:29 PM #1
Let me explain something in simple terms.

I fire a template.
The fired template is a projectile with :
explode=+createstaffexp

This template is a simple decorr creation with an attached cog.

Create:
Print("created");
Return;

Touched:
this=GetSenderRef();
source=GetSourceRef();

## What material is the thing made of that the projectile hit?##

if(GetThingFlags(source) == [insert flags for earth])
{
print("this is earth");
}

if(GetThingFlags(source) == [insert flags for metal])
{
print("this is metal");
}
etc etc
Return;


So far, it prints only "created".
It isnt detecting the things flags it hits.
Is this because it wont respond to a flag of 0x800000 earth becuase the actual earth object is 0x801048, and not precisely 0x800000?
How do i go about this?


Basically, I NEED THE CODING TO ALLOW:

a cog to respond to a touched message, and to detect the flags of the thing it just touched, to seperate this into different resulting explosion effects. The SAME needs to happen for surfaces!

OMG help. this is holding me back SO much.

Once i got the coding down, the weapons can be finished. :awesome:

:tfti:
Code:
if(getThingFlags(source) & 0x8){
  do her}
elseif(getThingFlags(source) & 0x4){
  do other babe}
else{
  do a dude}
2008-01-12, 1:02 PM #2
I think you have to do a BitTest. One of the remaining COG gurus can help you with this, but in the meantime, I suggest looking up BitTest in DataMaster on the JKHub.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2008-01-13, 9:51 AM #3
It's been a long time, so i may be wrong about this, but I don't think projectiles can register the touched message. "Damaged" message should work. In the cog of the damaged item, get the template and position of the projectile that damaged it, and create the explosion that you want.
Jedi Knight Enhanced
Freelance Illustrator
2008-01-13, 10:50 AM #4
touched does work, becuase my old mod cogs could detect which template thing a projectile touched.

And having each damaged item with its own cog would be a nightmare

I'm attempting this BitTest thing for now.
Code:
if(getThingFlags(source) & 0x8){
  do her}
elseif(getThingFlags(source) & 0x4){
  do other babe}
else{
  do a dude}

↑ Up to the top!