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 help.
cog help.
2001-08-19, 2:56 PM #1
first i'll post a cog file and then i'll explain
# Jedi Knight Missions Cog Script
#
# POW_BLASTECH_M.COG
#
# POWERUP Script - Blastech Pistol pickup
#
# [YB & CYW] + [RF]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

thing powerup local
thing player local
"int bin=12 " local
int ammobin=11 local
sound pickupsnd=thrmlpu2.wav local
sound respawnsnd=Activate01.wav local
flex amount local

int bin_contents=0 local
int autopickup=0 local
int autoselect_weapon=-1 local

message touched
message taken
message respawn

end

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

code

touched:
player = GetSourceRef();

if (GetThingType(player) == 10) // Can only be taken by players.
{
if(IsMulti() || (GetInv(player, GetWeaponBin(bin)) == 0) || (GetInv(player, ammobin) < GetInvMax(player, ammobin)))
{
TakeItem(GetSenderRef(), -1);
call taken;
}
}
Return;

# ........................................................................................

taken:
player = GetSourceRef();
powerup = GetSenderRef();

// Do effects.
PlaySoundLocal(pickupsnd, 1, 0, 0);
AddDynamicTint(player, 0.0, 0.0, 0.2);

if(GetInv(player, GetWeaponBin(bin)) == 0)
{
// Pickup gun and ammo.
// Print("Bryar Pistol");
jkPrintUNIString(player, GetWeaponBin(bin));

" ChangeInv(player, GetWeaponBin(bin), 1.0);"

// store the old bin contents
bin_contents = GetInv(player, ammobin);
ChangeInv(player, ammobin, 10.0);

// Check for Auto Pickup
autopickup = GetAutoPickup();
if(autopickup & 1)
{
if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, GetWeaponBin(bin), 0))))
{
if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
{
SelectWeapon(player, GetWeaponBin(bin));
Return;
}
}
}

// Check for Auto Reload
if(GetAutoReload() & 1)
{
if(!bin_contents)
{
if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
{
// Try to autoselect and see if the best weapon is an energy cell weapon
autoselect_weapon = AutoSelectWeapon(player, 2);
if((autoselect_weapon == 2) || (autoselect_weapon == 12) || (autoselect_weapon == 3) || (autoselect_weapon == 13))
SelectWeapon(player, autoselect_weapon);
}
}
}
}
else
if(GetInv(player, ammobin) < GetInvMax(player, ammobin))
{
// Pickup ammo only.
// Print("Energy Cells");
jkPrintUNIString(player, ammobin);

// store the old bin contents
bin_contents = GetInv(player, ammobin);

ChangeInv(player, ammobin, 10.0);

// Check for Auto Reload
if(GetAutoReload() & 1)
{
if(!bin_contents)
{
if(!((GetAutoReload() & 2) && (GetCurWeapon(player) == jkGetMultiParam(1))))
{
// Try to autoselect and see if the best weapon is an energy cell weapon
autoselect_weapon = AutoSelectWeapon(player, 2);
if((autoselect_weapon == 2) || (autoselect_weapon == 12) || (autoselect_weapon == 3) || (autoselect_weapon == 13))
SelectWeapon(player, autoselect_weapon);
}
}
}
}

Return;

# ........................................................................................

respawn:
PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);

Return;

end
#==========================================
if you look at the cog file you should see the "changeinv(player, GetWeaponBin(bin), 1.0);
now the "bin" part, is that telling the function what bin to look for and return with or what? and if so why is the "blastech" gun using bin 12? the same bin used for bowcaster,repeater rifle,and concussion rifle power? NOTE-similar occurrences have ben found in flashbomb, scope, and mots sequencer cogs!



------------------
I lost a mine! do you have it?(BOOM!)
I droped a trip mine around here, could you help me look for it?
2001-08-19, 10:43 PM #2
What it wants to do is to change the bin value of the blastech, in which if you look at items.dat file you will find blastech bin number as ...(well I just forgot on top of my head but was it something like 122?, let's just pretend it's 122 here)

So, what it wants do is this in a direct manner.

ChangeInv(player, 122 ,1);

But LEC rather decided to use that in order to get the bin number for the 12th weapon mentioned in the items.dat. So GetWeaponBin(bin) will return the bin number in the items.dat for the 12th weapon(bin being 12). First being the fist, then bryar and so on, so, like for me who just forgets the bin number, they made a function to get the bin number for the Xth weapon, which rather can be remembered more easily.

As I can tell all now

1 - fist
2 - bryar
3 - stormtrooper rifle
4 - grenade
5 - bowcaster
6 - repeater
7 - raildet
8 - mine
9 - conc
10 - freezer
11 - saber
12 - blastech
13 - scope
14 - flash grenade
15 - empty
16 - empty
17 - seeker rail
18 - manual mine
19 - empty
20 - eweb

Useless if you have items.dat in your mind though. But as for LEC they wanted to use this as they probably had to mess around the bin entries in the items.dat while in production, so they didn't have to keep changing the integers in every weapon cog when they change bin entry values in items.dat.

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

[This message has been edited by Hideki (edited August 20, 2001).]
2001-08-20, 12:50 PM #3
thanks. where can I find items.dat I looked around once and couldn't find it!

------------------
I lost a mine! do you have it?(BOOM!)
I droped a trip mine around here, could you help me look for it?
2001-08-21, 7:29 AM #4
It's in res2.gob, use ConMan from code-alliance.com to get the file out from the misc folder.

------------------
http://millennium.massassi.net/ - Millennium
2001-08-21, 12:33 PM #5
thanks.

------------------
I lost a mine! do you have it?(BOOM!)
I droped a trip mine around here, could you help me look for it?

↑ Up to the top!