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 → Werewolf Morphing Cog
Werewolf Morphing Cog
2000-10-07, 8:50 AM #1
I'm pretty much a level cogger so don't have much experience with mod cogging. Anway for the Discworld TC we are having a werewolf skin, and this is what i've done so far for the morphing cog.

Code:
# Werewolf.COG
#
# [By RaccoonKing]
#

symbols

template    wolfmodel=wolf.3do                local
template    humanbuffer=angua.3do             local
int         wolfstatus=0                      local
sector      cursector			      local
thing       player

message     startup
message     pulse
message     timer
message	    killed
message     activated

end

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

code
startup:
   player = GetLocalPlayerThing();
   humanbuffer=GetThingTemplate(player); 
   Return;

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

pulse:
   player = GetLocalPlayerThing();
   cursector=GetThingSector(player); 
   if GetSectorFlags(cursector) == 0x40000000
   {
   SetThingModel(player,wolfmodel);
   ParseArg(player, "puppet=wolf.pup");
   ParseArg(player, "snd=wolf.snd");
   wolfstatus = 1;
   }
   Return;

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

timer:
   SetPulse(1.5);
   Return;

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

killed:
   player = GetLocalPlayerThing();
   SetThingModel(player,humanbuffer);
   ParseArg(player, "puppet=wolfman.pup");
   ParseArg(player, "snd=ky.snd");
   wolfstatus = 0;
   Return;

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

activated:
   player = GetLocalPlayerThing();
   if wolfstatus == 0
   {
   SetThingModel(player,wolfmodel);
   ParseArg(player, "puppet=wolf.pup");
   ParseArg(player, "snd=wolf.snd");
   wolfstatus = 1;
   }
   else if wolfstatus == 1
   {
   SetThingModel(player,humanbuffer);
   ParseArg(player, "puppet=wolfman.pup");
   ParseArg(player, "snd=ky.snd");
   wolfstatus = 0;   
   }

   Return;


end


