Game Development Community

Scripting probs

by arteria3d · in · 01/31/2005 (3:20 pm) · 5 replies

How come when i define an object via script to load in as part of game.cs does it make the object via the editor have no light properties???

Is it because i am making new rules for the object, because i am making a script load the object?

About the author

Owner of uk based Ltd company ArteriaMediaLtd. with a trading name of Arteria3d Website;arteria3d.com


#1
01/31/2005 (4:59 pm)
How are you defining the object (what does the script look like)?
#2
02/01/2005 (3:08 am)
Hi John,

I am defining at as follows:

// Cave Rock


datablock StaticShapeData(cave_rock)
{
category = "cave_detail";
shapeFile = "~/data/shapes/cave_detail/caverock.dts";
preload = true;
};
#3
02/01/2005 (2:58 pm)
TGE has two types of static shapes; StaticShape and TSStatic objects. It looks like you're using StaticShape objects and adding them through the 'Shapes' list in the mission editor. Only TSStatic objects have the advanced lighting options, these are added through the 'Static Shapes' list, which is automatically populated with all dts objects in you project tree (the default project tree is 'starter.fps'), so even if you don't define the object in script it will appear in the 'Static Shapes' list.
#4
02/01/2005 (3:40 pm)
Hi John,

I have done it this way so i can use the on:collision command in the script to determine collision so i can play a particular sound when the player is on the item , or walking through foilage etc. Is there a way i can do this without scripting the object?
#5
02/02/2005 (9:08 am)
There are a couple of problems with this, TSStatic doesn't support the onCollision calls, and StaticShape is very heavyweight and uses scoping, which means that using a lot of StaticShape objects could cause a performance hit and they won't cast shadows (not scoped until you see them, which is after the scene is lit).

I assume you're using this to change the player's foot fall sound, right? I would create a new script callback after the player has moved that provides as an argument the object the player is currently on. You could then update the sounds in the script.

I do see another problem; onCollision is called on the server side, but the client is playing the sound and I don't think datablocks automatically stream updates to clients, so changing the sound on the player's datablock won't update the client(s) with the new sound. Also if it did work the sound would change for all players using the datablock.