Game Development Community

Linking a script object to the player in starter.fps

by Patrick Mcgeoghan · in Torque Game Engine · 03/18/2006 (12:37 am) · 1 replies

Hi all im a Noob :)

Had the engine for a week or so got to say it rocks anyways was wondering if you can link a script object to a shape ie the player in starter.fps

Ive got a custom Scriptobject

new ScriptObject(Player1) {
Spd = "15";
Lck = "15";
Eng = "15";
Int = "15";
Vit = "15";
Mnd = "15";
Str = "15";
Acc = "15";
Dex = "15";
Eva = "15";
};

and want to add this to the default player

also how would i get the stats info in the console ? player.stat.Spd ?

thanks for your time

#1
03/18/2006 (1:29 am)
You could do it this way:

// %player is created above


%statObject = new ScriptObject()
{
Spd = "15";
Lck = "15";
Eng = "15";
Int = "15";
Vit = "15";
Mnd = "15";
Str = "15";
Acc = "15";
Dex = "15";
Eva = "15";
};

%player.stats = %statObject;

Then any time you want to access the var from the player you do: %player.stats.int or %player.stats.acc

What might be the best solution is to use arrays. You will need to install this resource but they make working with data like that easy:

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4711

-Pete