I need help with 2 cogs, im trying to make a door controlled by a key, but only the host requires the key to open it. I also need help with a cog that plays a sound everytime a 3do moves, since it is a custom 3do, it doesnt make any sounds when moved.
Any help is appreciated.
------------------
There's only one thing that im scared of, and it's Pixels... THERE EVERYWHERE!!!! AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH! *runs through a wall*
LKOH_SniperWolf
06-22-2004, 08:33 PM
Well, the second one would probably be more easily done with a custom .snd file, I'd think. That's the file which tells JK which sounds to play depending on the action taken by an object.
------------------
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
Ok, the biggest problem i have is with the door, ive tried the normal 00_doorkey cog, didnt work too well. Here's the coding if anyone wants to edit it to work for multiplayer (AKA, Everyone requires a key to go through, or to open it, not just host)
# 8/28/97 Added clicking sounds [DB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
thing door0 linkid=0 mask=0x405
thing door1 linkid=1 mask=0x405
thing door2 linkid=2 mask=0x405
thing door3 linkid=3 mask=0x405
flex movespeed=8.0
flex sleeptime=2.0
flex lightvalue=0.5
int key=0
sound locked_snd=i00ky73t.wav local
sound wav0=lvrclik2.wav
sector doorsector local
int numdoors local
int doorstatus local
int movestatus local
int player local
flex lasttime=-1 local
flex curtime=-1 local
message startup
message activated
message arrived
message blocked
message timer
end
# ================================================== ======================================
code
startup:
if (door0 >= 0) numdoors = numdoors + 1;
if (door1 >= 0) numdoors = numdoors + 1;
if (door2 >= 0) numdoors = numdoors + 1;
if (door3 >= 0) numdoors = numdoors + 1;
doorsector = GetThingSector(door0);
SectorAdjoins(doorsector, 0);
SectorLight(doorsector, lightvalue, 0.0); // add some light to door sector
Return;
# .................................................. ......................................
activated:
player = jkGetLocalPlayer();
if ((GetInv(player, 46 + key) == 1.0) || (GetSourceRef() != player)) // if player has the needed key
{ // or enemy triggers door
call checkstatus;
if(movestatus) return;
if(doorstatus == 0)
{ // all pieces are at frame 0
SectorAdjoins(doorsector, 1);
// show the key icon for 2 seconds
SetInvActivated(player, 46 + key, 1);
SetTimerEx(2, 1, 0, 0);
// PlaySoundThing(key_snd, player, 1.0, -1, -1, 0);
call open_doors;
}
}
else
{
PlaySoundThing(wav0, door0, 1.0, -1, -1, 0);
curtime = GetLevelTime();
if( (lasttime == -1) || (curtime - lasttime > 3) )
{
PlaySoundThing(locked_snd, player, 1.0, -1, -1, 0);
jkPrintUNIString(-1, 1001);
lasttime = curtime;
}
}
Return;
# .................................................. ......................................
arrived:
call checkstatus;
if(movestatus) return;
if(doorstatus == numdoors)
{ // all pieces are at frame 1
sleep(sleeptime);
call close_doors;
}
else if(doorstatus == 0)
{ // all pieces are at frame 0
sectoradjoins(doorsector, 0);
}
Return;
# .................................................. ......................................
blocked:
call open_doors;
Return;
# .................................................. ......................................
timer:
// Remove the key icon
SetInvActivated(player, 46 + key, 0);
Return;
# .................................................. ......................................
open_doors:
MoveToFrame(door0, 1, movespeed);
if (door1 >= 0) MoveToFrame(door1, 1, movespeed);
if (door2 >= 0) MoveToFrame(door2, 1, movespeed);
if (door3 >= 0) MoveToFrame(door3, 1, movespeed);
Return;
close_doors:
MoveToFrame(door0, 0, movespeed);
if (door1 >= 0) MoveToFrame(door1, 0, movespeed);
if (door2 >= 0) MoveToFrame(door2, 0, movespeed);
if (door3 >= 0) MoveToFrame(door3, 0, movespeed);
Return;
checkstatus:
movestatus = IsThingMoving(door0);
if (door1 >= 0) movestatus = movestatus + IsThingMoving(door1);
if (door2 >= 0) movestatus = movestatus + IsThingMoving(door2);
if (door3 >= 0) movestatus = movestatus + IsThingMoving(door3);
doorstatus = GetCurFrame(door0);
if (door1 >= 0) doorstatus = doorstatus + GetCurFrame(door1);
if (door2 >= 0) doorstatus = doorstatus + GetCurFrame(door2);
if (door3 >= 0) doorstatus = doorstatus + GetCurFrame(door3);
Return;
end
------------------
There's only one thing that im scared of, and it's Pixels... THERE EVERYWHERE!!!! AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH! *runs through a wall*
lucky_jackpot
06-23-2004, 01:15 AM
Well the second effect you're after can be achieved by adding a "soundclass=etc.snd" in the "master.tpl" template file (so long as you define a "*.snd" filename - heck, you can even use any of the existing ones if you want http://forums.massassi.net/html/smile.gif)
And for the first question (sorry to take them out of order http://forums.massassi.net/html/wink.gif - it's as I'm thinking about it off the fly, without the DataMaster to hand...), if you use a check similar to:
activated:
if (IsServer() && GetInv (player, binInventory, 1) ) {
open door stuff
}
else {
Print ("No access");
return;
}
Return;
You'll have to forgive the pseudo-code as I don't have time to type it all up, being at work at the mo... http://forums.massassi.net/html/redface.gif http://forums.massassi.net/html/wink.gif
[EDIT: Forgot to mention - hope this helps http://forums.massassi.net/html/biggrin.gif ]
-Jackpot
------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
[This message has been edited by lucky_jackpot (edited June 23, 2004).]
Im having problems getting that to work, ive got as far as it saying no Access for me, but the key wont open it, i assume that i must of added it in wrong. Any Help?
------------------
There's only one thing that im scared of, and it's Pixels... THERE EVERYWHERE!!!! AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH! *runs through a wall*
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.