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 → How would I get a cog to detect when a weapon is fired?
How would I get a cog to detect when a weapon is fired?
2000-11-18, 6:25 PM #1
I'm trying to cause a Force power to be deactivated when any one of the player's weapons is fired. I've looked at the JK Specs forward and backward and I still can't figure it out.

Any suggestions?

------------------
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-18, 6:46 PM #2
message fired

------------------
Those who stare in the eyes of death and laugh will be the first to go.
Those who stare in the eyes of death and laugh will be the first to go.
2000-11-18, 7:36 PM #3
Thanks for the response, Hoard. I tried your suggestion, but I haven't been able to make it work quite right. I was wondering if you (or anyone else) could help me set this up the right way.

I've added this line to the symbols section:

message fire

And I've added these lines to the cog just before the stop_power section:

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

fire:
player = GetSourceRef();
call stop_power;
Return;

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

Can anyone tell me what I'm doing wrong? Thanks.

------------------
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??!!

[This message has been edited by Jedi Niyte (edited November 18, 2000).]
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-19, 2:25 AM #4
Just what exactly are you trying to do? Please post the cog with a description [http://forums.massassi.net/html/smile.gif]

-Jipe
2000-11-19, 7:42 AM #5
Read my response in your other post.
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2000-11-19, 7:31 PM #6
Okay, Jipe, here's the cog in its entirety. What I'm trying to do is get the cog, whenever a weapon is fired, to shut down.

I've tried lordvader's suggestion, but I can't seem to find the right verb/symbol to use to represent the Force Persuasion cog. I'll keep looking for it, though.

# 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??!!

↑ Up to the top!