Difference between revisions of "Creating an Effectscript model"

From Valve Developer Community
Jump to: navigation, search
(stub with .qc and script sample)
 
(About teleporttrail.mdl and teleporttrail_Alyx.mdl.)
Line 1: Line 1:
 
{{stub}}
 
{{stub}}
  
 +
=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 <code>models\effects\teleporttrail.mdl</code> and <code>models\effects\teleporttrail_Alyx.mdl</code>, as the name suggests, you can see them in the alyx teleport scene in chapter 2.
 +
 +
 +
See [[Env effectscript|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.
 
*Make an animating model.
*In .qc, make attachments, and add a sequence with AE_START_SCRIPTED_EFFECT and AE_STOP_SCRIPTED_EFFECT events.
+
**Put nulls. Name one null "root", make this one parent of other nulls.
*Write an effect script file.
+
**Name other nulls like "test1", "test2", etc. You'll make attachments to these bones in .qc file.  
*In Hammer, place [[Env effectscript|env_effectscript]]. Specify your model and scriptfile there.
+
**Make keyframe animations with child nulls.(Use translate tool)
*Effect starts when the [[Env effectscript|env_effectscript]] receives SetSequence input.
+
**Put a small cube, with 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 'un'check "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.
  
sample .qc:
+
:Here is a sample .qc:
 
<pre>
 
<pre>
 
$modelname "effects/testtrail.mdl"
 
$modelname "effects/testtrail.mdl"
Line 21: Line 36:
 
$sequence spiral "test_anim" 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_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 end frame.
+
   { event AE_STOP_SCRIPTED_EFFECT 99 "mytest_sprite" } //specify the effect name and its end frame.
 
}
 
}
 
</pre>
 
</pre>
  
sample effect script:
+
==effect script file==
 +
*Write an effect script file. Valve puts their effect script file in <code>hl2\scripts\effects\testeffect.txt</code>, but you can put your file anywhere under the game directory. You can specify the script file location in [[Env effectscript|env_effectscript]] entity.
 +
 
 +
sample "mytesteffect.txt":
 
<pre>
 
<pre>
 
effect "mytest_sprite" //effect name
 
effect "mytest_sprite" //effect name
Line 38: Line 56:
 
}
 
}
 
</pre>
 
</pre>
 +
 +
 +
==Hammer==
 +
*In Hammer, place [[Env effectscript|env_effectscript]]. Specify your model and scriptfile there.
 +
*Effect starts when the [[Env effectscript|env_effectscript]] receives SetSequence input.
 +
 +
[[Category:Modeling]]

Revision as of 05:03, 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.
    • Put nulls. Name one null "root", make this one parent of other nulls.
    • Name 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)
    • Put a small cube, with 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 'un'check "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