Difference between revisions of "Creating an Effectscript model"

From Valve Developer Community
Jump to: navigation, search
(About teleporttrail.mdl and teleporttrail_Alyx.mdl.)
m
Line 14: Line 14:
 
==3D Package==
 
==3D Package==
 
*Make an animating model.
 
*Make an animating model.
**Put nulls. Name one null "root", make this one parent of other nulls.
+
**Place some nulls. Name one null "root", and make this one the parent of the other nulls.
**Name other nulls like "test1", "test2", etc. You'll make attachments to these bones in .qc file.  
+
**Name the other nulls like "test1", "test2", etc. You'll make attachments to these bones in .qc file.  
**Make keyframe animations with child nulls.(Use translate tool)
+
**Make keyframe animations with the child nulls. (Use the translate tool)
**Put a small cube, with base.tga texture.(only the name matters, you don't have to extract the original one)
+
**Add a small cube, with the <code>base.tga</code> texture (only the name matters; you don't have to extract the original one).
*Export it as reference and animation .smd files. Make sure to 'un'check "Remove all unused bones" when you are using XSI's SMD exporter.
+
*Export it as reference and animation .smd files. Make sure to ''un''check "Remove all unused bones" when you are using XSI's SMD exporter.
  
 
==.qc setting==
 
==.qc setting==

Revision as of 12:40, 29 September 2005

What is an Effectscript model?

It's a model with attachment animation sequence events. With an effect script file, it'll create sprite animation effects in game. Examples are models\effects\teleporttrail.mdl and models\effects\teleporttrail_Alyx.mdl, as the name suggests, you can see them in the alyx teleport scene in chapter 2.


See env_effectscript for how to place one in your map.


The default Effectscript model consists of a single cube textured with materials/models/effects/base.vmt (this is maybe because if there is no mesh, .SMD wont't be exported), several bones(one root parent, others are child bones of the root), and attachments corresponding to child bones. It also has a sequence that animates bones and attachments. Check Attachments and Bones in HLMV.exe render tab to preview it.

How to make your own effectscript model

3D Package

  • Make an animating model.
    • Place some nulls. Name one null "root", and make this one the parent of the other nulls.
    • Name the other nulls like "test1", "test2", etc. You'll make attachments to these bones in .qc file.
    • Make keyframe animations with the child nulls. (Use the translate tool)
    • Add a small cube, with the base.tga texture (only the name matters; you don't have to extract the original one).
  • Export it as reference and animation .smd files. Make sure to uncheck "Remove all unused bones" when you are using XSI's SMD exporter.

.qc setting

  • In .qc, make attachments to child bones, and add a sequence with AE_START_SCRIPTED_EFFECT and AE_STOP_SCRIPTED_EFFECT events.
Here is a sample .qc:
$modelname "effects/testtrail.mdl"
$model "Body" "test_ref.smd"
$cdmaterials "models/effects/"
$hboxset "default"
$hbox 0 "root" -1.000  -1.000  -1.000  1.000  1.000  1.000
// Model uses material "base.vmt"
$attachment "MyParticle1" "test1" 0.00 0.00 0.00 rotate 0.00 0.00 0.00
$surfaceprop "metalpanel"
$sequence idle "test_ref" fps 30.00
$sequence spiral "test_anim" fps 30.00 {
  { event AE_START_SCRIPTED_EFFECT 1 "mytest_sprite" } //specify the effect name and its start frame 
  { event AE_STOP_SCRIPTED_EFFECT 99 "mytest_sprite" } //specify the effect name and its end frame.
}

effect script file

  • Write an effect script file. Valve puts their effect script file in hl2\scripts\effects\testeffect.txt, but you can put your file anywhere under the game directory. You can specify the script file location in env_effectscript entity.

sample "mytesteffect.txt":

effect "mytest_sprite" //effect name
{
	type "sprite" //the other option is "trail" 
	material "sprites/glow01.vmt"
	attachment "MyParticle1" //point to the attachment in your effectscript model
	color "255 50 240 128"
	scale 1
	fadetime 3
	stopfollowonkill 1
}


Hammer