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 → A Model Switching function...
A Model Switching function...
2001-03-21, 9:10 PM #1
Well, I know nothing about cog, and I've always wanted to add this feature to my patch, so I thought I might as well ask for some help on here:
I cog...that when a hotkey is pressed, will see what player model you currently are using, and with that info switch to another predetermined model.

So, "If you're this guy, change to this guy."

If I explained it well enough, it should be fairly simple, and I'm pretty confident it can be done in JK, so any help would be VERY appreciated, and duely credited.

Thanks ALOT,

-TIE
2001-03-22, 3:18 AM #2
It would probably work something like this:
Code:
if(GetThingModel(player) == model1)
    {
    SetThingModel(player, model2);
    }

And then you would do that over and over until you got the number of possible models you wanted. Look at the JK Specs to make sure I got the SetThingModel verb right. You'd also have to specify in the symbols section the player and all the possible models.

jh
2001-03-22, 9:05 AM #3
Thanks for that code, but...you lost me on the bottom....
I know NOTHING about cog. I only posted this on the slim chance that someone would walk me through the entire process of setting up a hotkeyable model changing function...
And we're half way there!

Thanks JH,

-TIE
2001-03-22, 9:30 AM #4
TIE, the DBZ:TDIR currently uses a model calling cogs to do our transformations. I'll get Hell Raiser to tell you how you can do it with more stability than the one above.

------------------
The Wheel turns, and Ages come and pass.. Leaving history to myth, myth to legend, and then even legend is forgotten..
My Flickr Gallery
2001-03-22, 10:42 AM #5
Sorry. OK, first you need a cog like this:
Code:
# Jedi Knight Cog Script
# model-changer.cog
# Changes your model
# for TIE
symbols
model model1=#####.3do   local
model model2=+++++.3do   local
#keep doing this for as long as you need
#and replace the marks with the model files
#you want to change to.
int   cur_model          local
thing player             local
message startup          local
message activated        local
end
#========================================
code:
startup:
player=GetLocalPlayerThing();
return;
#========================================
activated:
cur_model = GetThingModel(player);
#copy this stuff however many times you need
#for each model:
if(cur_model == model1)SetThingModel(player, model2);
if(cur_model == model2)SetThingModel(player, model3);
if(cur_model == model3)SetThingModel(player, model1);
return;
#===========================================
end


How many do you need?

jh

[This message has been edited by Jedi Howell (edited March 22, 2001).]
2001-03-22, 2:29 PM #6
Wow...

More "thanks" than you can possibly conceive, jh, I'm truely humbled by your helpfulness!

-TIE

[This message has been edited by TIE_14 (edited March 22, 2001).]
2001-03-22, 2:48 PM #7
I came up with this:

Code:
# Jedi Knight Cog Script
# model-changer.cog
# Changes your model
# for TIE
symbols
model model1=benkenobi.3do local
model model2=benrobe.3do local
model model3=benduel.3do local
model model4=dmrobe.3do local
model model5=dm.3do local
model model6=jediobiwan.3do local
model model7=jediobirobe.3do local
model model8=jediobiduel.3do local
model model9=mace.3do local
model model10=macerobe.3do local
model model11=maceduel.3do local
model model12=obiknight.3do local
model model13=obirobe.3do local
model model14=obiduel.3do local
model model15=padanknight.3do local
model model16=padanrobe.3do local
model model17=padawanakin.3do local
model model18=plo.3do local
model model19=plorobe.3do local
model model20=quiknight.3do local
model model21=quirobe.3do local
model model22=quiduel.3do local
#keep doing this for as long as you need
#and replace the marks with the model files
#you want to change to.
int cur_model local
thing player local
message startup local
message activated local
end
#========================================
code:
startup:
player=GetLocalPlayerThing();
return;
#========================================
activated:
cur_model = GetThingModel(player);
#copy this stuff however many times you need
#for each model:
if(cur_model == model1)SetThingModel(player, model2);
if(cur_model == model2)SetThingModel(player, model3);
if(cur_model == model3)SetThingModel(player, model1);
if(cur_model == model4)SetThingModel(player, model5);
if(cur_model == model5)SetThingModel(player, model4);
if(cur_model == model6)SetThingModel(player, model7);
if(cur_model == model7)SetThingModel(player, model8);
if(cur_model == model8)SetThingModel(player, model6);
if(cur_model == model9)SetThingModel(player, model10);
if(cur_model == model10)SetThingModel(player, model11);
if(cur_model == model11)SetThingModel(player, model9);
if(cur_model == model12)SetThingModel(player, model13);
if(cur_model == model13)SetThingModel(player, model14);
if(cur_model == model14)SetThingModel(player, model12);
if(cur_model == model15)SetThingModel(player, model6);
if(cur_model == model16)SetThingModel(player, model17);
if(cur_model == model17)SetThingModel(player, model17);
if(cur_model == model18)SetThingModel(player, model19);
if(cur_model == model19)SetThingModel(player, model18);
if(cur_model == model20)SetThingModel(player, model21);
if(cur_model == model21)SetThingModel(player, model22);
if(cur_model == model22)SetThingModel(player, model20);
return;
#===========================================
end


