PDA

View Full Version : Need help getting player model.



Mohh
10-31-2000, 01:34 AM
I'm writting a cog that changes your player model when an item is activated. That is working fine. The problem comes when I need to set the original player model back. I've been using:

original = GetThingModel(player);

to try and get the 3do and then:

SetThingModel(player, original);

to set it back, but I keep turning the player into a 3do of a beam. I know that I'm missing the 3do name in the first part, but I am not sure how to do it. I tried:

original = GetThingModel(player, ());

but obviously, that just messed up the whole cog. Any help will be greatly appreciated.

El Scorcho
10-31-2000, 04:24 AM
Post the entire cog (provided it isn't to large)...maybe theres something missing in the symbols section.

------------------
-El Scorcho

"One time I made a hat out of a lobster and a stick." -Pedro

Mohh
10-31-2000, 08:00 AM
Ok, here it is:


symbols

thing player
thing og
int actorFlags

message startup
message activated
message pulse
message killed

sound lightActivate=activate04.wav
sound lightDeactivate=deactivate04.wav

model cloak=kypred.3do local

end

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

code

startup:
og = GetThingModel(player);
player = GetLocalPlayerThing();
call stop_power;

Return;

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

activated:
player = GetSourceRef();

actorFlags = GetActorFlags(player);

if(GetInv(player, 42))
{
if(BitTest(actorFlags, 4))
{
// Print("Cloaking Device OFF");
jkPrintUNIString(player, 252);
ClearActorFlags(player, 4);
SetInvActivated(player, 42, 0);
PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
SetThingModel(player, og);
ClearThingFlags(player, 0x10);
SetPulse(0);
}
else
{
if(GetInv(player, 13) > 0)
{
// Print("Cloaking Device ON");
jkPrintUNIString(player, 251);
SetActorFlags(player,4);
SetInvActivated(player, 42, 1);
PlaySoundThing(lightActivate, player, 1.0, -1, -1, 0x80);
SetThingModel(player, cloak);
player = GetSourceRef();
mode = GetSenderRef();
SetPulse(1.5);
}
else
{
// Print("Cloaking Device out of power");
PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
jkPrintUNIString(player, 253);
}
}
}

Return;

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

pulse:
ChangeInv(player, 13, -10);
if(GetInv(player, 13) == 0)
{
// Print("Cloaking Device out of power");
jkPrintUNIString(player, 253);
PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
SetThingModel(player, og);
ClearThingFlags(player, 0x10);
ClearActorFlags(player, 4);
SetInvActivated(player, 42, 0);
SetPulse(0);
}

Return;

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

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

if(IsInvActivated(player, 42) == 1)
{
SetPulse(0);
ClearActorFlags(player, 4);
SetInvActivated(player, 42, 0);
}
Return;

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

stop_power:
SetPulse(0);
KillTimerEx(1);
SetInvActivated(player, 42, 0);

Return;

end



[This message has been edited by Mohh (edited November 01, 2000).]

Mohh
10-31-2000, 09:50 AM
With the above cog I get Katarn.

Mohh
10-31-2000, 09:57 AM
I think that's happening because og is not getting the 3do name of the player, so it is using the default one. Is there a way to get the 3do name of the model that the player is using?

Raynar
10-31-2000, 12:10 PM
Replace: 'thing og' with 'model og'

That should fix it.

Cheers...

Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots (http://rbots.massassi.net) - a project to develop a working Bot for Jedi Knight... download the latest development version here (http://rbots.massassi.net/downloads.php3)

Mohh
10-31-2000, 01:21 PM
I did what you adviced and it still comes up with Katarn. Thanks though. =)

El Scorcho
10-31-2000, 03:43 PM
Ok, I seem to remember having this same problem back when I was messing around with restoring the player model after I chopped its limbs off as a result of being shot with something.

...I did eventually fix it, and I believe (forgive me, I wrote that cog nearly a year ago) the problem was the model wasn't defined by the game right at startup, and therefore its always retrieved the kyle model (as a default perhaps?)...I think I remember timers set at the beginning to combat the delay also didn't work for some god unknown reason. So that theroy may be incorrect.

So what I did was move the getthingmodel() out the startup message, and into the beginning of the killed message. You should be able to obtain the same results by placing your og = getthingmodel(player); at the beginning of activated instead. Give it a shot. I'm not sure thats your problem, but thats my guess for now.

------------------
-El Scorcho

"One time I made a hat out of a lobster and a stick." -Pedro


[This message has been edited by El Scorcho (edited October 31, 2000).]

Mohh
10-31-2000, 08:11 PM
Kewl, thanks man. I'll try it out when I get home. I'm at work right now. Oh btw, should I return the model to a thing?

El Scorcho
10-31-2000, 08:12 PM
No, Rayner is correct, models are models...not things.


------------------
-El Scorcho

"One time I made a hat out of a lobster and a stick." -Pedro

Mohh
11-01-2000, 07:26 PM
Sorry to say that now it just stays cloaked. Maybe it has something to do with the fact that I use BFP2.1. Dunno, I'm going to add all of the models from BFP to my models.dat to see if that fixes it. Maybe it's been trying to find the model that I use but just can't find it so it defaults to Katarn. Thanks for the help, I'll place an update here after I've tested my theory.
I just noticed that I need to add the models to my jkstrings.uni also. Sigh... it's going to take a little while to add all of them.

[This message has been edited by Mohh (edited November 02, 2000).]

Mohh
11-02-2000, 04:19 PM
Here's what it looks like so far:

http://www.mohhs.com/shots/cloaking.jpg

P.S. The field light on message will be changed on the finished cog.

Mohh
11-04-2000, 09:20 AM
Well, even after adding all of the models from BFP2.1 I still only get Katarn. I guess the only thing to do now is to make this mod specific only for my clan by specifying the 3do for each member by matching it to their user name http://forums.massassi.net/html/frown.gif