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 → Projectile Teleportation
Projectile Teleportation
2001-12-31, 2:03 PM #1
Ok, i've tried to make a cog that will teleport projectiles when one enters a sector. At the moment it will teleport the player, but not the projectile. Here is the cog, is there anything else i need to add to make it teleport projectles?

Code:
flags=0x240

symbols
message entered


sector	telechamber

thing	gotospot
                                
int 	proj    		                local
int     dummy                                   local


end

#============================================================================

code
entered:
	proj=FirstThingInSector(telechamber);
	
        TeleportThing(proj, gotospot);

	return;
end


------------------
Generating Electro Vibes™ for the masses on Massassi
Go To: The Collective or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
<EL3CTRO> EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-12-31, 2:10 PM #2
After the thing proj local in symbols put mask=0xfff. It should work.

[edit]I noticed you used int for proj. Use thing instead, try that, if it doesn't work, then try the mask with thing.[/edit]

------------------
-Hell Raiser
Cogging type person that does, umm, stuff?
"Free, your, mind."
DBZ: TDIR has a new home!

[This message has been edited by Hell Raiser (edited December 31, 2001).]
-Hell Raiser
2001-12-31, 3:05 PM #3
I Tried:

int proj local mask=0xfff

thing proj local mask=0xfff

thing proj local

and none of them work [http://forums.massassi.net/html/frown.gif]
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-12-31, 3:59 PM #4
FirstThingInSector gets the first thing only. So if that sector includes more than 1 thing, it can't get anything behind the first thing that got trapped by the verb. And with this it will teleport not only the projectile but anything that enters the sector.

As for the mask, you don't need. The message is relative to the sector and not the projectile that's entering, so no need.

Try this. (Sorry about all type hex values, I don't remember, go for jkspec on it)
Code:
code


entered:


   if(GetSenderType() == actorType || GetSenderType() == playerType) return; //if entered stuff is an actor, return.


   TeleportThing(GetSenderRef(), gotospot); //teleport the entering stuff


   return;


Hope I made it right. [edit]Apparently didn't make it right on the first post [http://forums.massassi.net/html/smile.gif][/edit]

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited December 31, 2001).]
2001-12-31, 5:42 PM #5
Well, it still doesnt work, probably an error on my part. What did you mean about the type hex values? I couldnt see any part of the cog that needed them but i might be wrong. Once it starts using things like GetSenderRef and stuff like that i jus dont understand :S

Here is the cog so far:

Code:
flags=0x240

symbols
message entered
message startup        

sector	telechamber

thing	gotospot
                                
int 	proj    		                local       mask=0xfff
int     dummy                                   local

sound   telesound=ForceThrow01.WAV

template	sparks=+telesparks

end

#============================================================================

code
entered:
  
if(GetSenderType() == actorType || GetSenderType() == playerType) return; //if entered stuff is an actor, return.   

TeleportThing(GetSenderRef(), gotospot); //teleport the entering stuff

return;
end
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2001-12-31, 8:40 PM #6
GetSenderType() - This checks the type of the sender reference.

Sender reference is the thing that entered (or executed the message of) the sector, so when used inside entered message, it gets the entering object whereas for GetSourceRef(), it gets the source reference which is the passive side of the message, the sector itself.

GetSendeRef() and GetSourceRef() changes what it gets by in what message it resides.

In that code, in the first line, it tells to ignore if the sender reference type is either an actor or a player (because I assume you only want a projectile to get teleported and not all actors entering the sector)

I just checked the jkspec and found the flag type for actor is 0x4 and the player is 0x400. In that first line you should change both "==" to "&".

------------------
http://millennium.massassi.net/ - Millennium
2002-01-01, 5:55 AM #7
Here's the correct cog:

Code:
# teleproj.cog
#
# Teleport projectiles to a ghost position.
# [SM]
#=================================================================#
flags=0x240

symbols

message	entered

sector	telechamber		mask=0x8
thing		ghost			nolink

int		proj								local
sound	telesound=forcethrow01.wav		local
template	sparks=+telesparks					local

end
#=================================================================#
code
#---------------------------------------------------------
entered:
	PlaySoundThing(telesound, GetSourceRef(), 1, -1, -1, 0);
	CreateThing(sparks, GetSourceRef());
	TeleportThing(GetSourceRef(), ghost);

Return;
#---------------------------------------------------------
end


It works; I tested it.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-01-01, 6:42 AM #8
That will plain teleport any incoming objects...

I've been wrong on the sender/source. It's the GetSourceRef() to get the thing that is incoming. senderref is the sector.And since thing type is set as the only 1, you can keep "==" as it is.

I think "entered" gets called without masking the sectors, and does he need particles and sounds?

I'd go for...
Code:
entered:


   //teleport the entering stuff if the entering type is not an actor and a player.
   if(GetSenderType() != 0x4 && GetSenderType() != 0x400) TeleportThing(GetSourceRef(), gotospot);


   return;


------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited January 01, 2002).]
2002-01-01, 6:47 AM #9
No it won't.

The 0x8 mask flag for the sector will block out all messages except those sent by weapons.

Normally, only the player can call the entered: message in a sector. So perhaps there's a default mask flag of 0x400?

And no, he didn't ask for the particles and sound, but they were listed in the symbols so I added the code.

And Hideki, your confusing Thing Type Values with Thing Type Mask Flags in your example.

[This message has been edited by SaberMaster (edited January 01, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-01-01, 6:56 AM #10
Thanks both of you, it works now!
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!
2002-01-01, 7:54 AM #11
Really? Cool. Could I see a copy of that final cog you have? Cuz I've been looking for a teleporter like that for a long time....
In my mind I can see your face, as Your love pours down in a shower of grace. Some people tell me that Your just a dream, but my faith is the evidence of things unseen.

Once upon a time God spoke to me, and then I was never the same again.

_-=MaTRiX=-_
2002-01-01, 3:21 PM #12
Ah, darn, cog is getting far from me.
I thought masking variables will cause them to call or not call specific messages and not censoring source references. I may be wrong.

Yeah, I made the flags wrong.
Someone mind telling me what "nolink" does?

------------------
http://millennium.massassi.net/ - Millennium
2002-01-01, 6:30 PM #13
AFAIK, 'Nolink' does nothing. It simply indicates a lack of ID for any specific variable.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-02, 5:23 PM #14
finished Cog:

Code:
# teleproj.cog
#
# Teleport projectiles to a ghost position.
# [SM]
#=================================================================#
flags=0x240

symbols

message	entered

sector	telechamber		mask=0x8
thing		ghost			nolink

int		proj								local
sound	telesound=forcethrow01.wav		local
template	sparks=+telesparks					local

end
#=================================================================#
code

#---------------------------------------------------------
entered:
	PlaySoundThing(telesound, GetSourceRef(), 1, -1, -1, 0);
	CreateThing(sparks, GetSourceRef());
	TeleportThing(GetSourceRef(), ghost);

Return;
#---------------------------------------------------------
end
Generating Electro Vibes™ for the masses on Massassi
Go To: BiTsToRm Forums or L3CY's Topsites
Boba Jules: You ever read the bible TK-421?
TK-421: No?
Boba Jules: Oh, ok...
*BLAM BLAM BLAM BLAM*
&lt;EL3CTRO&gt; EXCAUSE ME MISTAR CAERV BUT I LIEK MY PHORUMPHS!

↑ Up to the top!