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 → Requesting stop_power assistance...
Requesting stop_power assistance...
2000-11-22, 4:45 PM #1
I've been fiddling with the Force Persuasion cog lately in an attempt to make it more closely resemble the Immersion skill that Luke Skywalker was taught by the Fallanassi Adepts of the White Current.

I've managed to make the power effective against all AIs (including droids and vornskrs) but what I'd like to do is cause the power to be deactivated whenever the player fires a weapon.

One of our fellow Massassi, lordvader, has been extremely helpful. He told me to add a line to all of my weapon cogs that would cause them to signal the Force Persuasion cog to shut down. It is as follows:

SendMessage(fpcog, stop_power);

In this line, fpcog represents the symbol used for the Force Persuasion cog. The only problem is this: I don't know the proper symbol used to represent the Persuasion cog. If someone out there could direct me to a resource that has this information, I would be most grateful. I tried to find it in the JKSpecs, but couldn't come up with anything.

Thanks in advance for any assistance.

------------------
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
2000-11-23, 4:46 AM #2
ok, I think I figured it out. In symbols of every weapon cog, put:
Code:
cog fpcog

In the startup message, put:
Code:
fpcog=GetInvCog(player, 26);

And in the fire message:
Code:
SendMessage(fpcog, stop_power);

That should work.
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2000-11-23, 10:13 AM #3
Hey, Vader, I haven't been able to make it work. Here's a copy of the cog for you to look at and see if I'm messing it up.

# Jedi Knight Cog Script
#
# WEAP_BRYAR.COG
#
# WEAPON 2 Script - Bryar Pistol
#
# The trusty weapon of Kyle Katarn. This is actually an older modified rifle
# that has been cut down to more of a pistol size. It is very accurate but
# somewhat of a low power weapon. This weapon has only one type of fire.
#
# - Affected by MagSealed sectors/surfaces.
#
# [YB & CYW]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

model povModel=bryv.3do local
model weaponMesh=bryg.3do local

keyframe mountAnim=strvmnt.key local
keyframe dismountAnim=strvdis.key local
keyframe povfireAnim=strvpst1.key local
keyframe holsterAnim=kyhlstr.key local

sound outSound=pistout1.wav local
sound mountSound=df_bry_ready.wav local
sound dismountSound=PutWeaponAway01.wav local
sound fireSound=shredder.wav local
sound grapfireSound=remotefire01.wav local
sound graphitSound=lvrclik2.wav local

template projectile=+bryarbolt local

thing player local
thing victim local
thing potential local

flex dot local
flex maxDot local

flex fireWait=0.1 local
flex holsterWait local
flex fireDelay=0.6 local
flex powerBoost local
flex autoAimFOV=30 local
flex autoAimMaxDist=5 local

int weaponIndex local
int trackID=-1 local
int dummy=0 local
int mode local
int holsterTrack local

message activated
message deactivated
message selected
message deselected
message autoselect
message fire
message timer
message pulse

cog fpcog

#hook stuff
template grapple=+grapplehook local

int hook=0 local
int hooklanded=0 local

vector dir local

end

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

code

startup:
player = GetLocalPlayerThing();
fpcog = GetInvCog(player, 26);
Return;

fire:
player = GetSourceRef();
SendMessage(fpcog, stop_power);

// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
{
Return;
}

if(mode == 0)
{
// Check Ammo - If we are out, autoselect best weapon.
if(GetInv(player, 11) < 1.0)
{
PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80);
if(GetAutoSwitch() & 1)
SelectWeapon(player, AutoSelectWeapon(player, 1));
Return;
}

SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0);
dummy = FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
ChangeInv(player, 11, -1.0);
jkPlayPOVKey(player, povfireAnim, 1, 0x38);

powerBoost = GetInv(player, 63);
ChangeFireRate(player, fireWait/powerBoost);
}
else
{
if(hook == 0)
{
SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0);
hook = FireProjectile(player, grapple, grapfireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
jkPlayPOVKey(player, povfireAnim, 1, 0x38);
SetPulse(0.10);
}
}


