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 → I need 2 cogs
I need 2 cogs
2002-01-04, 11:23 AM #1
The first cog I need makes the gravity in a given sector 0. The second cog I need teleports a player to a ghost position when a certain sector is entered.
Who made you God to say "I'll take your life from you"?
2002-01-04, 11:35 AM #2
I'm still a beginner at cogs.. I just want to try things out... [http://forums.massassi.net/html/smile.gif] So here's my shot at the teleport cog..

Code:
symbols

message		entered		
sector		teleportsector linkid=1
thing		player		local
thing		ghost linkid=2

end

code

entered:

player = GetSourceRef();

if(GetSenderRef() == teleportsector);
{
TeleportThing(player, ghost);
}
else
Return;

end


[This message has been edited by JediJigge (edited January 04, 2002).]

[This message has been edited by JediJigge (edited January 04, 2002).]
2002-01-04, 1:29 PM #3
Hmm, Im going to pick at his cog a little... I hope you dont mind.

Code:
symbols

message		entered		
sector		teleportsector linkid=1
thing		player		local
thing		ghost linkid=2

end


You did not need to use link IDs. And since you didnt anywhere in the code, they are rather futile...

Code:
code

entered:

player = GetSourceRef();


No good. This is one of the reasons this cog doesnt work. The sourceref is irrelevent in this. What you need is the localplayer. In other words, "Player = JKgetlocalplayer();", or "Player = Getlocalplayerthing();".

Code:
if(GetSenderRef() == teleportsector);
{
TeleportThing(player, ghost);
}
else
Return;

end


I dont know why you put in that 'Else', but it isnt needed.

The version that DOES work:

 

Code:
symbols
message entered 
sector teleportsector
thing player local
thing ghost
end
code
entered:
player = JKgetlocalplayer();
if(GetSenderRef() == teleportsector); {
TeleportThing(player, ghost); }
Return;
end


Ok, Im done.

 


BTW, you dont need a cog to set a sector's gravity to 0. In the Sector Properties in JED, click on Flags, and set 'No gravity'.


Bingo, no gravity...

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-05, 6:19 AM #4
No I don't mind... [http://forums.massassi.net/html/smile.gif] It was kinda good, because you learned me more [http://forums.massassi.net/html/smile.gif] But how do the game know which sector it is?
2002-01-05, 7:33 AM #5
I know theres a good teleport cog already here at Massassi....
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-05, 2:37 PM #6
Bolth things and sectors will send the 'Entered' message, but you only have 1 sector defined. Therefor, that is the only possible sorce of the message.

------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!