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 → Cog Probs
Cog Probs
2001-07-05, 5:25 PM #1
Ok i had two cogging questions...
1: is it possible to randomly select an MP players and make him an assassination target? if so what would the coding be like to isolate him/her from the rest of the MP players?
2: ive been working on a bank cog for MOTS MP and from what i can tell through my cogging abilities <which are pretty low [http://forums.massassi.net/html/frown.gif]>it should work perfectly but it doesn't anyways heres the code:
# Jedi Knight Cog Script
# Bank.cog
# !!!!!DEBUG VERSION!!!!!
# By: JK2k_Avenger
# This Cog is Not supported by LucasArts Entertainment Co
symbols
surface Deposit
surface Withdrawl

Int Player Local
Int Inuse=0 Local
Int CashPlayerHas=0 Local
Int CashInBank=0 Local
Int CashToTakeOut=0 Local
Int Cashbin=40

sound ActivateSND
sound DeactivateSND


flex debugpause


Message Activated
end
# ========================================================================================
code
# ========================================================================================
Activated:
Print("A Surface Has Been Activated");
Sleep(debugpause);
If(Inuse == 1)
{
Return;
}
Inuse=1;
Print("MOTS has made it past Inuse");
Sleep(debugpause);
if(GetSenderRef() == Deposit) {
Print("Deposit switch pressed");
Sleep(debugpause);
SetWallCel(Deposit, 1);
Print("Wall Cell Changed");
Sleep(debugpause);
PlaySoundPos(ActivateSND, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
Print("ActivateSND Played");
Sleep(debugpause);
CashPlayerHas=GetInv(player, Cashbin);
Print("checked to see how much money the player has");
Sleep(debugpause);
CashInBank=CashInBank+CashPlayerHas
JkStringClear();
JkStringConcatFormattedInt(CashPlayerHas, "Deposited %d credits. ");
JkStringConcatFormattedInt(CashInBank, "You now have %d credits in the bank");
JkStringOutPut(player, -1);
Sleep(debugpause);
Print("Added money to CashInBank");
Sleep(debugpause);
CashPlayerHas=0
Print("removed all money from player");
Sleep(debugpause);
SetWallCel(Deposit, 0);
Print("reset Wall Cell");
Sleep(debugpause);
PlaySoundPos(DeactivateSND, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
Print("DeactivateSND Played);
}

if(GetSenderRef() == Withdrawl) {
Print("Withdrawl switch pressed");
Sleep(debugpause);
SetWallCel(Withdrawl, 1);
Print("Wall Cell Changed");
Sleep(debugpause);
PlaySoundPos(ActivateSND, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
Print("ActivadeSND Played");
Sleep(debugpause);
CashPlayerHas=GetInv(player, Cashbin);
Print("checked to see how much money the player has");
Sleep(debugpause);
CashToTakeOut=1000-CashPlayerHas
Print("checked to see how much money the player can take out");
Sleep(debugpause);
CashPlayerHas=CashPlayerHas+CashToTakeOut
Print("Gives player the money from the bank");
Sleep(debugpause);
CashInBank=CashInBank-CashToTakeOut
Print("Removed Money From Bank");
Sleep(debugpause);
JkStringClear();
JkStringConcatFormattedInt(CashToTakeOut, "Withdrew %d credits");
JkStringConcatFormattedInt(CashInBank, "You now have %d credits in the bank");
JkStringOutPut(player, -1);

SetWallCel(Withdrawl, 0);
Print("Reset Wall Cell");
Sleep(debugpause);
PlaySoundPos(DeactivateSND, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
Print("DeactivateSND Played");
Sleep(debugpause);
}
Inuse=0;

Return;
# =========================================================================================
end
This cog is in the debug mode (for me debug is using a print statement after every line of code) it wont even get to the first print statement so i have no idea whats wrong with this

------------------
Join JK2k on the zone! go to http://www.jk2k.8k.com
Join JK2k on the zone! go to http://www.jk2k.8k.com
2001-07-05, 9:16 PM #2
I am not even going to look at that code.
2001-07-06, 12:33 AM #3
Well for one you left out the messages bit in the symbols section..
2001-07-06, 3:27 AM #4
Hey man! What is up with that code! I don't even understand what you put in the Print sections!
Try downloading some cogs from the cog secion of massassi. Look at them closely and use what others do in your own cogs.

------------------
Major Lozza McG
Rebel Squadrons
www.rebelsquadrons.org
Major Lozza McG
Rebel Squadrons
www.rebelsquadrons.org
2001-07-06, 4:07 AM #5
ok it is actually tabbed but unfortunately Edit Plus 2 doesnt keep formatting when you copy it heres the tabbed version, this is also the non-debugged version
# Jedi Knight Cog Script
# Bank.cog
# By: JK2k_Avenger
# This Cog is Not supported by LucasArts Entertainment Co
symbols

surface Deposit
surface Withdrawl

Int Player Local
Int Inuse=0 Local
Int CashPlayerHas=0 Local
Int CashInBank=0 Local
Int CashToTakeOut=0 Local
Int Cashbin=40

sound ActivateSND
sound DeactivateSND


flex debugpause


Message Activated
end
# ========================================================================================
code
# ========================================================================================
Activated:
If(Inuse == 1)
{
Return;
}
Inuse=1;
if(GetSenderRef() == Deposit) {
SetWallCel(Deposit, 1);
PlaySoundPos(ActivateSND, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
CashPlayerHas=GetInv(player, Cashbin);
CashInBank=CashInBank+CashPlayerHas
JkStringClear();
JkStringConcatFormattedInt(CashPlayerHas, "Deposited %d credits. ");
JkStringConcatFormattedInt(CashInBank, "You now have %d credits in the bank");
JkStringOutPut(player, -1);
CashPlayerHas=0
SetWallCel(Deposit, 0);
PlaySoundPos(DeactivateSND, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
}

if(GetSenderRef() == Withdrawl) {
SetWallCel(Withdrawl, 1);
PlaySoundPos(ActivateSND, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
CashPlayerHas=GetInv(player, Cashbin);
CashToTakeOut=1000-CashPlayerHas
CashPlayerHas=CashPlayerHas+CashToTakeOut
CashInBank=CashInBank-CashToTakeOut
JkStringClear();
JkStringConcatFormattedInt(CashToTakeOut, "Withdrew %d credits");
JkStringConcatFormattedInt(CashInBank, "You now have %d credits in the bank");
JkStringOutPut(player, -1);
SetWallCel(Withdrawl, 0);
PlaySoundPos(DeactivateSND, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);
}
Inuse=0;

Return;
# =========================================================================================
end
also F.Y.I. bin 40 is bactatanks set to 1000 max
Join JK2k on the zone! go to http://www.jk2k.8k.com
2001-07-06, 4:09 AM #6
that line about flex debugpause is gone...and i cant see where i would have a second message...ACTIVATED should be the only one
Join JK2k on the zone! go to http://www.jk2k.8k.com
2001-07-06, 4:10 AM #7
aaargh! can someone understand that?
Join JK2k on the zone! go to http://www.jk2k.8k.com
2001-07-06, 5:41 AM #8
CashInBank=CashInBank+CashPlayerHas
^-this needs a ; at the end.

so does:
CashPlayerHas=0

and these:
CashToTakeOut=1000-CashPlayerHas
CashPlayerHas=CashPlayerHas+CashToTakeOut
CashInBank=CashInBank-CashToTakeOut


All need semicolons at the end of the line.


Other than that, just to streamline the cog a bit, change these lines:

PlaySoundPos(..., SurfaceCenter(GetSenderRef()), ...);

change the GetSenderRef() to whatever surface it is, since you have no reason to use the GetSenderRef() more than once per message.

Hopefully, it'll work now [http://forums.massassi.net/html/smile.gif] I don't see anything else wrong with the code offhand.

↑ Up to the top!