Return;
# .....................................
pulse:
if(hooklanded == 0)
{
if((IsThingMoving(hook) == 0) | | (GetThingAttachFlags(hook) != 0))
{
hooklanded = 1;
PlaySoundThing(graphitSound, player, 1.0, -1.0, -1.0, 0x80);
}
}
else
{
dir = VectorScale(VectorNorm(VectorSub(GetThingPos(hook), GetThingPos(player))), 50);
//have to detach and clearphysics otherwise players 'drags'along floor
DetachThing(player);
ClearPhysicsFlags(player, 0x1);
ApplyForce(player, dir);
}
Return;
# ........................................................................................

activated:
player = GetSourceRef();
mode = GetSenderRef();

jkSetWaggle(player, '0.0 0.0 0.0', 0);
powerBoost = GetInv(player, 63);
ActivateWeapon( player, fireWait/powerBoost, mode );
Return;

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

deactivated:
player = GetSourceRef();
mode = GetSenderRef();

jkSetWaggle(player, '10.0 7.0 0.0', 350);
DeactivateWeapon( player, mode );

if(hook != 0)
{
SetPulse(0);
DestroyThing(hook);
hook = 0;
hooklanded = 0;
SetPhysicsFlags(player, 0x1);
}

Return;

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

selected:
player = GetSourceRef();

// Setup the meshes and models.
jkSetPOVModel(player, povModel);
jkSetWeaponMesh(player, weaponMesh);
SetArmedMode(player, 1);

// Play mounting sound.
PlayMode(player, 41);
PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80);

// Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
// The animation is held at the last frame after it is played.
trackID = jkPlayPOVKey(player, mountAnim, 0, 0x14);
jkSetWaggle(player, '10.0 7.0 0.0', 350);

// Clear saber flags, and allow activation of the weapon
jkClearFlags(player, 0x5);
SetCurWeapon(player, 2);
SetMountWait(player, GetKeyLen(mountAnim));

Return;

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

deselected:
player = GetSourceRef();
weaponIndex = GetSenderRef();

PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
jkPlayPOVKey(player, dismountAnim, 0, 0x18);

holsterWait = GetKeyLen(holsterAnim);
SetMountWait(player, holsterWait);
holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
SetTimerEx(holsterWait, 2, 0.0, 0.0);
if (trackID != -1)
{
jkStopPOVKey(player, trackID, 0);
trackID = -1;
}
jkSetWaggle(player, '0.0 0.0 0.0', 0);

Return;

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

autoselect:
player = GetSourceRef();

// If the player has the weapon
if(GetInv(player, 2) != 0.0)
{
// If the player has ammo
if(GetInv(player, 11) != 0.0)
{
ReturnEx(500.0);
}
else
{
ReturnEx(-1.0);
}
}
else
{
ReturnEx(-1.0);
}

Return;

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

timer:
StopKey(player, holsterTrack, 0.0);
Return;

end


------------------
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
2000-11-24, 5:34 AM #4
Weird. It might not like that grappling hook stuff. Check it in Cogwirter (yes, cogwirter). What happens when you try it? Also, is there a stop_power message in the force protection cog?
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2000-11-24, 10:25 AM #5
Hey, Vader, I checked both the weapon cog and the Persuasion cog in cogwriter and I got no errors.

The Force Persuasion cog has a stop_power message in the cog section, but I'm posting it just in case you can see something that I might be missing.

P.S.: Thanks a million for all of your help. Hope you had a happy Thanksgiving.


# Jedi Knight Cog Script
#
# FORCE_PERSUASION.COG
#
# FORCEPOWER Script - Persuasion
# Light Side Power
# Bin 26
#
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

thing player local

flex mana local
flex cost=3 local
int rank local

sound persuasionSound=ForcePersuas01.WAV local

int channel=-1 local
int iAlignmentPriority=-1 local

int inbubble=0 local
int old local
int new local