Could i have some help in making sure this works properly, ie free up resources correctly, correct verbs etc. Thanks [http://forums.massassi.net/html/smile.gif]

[This message has been edited by RaccoonKing (edited October 07, 2000).]
2000-10-07, 9:06 AM #2
you dont use tmeplates for 3dos

use this
model wolfmodel=wolf.3do
model humanbuffer=angus.3do

and i dont see why you used:
humanbuffer=GetThingTemplate(player);
I'm just an old man with a skooma problem.
2000-10-07, 10:03 AM #3
We may be having a few Generic werewolves as well as Angua, so thats why it reads the player model at startup
2000-10-07, 11:19 AM #4
if you set the human buffer to GetThingTemplate or whatever, it wont be set to the 3do you set it to in the symbols though.
I'm just an old man with a skooma problem.
2000-10-07, 11:39 AM #5
well...i think this will not work...somehow JK doesn't let you change puppets more than 3 times...dunno why, but i encountered this problem while working on my Kill JarJar mod...but i might be wrong, though...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2000-10-08, 4:21 AM #6
...but Spork changes the pup file everytime you toggle the lightstaff
2000-10-08, 5:04 AM #7
BTW does ParseArg(whatever) just temporarily change the template (static.jkl) values for the given thing?
2000-10-08, 5:08 AM #8
And now... the latest version of the cog... it does nothing at all. In jkstrings.uni i gave it the activate16 hotkey. In items.dat i gave it bin #116 with flag 0x100, min value 0, maxvalue 1. The cog is as follows

Code:
# Werewolf.COG
#
# [By RaccoonKing]
# Morphs the player into a wolf when command is activated or enters moonlight

symbols

model       wolfmodel=mb.3do                local
model       humanbuffer=ky.3do                local
int         wolfstatus=0                      local
sector      cursector			      local
thing       player

sound       WolfActivate=21forceabsorb1.wav
sound       WolfDeactivate=21forceabsorb1.wav

message     startup
message     pulse
message     timer
message	    killed
message     activated

end

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

code
startup:
   player = GetLocalPlayerThing();
   humanbuffer = GetThingTemplate(player); 
   Return;

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

pulse:
   player = GetLocalPlayerThing();
   cursector = GetThingSector(player); 
   if(GetInv(player, 116))
   {
   if GetSectorFlags(cursector) == 0x40000000 // Continues is sector is flagged as moonlight
   {
   SetThingModel(player,wolfmodel);
   ParseArg(player, "puppet=mb.pup");
   ParseArg(player, "snd=ky.snd");
   wolfstatus = 1;
   SetInvActivated(player, 116, 1);
   PlaySoundThing(WolfActivate, player, 1.0, -1, -1, 0x80);
   Print("The Lunar Rays have penetrated your morphogenic memory");
   }
   }
   Return;

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

timer:
   SetPulse(1);
   Return;

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

killed:
   player = GetLocalPlayerThing();
   SetThingModel(player,humanbuffer);
   ParseArg(player, "puppet=ky.pup");
   ParseArg(player, "snd=ky.snd");
   SetInvActivated(player, 116, 0);
   PlaySoundThing(WolfDeactivate, player, 1.0, -1, -1, 0x80);
   wolfstatus = 0;
   Return;

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

activated:
   player = GetLocalPlayerThing();
   if(GetInv(player, 116))
   {
   if wolfstatus == 0
   {
   SetThingModel(player,wolfmodel);
   ParseArg(player, "puppet=mb.pup");
   ParseArg(player, "snd=ky.snd");
   wolfstatus = 1;
   SetInvActivated(player, 116, 1);
   PlaySoundThing(WolfActivate, player, 1.0, -1, -1, 0x80);
   Print("You have morphed into a Werewolf");
   }
   else if wolfstatus == 1
   {
   SetThingModel(player,humanbuffer);
   ParseArg(player, "puppet=ky.pup");
   ParseArg(player, "snd=ky.snd");
   SetInvActivated(player, 116, 0);
   PlaySoundThing(WolfDeactivate, player, 1.0, -1, -1, 0x80);
   wolfstatus = 0;   
   Print("You have morphed back into a human");
   }
   }
   Return;


end


BTW i changed the wolf.3do to the mousebot (mb.3do) for the benefit of testing

[This message has been edited by RaccoonKing (edited October 08, 2000).]
2000-10-08, 7:33 AM #9
GetThingModel not GetThingTemplate... You never set a timer, so the the pulse never gets set... thats all I can see now...

------------------
cogs dont kill people. people kill people...

[url="mailto:no_oneatall@hotmail.com"]mailto:no_oneatall@hotmail.com[/url]no_oneatall@hotmail.com</A>
ICQ 81116825
===========================================
Evil Cog master of the Western TC!
cogs dont kill people. people kill people...

mailto:no_oneatall@hotmail.comno_oneatall@hotmail.com</A>
ICQ 81116825
==============================================
((Evil Cog Master))
2000-10-08, 10:17 AM #10
well...are you sure that you don't need the brackets in the if conditions? And im not sure about your first if condition...GetInv returns a flex value...not sure if you can use flex values as boolean values (what you are doing here)
try if(GetInv(player, bin)!=0)...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2000-10-09, 8:01 AM #11
The cog works properly now (i tested it with Kell Dragon 3do, pup and snd) and i can change pup files as many times as i want. Zagibu since you are having trouble with pup files here is the full script for the cog (i plan on refining it later, but is fully functional for now)

Code:
# Werewolf.COG
#
# [By RaccoonKing]
# Morphs the player into a wolf when command is activated or enters moonlight

symbols

int         wolfstatus=0                      local
sector      cursector			      local
thing       player

sound       WolfActivate=21forceabsorb1.wav
sound       WolfDeactivate=21forceabsorb1.wav

message     newplayer
message     pulse
message	    killed
message     activated

end

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

code
newplayer:
   player = GetLocalPlayerThing();
   Print("Remember as a Werewolf you have the abilities of both Wolf and Man");
   SetPulse(1);
   Return;

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

pulse:
   cursector = GetThingSector(player); 
   if (GetSectorFlags(cursector) == 0x40000000) // Continues is sector is flagged as moonlight
   {
   ParseArg(player, "model3d=kd.3do");
   ParseArg(player, "puppet=kd.pup");
   ParseArg(player, "soundclass=kd.snd");
   wolfstatus = 1;
   SetInvActivated(player, 116, 1);
   PlaySoundThing(WolfActivate, player, 1.0, -1, -1, 0x80);
   Print("The Lunar Rays have penetrated your morphogenic memory");
   }
   Return;


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

killed:
   ParseArg(player, "model3d=ky.3do");
   ParseArg(player, "puppet=ky.pup");
   ParseArg(player, "soundclass=ky.snd");
   SetInvActivated(player, 116, 0);
   PlaySoundThing(WolfDeactivate, player, 1.0, -1, -1, 0x80);
   wolfstatus = 0;
   Return;

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

activated:
   if (wolfstatus == 0)
   {
   ParseArg(player, "model3d=kd.3do");
   ParseArg(player, "puppet=kd.pup");
   ParseArg(player, "soundclass=kd.snd");
   wolfstatus = 1;
   SetInvActivated(player, 116, 1);
   PlaySoundThing(WolfActivate, player, 1.0, -1, -1, 0x80);
   Print("You have morphed into a Werewolf");
   }
   else
   if (wolfstatus == 1)
   {
   ParseArg(player, "model3d=ky.3do");
   ParseArg(player, "puppet=ky.pup");
   ParseArg(player, "soundclass=ky.snd");
   SetInvActivated(player, 116, 0);
   PlaySoundThing(WolfDeactivate, player, 1.0, -1, -1, 0x80);
   wolfstatus = 0;   
   Print("You have morphed back into a human");
   }
   Return;


end

↑ Up to the top!