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 → How to get a reference to local thing
How to get a reference to local thing
2004-08-24, 8:25 PM #1
Ok, I got this problem: I send a thing reference in a trigger, retrieve this trigger in a thing's class cog and need to check, whether this thing is the same as the one sent in the trigger.

And another question: I am sending a trigger with a thing reference (dummy) to item_keygreen.cog, and in the trigger message of this cog, I have SetThingClassCog(GetParam(0), GetSelfCog()). What happens now if I send the trigger twice, but with different things...will the first thing lose it's class cog?

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-08-24, 9:48 PM #2
Quote:
<font face="Verdana, Arial" size="2">...will the first thing lose it's class cog?</font>

Nah, 1 cog can be the class/capture cog for an unlimited (as far as I know) number of things, but a thing can pnly have 1 class cog and 1 capture cog.

Can't provide a 100% way to confirm a thing's identity, but you could also send the thing's type, typeflags and thingflags in the trigger, and if they don't match up after being received, then it's not the correct thing (uhm, well there's situations where this isn't true, but it's not a bad way to test).

QM
2004-08-24, 10:40 PM #3
Ok, so it should basically work...thanks.

The other problem remains: these things are all of the same kind. Maybe something with userdata...hmm...

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-08-24, 11:10 PM #4
Userdata doesn't sync over a network, so that'll only work if you're checking the thing from the comp that sent the trigger.

Hm, maybe you could use dummy typeflags up in the like 0x1000000 range or thingflags up around 0x100000000. Not sure how many things will exist at once, but just giving them flags wayyyy up there should sync (just apply the flags upon creation) and then test for them after the trigger.

QM
2004-08-25, 2:45 AM #5
Hmm, now I remember someone complaining about this problem before...gonna check the search this evening...I think he used some unused flags, as you already suggested...

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-08-25, 3:01 AM #6
Quib Mask is right about the class and capture cog I believe. A single thing should be able to have both a class and capture cog running at the same time.

I've had this problem myself, I think it had to do with the fact I was trying to get an explosion template from a projectile to get the projectile. I can't remember why I wanted to do that. I was thinking about it some yesterday though.

There are a few unconventional ways to attempt this that I can think of. Using high range thing flags like Quib said is a good idea. SetLifeLeft() and GetLifeLeft() are also synced...you could add very high ranges in that value. Thats probably less ideal than thingflags though.

Can you explain exactly what you're trying to accomplish so I can get my head around the idea a little better?
2004-08-26, 11:02 AM #7
I am using SetThingFlags(thing, 0x1000000) and if(GetThingFlags(thing) & 0x1000000) now. It works great. The problem was, that I have several things based on the healthpack template (but changed later with SetThingClassCog() etc.). Now how to differ between them? Model is unknown (since it's dynamically changed ingame), template is healthpack, classcogs are all the same...not too easy. But the thingflags thing works great.

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

↑ Up to the top!