message startup
message activated
message pulse
message newplayer
message killed
message selected
message enterbubble
message exitbubble

end

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

code

startup:
player = GetLocalPlayerThing();
inbubble = 0;
call stop_power;

Return;

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

activated:
if(inbubble) Return;
if(old == 0)
{
new = 1;
if(!IsInvActivated(player, 26))
{
print("Immersion Activated");
if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);

// Send a "force disturbance"...
if(!IsMulti())
SendMessageExRadius(GetThingPos(player), cost, 0x4, splash, 26, 0, 0, 0);

SetInvActivated(player, 26, 1);

PlayMode(player, 24);

// Play activation sound
PlaySoundThing(persuasionSound, player, 1.0, -1, -1, 0x80);

rank = GetInv(player, 26);

// Set player invisible to AI
SetActorFlags(player, 0x80);

//Change Alignment Priority
{
if (iAlignmentPriority != -1)
{
aiRemoveAlignmentPriority(iAlignmentPriority);

iAlignmentPriority = -1;
}
iAlignmentPriority = aiAddAlignmentPriority(0.0, 1);
}

// Set player "invisible" to real players
if(rank == 1) jkSetPersuasionInfo(player, 14, 22);
else if(rank == 2) jkSetPersuasionInfo(player, 11, 19);
else if(rank == 3) jkSetPersuasionInfo(player, 8, 16);
else if(rank == 4) jkSetPersuasionInfo(player, 5, 13);

SetThingCurGeoMode(player, 0);
jkSetFlags(player, 0x20);

SetPulse(0.5);
}
}

Return;


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

pulse:
if(GetThingHealth(player) < 1) call stop_power;

mana = GetInv(player, 14);
if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
if(mana <= 0)
{
call stop_power;
}

Return;

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

selected:
old = new;
if(old == 1)
{
call stop_power;
}
Return;

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

killed:
if(GetSenderRef() != player) Return;

newplayer:
call stop_power;

Return;

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

enterbubble:
inbubble = 1;
call stop_power;
Return;

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

exitbubble:
inbubble = 0;
Return;

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

stop_power:
print("Immersion Deactivated");
new = 0;
SetPulse(0);
KillTimerEx(1);
if(channel != -1)
{
StopSound(channel, 0.1);
channel = -1;
}
SetInvActivated(player, 26, 0);
ClearActorFlags(player, 0x80);
SetThingCurGeoMode(player, GetThingGeoMode(player));
jkClearFlags(player, 0x20);

{
if (iAlignmentPriority != -1)
{
aiRemoveAlignmentPriority(iAlignmentPriority);

iAlignmentPriority = -1;
}
}

Return;

end



------------------
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
2000-11-24, 12:33 PM #6
Ahh. I understand. First, in the weapon cogs, change
Code:
SendMessage(fpcog, stop_power);

to
[/code]
SendMessage(fpcog, user0);
Then, in force persuasion, insert:
Code:
message user0

Then, at the end of the cog, right before it says "end", insert:
Code:
user0:
call stop_power;

That should do it.

[This message has been edited by lordvader (edited November 25, 2000).]
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2000-11-24, 3:39 PM #7
Lordvader, you are officially "Tha Bomb".

It worked like a charm and my mod is now rolling full steam ahead.

Thanks a milllion, buddy. I owe you one.

------------------
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
2000-11-25, 3:00 AM #8
No problem. Any time...
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2000-11-30, 11:17 AM #9
Hey, Vader, I hate to bother you again with the same old thing, but I've hit a very minor snag.

I've gotten all of my weapon cogs to work, with 2 minor exceptions - the thermal detonators and the flash grenades.

I've played around with them for the past few days but I can't seem to get them to work like I want them to.

Here's a copy of the TD cog that I modified. Maybe you can pick out something that I may be doing wrong.

And, as always, thanks for the help.