Will that work...? It's in the orders and stuff that I wanted, just incase you saw those inconsistancies with the switching...
If that does, how do I make this a hotkeyable function? Also, it'll have to be the third hotkey, because I've already used two (you can only have three hotkeys in JK, right?)

Your guys' support...I can't thank you enough for it, I never thought I'd get this kind of feedback. [http://forums.massassi.net/html/smile.gif]

-TIE
2001-03-22, 3:32 PM #8
One thing:
You have code:
That has to be changed to just code
No colon

------------------
Together we stand.
Divided we fall.
2001-03-22, 3:54 PM #9
Oh, thanks Aglar.
I promise I would have never noticed that...

-TIE
2001-03-22, 4:02 PM #10
That's what I'm here for [http://forums.massassi.net/html/smile.gif]

------------------
Together we stand.
Divided we fall.
2001-03-22, 5:42 PM #11
Well, Hideki has a really great tutorial on that from which I learned. Basically, it's just adding and modifying a few lines in items.dat and jkstrings.uni.

Here's what would go after your other 2 hotkeys in items.dat:

model-changer 118 0 1 0x100 cog=model-changer.cog

Change the 0x100 to a 0x102 for an inventory item, and 0x108 for a f_power. For an item that is always with you, set it to 0x120 .

Then add this line to the end of jkstrings.uni:

ACTIVATE19 0 "Model-Change"

That should do it.

Plus, you should change this:
message startup local
message activated local

to this:

message startup
message activated

Don't know what'll happen otherwise.

jh

[This message has been edited by Jedi Howell (edited March 22, 2001).]
2001-03-22, 8:32 PM #12
Words...cannot express....the love I feel for you right now.
It works great, THANKS.
You were so very helpful, and I'm so very grateful..."my saber is yours."

Unfortunately, there's one problem...it only works, for some reason, in LEC levels...but that can't be your fault, so again, THANK YOU.

If you want to see how it works and try out the patch, just email me @ TIE@usetheforce.co.uk

I can't thank enough...! [http://forums.massassi.net/html/smile.gif]

-TIE
2001-03-23, 6:02 PM #13
Oops! [http://forums.massassi.net/html/redface.gif] I made a mistake with the flags for items.dat .(Flags are those un-understandable hexadecimal numbers)For an item that is always with you, you add 20 to the second number. So if it was a force power that was always with you it would be:
0x128

and an inventory item would be:

0x122

and I believe(not sure) that a weapon would be:

0x124

So just change 0x108 or 0x102 or 0x120 to whatever is correct. The Field Light is 0x122 and the fists are probably 0x124. Sorry 'bout that.

Oh, and visit the post "6th or 7th sense...". I need someone to help me test my mod. [http://forums.massassi.net/html/smile.gif]

jh



[This message has been edited by Jedi Howell (edited March 23, 2001).]
2001-03-23, 8:22 PM #14
When I changed my "1x120" to "1x128" and then to "1x122" both kicked my out of the game when the level finished loading.
1x120 worked (sort of...) and that's what the glowsaberfunctions above it are set at, so I think you were right in the first place.

But while I'm here...It seems that JK can't handle the cog or something...
I know it's cogged fine (well, I don't KNOW, but I'm pretty sure) and after extensive studying, I've found the following:

-I cannot switch between more than 17 models in total.

-Anytime I use a non-LEC level, I show up as Kyle

-Last but not least...Any model I use that is NOT in the model switching cog shows up as Kyle ONLY in Battle Ground Jedi...(?)

Any ideas...?
Your help has been EXTREMELY appreciated, and further help would be aswell...!

-TIE

PS: When it works, it's amazing, just what I wanted! [http://forums.massassi.net/html/smile.gif]

[edit] Yes, I'm an idiot...apparently "add 20 to the second number" didn't clue in to me. I'm testing 1x140 now...

[This message has been edited by TIE_14 (edited March 23, 2001).]
2001-03-24, 3:05 AM #15
No no no no no...

It's 0x100 for a hotkeyable item. Then you add together for a force power that is always with you:

0x20
0x100
0x8

Which should work.I sent you and e-mail to send me your stuff.

jh
2001-03-24, 7:44 AM #16
just set it at 0x100 that works fine for pretty much anything and it should work for this 0x100 is for your basic hotkeys
[edit] oops sorry i just tested it and it didn't work, i think jh is right try 0x122 it might work, about a week ago i made a cog just like this and w/ a ltlle help from hideki it ended up looking exactly like yours, so i am also trying to get all the bugs worked out of this. [/edit]

[This message has been edited by Han5678 (edited March 24, 2001).]
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-03-24, 9:35 AM #17
Well...:

-I tried 1x122 and 1x128 and they crashed the game.

-1x120 and 1x140 worked the same, with the above problems.

-1x100 had all the problems mentioned above, and the models wouldn't switch...

I'm trying to get into my email, but right now on the site, there's no "user name" and "password" text boxes....so it's hard. [http://forums.massassi.net/html/smile.gif]

Thanks alot for being so patient with me,
-TIE
2001-03-24, 10:04 AM #18
Hey i have been playing with the flags and none of the ones i know of that might work failed. Every time with each flag the game crashes just after the lev is loaded. So exactly which flag did not crash and let u change models? and what type of level were u playin sp, mp, custom, LEC?
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-03-24, 10:32 AM #19
With 1x120 and 1x140, they worked in LEC maps.
That is, all levels loaded, but I showed up as Kyle in custom levels.

-TIE

[This message has been edited by TIE_14 (edited March 24, 2001).]
2001-03-24, 10:41 AM #20
I somewhat doubt that it is a flag problem with the custom levels part i will try and correct it, if i can find a way.

i tried those flags and what happened was it loaded i was in the game for a second then it crashed

[This message has been edited by Han5678 (edited March 24, 2001).]
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-03-24, 2:54 PM #21
I think I know what's going on with some people crashing on flags and some not. TIE posted the flags as 1xwhatever. It's supposed to be 0xwhatever. Might at least fix that problem if nothing else.

jh
2001-03-24, 3:05 PM #22
He's right, of course...sorry about that, Han. [http://forums.massassi.net/html/frown.gif]

-TIE
2001-03-25, 5:36 AM #23
Thats what i thought i had never seen a jk flag with 1 at the beginning. The thing is whenever i have it at 0x120 it crashes and when i have it at 0x140 it crashes, this cog seems to be a bit jumpy i don't like it at all.
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-03-25, 3:48 PM #24
Just a few minor stuff.

1.Get rid of startup message and place this in the first line of the activated message.

player = GetSourceRef();

2. Place "else" in every other lines, so it's slightly friendly to computer..., but don't end the message with "else" or it won't work.

Code:
if(cur_model == model1) SetThingModel(player, model2);
else
if(cur_model == model2) SetThingModel(player, model3);
else
.
.
.
else
if(cur_model == model22)SetThingModel(player, model20);


As for the flags, check here.
http://www.code-alliance.com/~editors/jediknight/docs/jk_specs/cog_flags.htm#inventory_flags

------------------
http://millennium.massassi.net/ - Millennium
2001-03-25, 8:12 PM #25
Thanks, but...all that did was make it so that I can't switch models in "Blades of Death"....(?)

[edit]Nevermind...I, of course, did it wrong...I'm pretty sure I fixed it so it's how you said it should be, but I still can't switch in Usermade levels...
Any Ideas?

Thanks alot,
-TIE

[This message has been edited by TIE_14 (edited March 25, 2001).]

↑ Up to the top!