### Replace TP and FP player models with only scripting?

Scripting questions, discussions, etc
• 1
• 2

#### Replace TP and FP player models with only scripting?

saindd
Posts: 220
Joined: Wed Apr 15, 2015 3:20 am
I've noticed that there is a lot of hardcoded stuff in player.cpp. Is it possible to create a completely new TP and FP player models with only script changes?

#### Re: Replace TP and FP player models with only scripting?

buckmaster
Steering Committee
Posts: 321
Joined: Thu Feb 05, 2015 1:02 am
You mean weapon images? And what do you mean by 'completely new'?

#### Re: Replace TP and FP player models with only scripting?

rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm

Yeah, the models are all set in the player datablock....

#### Re: Replace TP and FP player models with only scripting?

saindd
Posts: 220
Joined: Wed Apr 15, 2015 3:20 am
Not images, the models. They are referenced in the player datablock, OK. I can just switch that, but the code inside the player class expects some bones and tags to exist, that's what i mean by hardcoded.

#### Re: Replace TP and FP player models with only scripting?

TorqueFan
Posts: 87
Joined: Thu Apr 30, 2015 5:35 am
saindd wrote:Not images, the models.

A weapon image is the model. As an example, open up art/datablocks/weapons/Ryder.cs:

Code: Select all

datablock ShapeBaseImageData(RyderWeaponImage){   // Basic Item properties   shapeFile = "art/shapes/weapons/Ryder/TP_Ryder.DAE";   shapeFileFP = "art/shapes/weapons/Ryder/FP_Ryder.DAE";   emap = true;      ...}

Here the 'RyderWeaponImage' datablock uses the 'shapeFile' field to designate where the new weapon model is located. Is this what you are after, just trying to import a new model for a weapon? If you were to change that above to point to another .DAE file, when the Soldier tried to equip the Ryder weapon it would instead equip the new weapon model. There are optional nodes that can be added to the model's art for things like the muzzlepoint, ejectpoint, etc. but none of that is required and nothing in the player code will prevent any shape from being used as a weapon.

Otherwise, if you are needing to implement an entirely new weapon class that has a different functionality you would need to create a new weapon class in source (probably based off of ShapeBaseImageData).

#### Re: Replace TP and FP player models with only scripting?

rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm

The Player class expects a model that uses the 3DS MAX Biped naming convention more or less. You can rig your player models (or other models) in any way you like, but certain bones are expected to have particular names.

Once your model is rigged just export it to COLLADA and then get it imported. Someone posted a basic walkthrough on that somewhere on the old GG forums if I recall....

So, I guess actually the answer is "NO," you cannot create new models purely in script - you have to use a modelling application to make and export them. But switching between models is done in script.

#### Re: Replace TP and FP player models with only scripting?

Duion
Posts: 931
Joined: Sun Feb 08, 2015 1:51 am

It does not matter what your model is like, you just need to follow some conventions for LOD levels if you want to use them and the names for the nodes like eye, mount etc.

#### Re: Replace TP and FP player models with only scripting?

buckmaster
Steering Committee
Posts: 321
Joined: Thu Feb 05, 2015 1:02 am
Which particular bones are giving you trouble? I thought a lot of those hardcoded bone names were actually unused currently. AFAIR all the spine nodes are unused. Things like eye and cam are still used, but they make sense!

#### Re: Replace TP and FP player models with only scripting?

saindd
Posts: 220
Joined: Wed Apr 15, 2015 3:20 am
rlranft wrote:The Player class expects a model that uses the 3DS MAX Biped naming convention more or less. You can rig your player models (or other models) in any way you like, but certain bones are expected to have particular names.

Once your model is rigged just export it to COLLADA and then get it imported. Someone posted a basic walkthrough on that somewhere on the old GG forums if I recall....

So, I guess actually the answer is "NO," you cannot create new models purely in script - you have to use a modelling application to make and export them. But switching between models is done in script.

This is what i'm talking about. What are the required bone names?

#### Re: Replace TP and FP player models with only scripting?

rlranft
Posts: 298
Joined: Thu Feb 05, 2015 3:11 pm

saindd wrote:This is what i'm talking about. What are the required bone names?

They're in the source....
https://github.com/RichardRanft/Torque3 ... r.cpp#L514
Just take a quick look - I figured you had already found this or you wouldn't have brought it up earlier....

Also - should name anim sequences like these to get them to automatically work when moving:
https://github.com/RichardRanft/Torque3 ... r.cpp#L141

I do homework for \$25 a page, too.
• 1
• 2

#### Who is online

Users browsing this forum: No registered users and 1 guest