# Jedi Knight Cog Script
#
# WEAP_THERMDET.COG
#
# WEAPON 4 Script - Thermal Detonator
#
# Fun to use and handy for clearing some elbow room. Not recommending
# for those with noodle arms. The longer you hold down the fire key
# (CTRL/Z) the farther you throw the detonator.
#
# The primary fire throws the detonator with the 3 second delay, the
# secondary makes it explode on impact.
#
# - Not affected by MagSealed sectors/surfaces.
#
# [YB & CYW]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ========================================================================================

symbols

model povModel=detv.3do local
model povModel_m=detv_m.3do local
model weaponMesh=detg.3do local

keyframe mountAnim=detvmnt.key local
keyframe dismountAnim=detvdis.key local
keyframe povFireAnim=detvpst1.key local
keyframe prePOVThrowAnim=detvpre1.key local
#keyframe preThrowAnim=kyrthro0.key local
keyframe holsterAnim=kyhlstr.key local

template projectile=+grenade1 local
template projectile1=+grenade2 local
template projectileB=+dudgrenade local

sound throwSound=ThermalThrow01.wav local
sound clickSound=ThermClick01.wav local
sound clickSound2=ThermClick02.wav local
sound loopSound=ThermLoop01.wav local

flex delayTime=1.0 local
flex throwWait=0.8 local
flex mountWait local
flex autoAimFOV=10 local
flex autoAimMaxDist=5 local
flex holsterWait local

thing player local

int preThrowTrack local
int selectTrack local
int prePOVThrowTrack local
int mode local
int cocked=0 local
int holsterTrack local

int selectMode=1 local

cog fpcog

message startup
message activated
message deactivated
message selected
message deselected
message autoselect
message timer
message newplayer
message splash

end

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

code

startup:
// Setup delays and variables.
mountWait = GetKeyLen(mountAnim);
fpcog=GetCogInv(player, 26);
preThrowTrack=-1;
selectTrack=-1;
prePOVThrowTrack=-1;

Return;

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

activated:
player = GetSourceRef();
mode = GetSenderRef();
if (mode > 1)
Return;

PlaySoundThing(clickSound[mode], player, 1.0, -1.0, -1.0, 0x80);

// Cock arm back for throw.
if(preThrowTrack == -1 && prePOVThrowTrack == -1)
{
prePOVThrowTrack = jkPlayPOVKey(player, prePOVThrowAnim, 1, 0x14);
preThrowTrack = PlayMode( player, 38 );
ActivateWeapon(player, 0, mode);
}
Return;

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

deactivated:
player = GetSourceRef();
mode = GetSenderRef();

delayTime = DeactivateWeapon(player, mode); // allow activated messages again.

// Don't throw if controls are disabled.
if (!(GetActorFlags(player) & 0x200000))
{
// Make sure both keys are up before continuing.
if (GetCurWeaponMode() != -1)
Return;

// Set maximum scale factor (2 second hold.)
if(delayTime > 2)
delayTime = 2;

// Set minimum scale factor
if(mode == 0)
{
if(delayTime < 0.7) delayTime = 0.7;
}
else
{
if(delayTime < 0.25) delayTime = 0.25;
}

if(preThrowTrack != -1 && prePOVThrowTrack != -1)
{
jkStopPOVKey(player, prePOVThrowTrack, 0);
StopKey(player, preThrowTrack, 0);
preThrowTrack = -1;
prePOVThrowTrack = -1;
}

if (GetInv(player, 93))
{
mode = 2;
SendMessageEx(GetThingClassCog(player), skill, 1100, 0, 0, 0);
}

// Throw the appropriate detonator.
SetPOVShake('0.0 -.003 0.0', '0.5 0.0 0.0', .05, 40.0);
jkPlayPOVKey(player, povfireAnim, 1, 0x38);
PlaySoundThing(throwSound, player, 1.0, 0.5, 2.5, 0x80);
SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3, 0, 0, 0);
SendMessage(fpcog, user0);
FireProjectile(player, projectile[mode], -1, 15, '0.05 0 0', '0 0 0', delayTime, 0x1, 0.0, 0.0);
ChangeInv(player, 4, -1.0);
SetMountWait(player, throwWait);

// If out of ammo try to autoswitch to another weapon
// if autoswitch is enabled else just switch to fists.
if(GetInv(player, 4) < 1)
{
if(GetAutoSwitch() & 1)
{
SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
}
else
{
SelectWeapon(player, 1);
}
}
}
else
{
if(preThrowTrack != -1 && prePOVThrowTrack != -1)
{
jkStopPOVKey(player, prePOVThrowTrack, 0);
StopKey(player, preThrowTrack, 0);
preThrowTrack = -1;
prePOVThrowTrack = -1;
}
}

jkSetWaggle(player, '0.0 0.0 0.0', 0);
SetTimerEx(throwWait, 0, 0, 0);

Return;

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

timer:
if (GetSenderId() == 0)
{
// Start waggling after the throw.
jkSetWaggle(player, '10.0 7.0 0.0', 350);
}
else
if (GetSenderId() == 2)
{
StopKey(player, holsterTrack, 0.0);
}
Return;

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

selected:
player = GetSourceRef();

jkSetWaggle(player, '10.0 7.0 0.0', 350);

// Play external mounting animation
PlayMode(player, 40);

// Setup the meshes and models.
if (GetInv(player, 67) == 0.0)
jkSetPOVModel(player, povModel); // Kyle hand
else
jkSetPOVModel(player, povModel_m); // Mara Hand
SetArmedMode(player, 0);
jkSetWeaponMesh(player, weaponMesh);

// Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
// The animation is held at the last frame after it is played.
selectTrack = jkPlayPOVKey(player, mountAnim, 0, 0x14);
SetMountWait(player, GetKeyLen(mountAnim));

// Clear Lightsaber flag, and enable activation messages.
jkClearFlags(player, 0x5);
SetCurWeapon(player, 4);
SetMountWait(player, GetKeyLen(mountAnim));

Return;

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

deselected:
player = GetSourceRef();

jkPlayPOVKey(player, dismountAnim, 0, 18);

holsterWait = GetKeyLen(holsterAnim);
SetMountWait(player, holsterWait);
holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
SetTimerEx(holsterWait, 2, 0.0, 0.0);
if(selectTrack != -1)
{
jkStopPOVKey(player, selectTrack, 0);
selectTrack = -1;
}
jkSetWaggle(player, '0.0 0.0 0.0', 0);
KillTimerEx(0);

if(preThrowTrack != -1 && prePOVThrowTrack != -1)
{
jkStopPOVKey(player, prePOVThrowTrack, 0);
StopKey(player, preThrowTrack, 0);
preThrowTrack = -1;
prePOVThrowTrack = -1;
}

Return;

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

autoselect:
selectMode = GetSenderRef();
player = GetSourceRef();

// If the player has ammo
if(GetInv(player, 4) != 0)
{

// query for ammo
if(selectMode == -1)
{
ReturnEx(400.0);
Return;
}

if((selectMode == 0) && !(GetAutoPickup() & 2))
{
ReturnEx(400.0);
Return;
}

if((selectMode == 1) && !(GetAutoSwitch() & 2))
{
ReturnEx(400.0);
Return;
}

if((selectMode == 2) && !(GetAutoPickup() & 2))
{
ReturnEx(400.0);
Return;
}

ReturnEx(-2.0);
Return;

}
else
{
ReturnEx(-1.0);
}

Return;

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

newplayer:
if(preThrowTrack != -1 && prePOVThrowTrack != -1)
{
jkStopPOVKey(player, prePOVThrowTrack, 0);
StopKey(player, preThrowTrack, 0);
preThrowTrack = -1;
prePOVThrowTrack = -1;
}
Return;

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


end


------------------
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
I just love that part of the Jedi Code that says, "There is no ignorance - only knowledge". If that's the case, then what am I doing on this Force-blasted message board??!!
2000-11-30, 12:46 PM #10
I honestly have no idea. I'll think about it though. I may be able to figure it out.
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words

↑ Up to the top!