EDGE Demo Tutorials

By Lobo

Contents:

breakableglass.wad  Download example wad  Download

Effect demonstrated: - Breaking Glass/ Transparent lines

This looks quite complicated but it's really not that bad ;)
We need do do the following:
  1. Make a creature/thing which shoots shards of glass as it's attack and make the flying shards of glass attack
  2. A line which will trigger an RTS script when it get's shot
  3. The RTS script which will spawn the creature defined in 1.




(1) Here's the code for this thing and its attack
<THINGS>
#VERSION 1.28

[DEBRIS_GENERATOR]
REACTION_TIME=8T;
RADIUS=8;
HEIGHT=32;
FLOAT_SPEED=1;
TRANSLUCENCY=0%;
SPECIAL=NOBLOCKMAP,NOGRAVITY,FLOATER;

STATES(SPAWN)=NULL:A:0:NORMAL:PLAYSOUND(BAREXP),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
NULL:A:0:NORMAL:SPARE_ATTACK(SHARD_SHOOTER),
#REMOVE;


And here's the Attack:
<ATTACKS>
#VERSION 1.28

[SHARD_SHOOTER]
ATTACKTYPE=PROJECTILE;
HEIGHT=8;
RADIUS=6;
PROJECTILE_SPECIAL=NOBLOCKMAP,SLIDER,CROSSLINES,DROPOFF,BARE_MISSILE,CORPSE;
ACCURACY_ANGLE=359; //makes the shots go all around
ACCURACY_SLOPE=65;
ATTACK_HEIGHT=32;
SPEED=10;
BOUNCE_SPEED=0.6;
SLOPE_OFFSET=22;
ANGLE_OFFSET=45;
Y_OFFSET=4;

STATES(SPAWN)=GLS1:A:3:NORMAL:NOTHING,
GLS2:A:3:NORMAL:NOTHING,
GLS3:A:3:NORMAL:NOTHING,
GLS4:A:3:NORMAL:NOTHING,
GLS5:A:3:NORMAL:NOTHING,
GLS6:A:3:NORMAL:NOTHING,
GLS7:A:3:NORMAL:NOTHING,
GLS8:A:3:NORMAL:NOTHING,
GLS9:A:3:NORMAL:NOTHING;

STATES(DEATH)=GLS1:A:3:NORMAL:NOTHING,
GLS2:A:3:NORMAL:NOTHING,
GLS3:A:3:NORMAL:NOTHING,
GLS4:A:3:NORMAL:NOTHING,
GLS5:A:3:NORMAL:NOTHING,
GLS6:A:6:NORMAL:NOTHING,
GLS7:A:6:NORMAL:NOTHING,
GLS8:A:6:NORMAL:NOTHING,
GLS9:A:35:NORMAL:TRANSFADE(0%),
#REMOVE;


NOTE: the sprites GLS1 to GLS9 are "borrowed" from Duke Nukem.



(2) Place a line in the map and give this line a type of 500, which corresponds to a custom DDF line which will trigger an RTS script when it gets shot. Also give the line a tag number(for example 105)
This is the code for the custom line (it's just a tiny tweak of one of Edges prefabs):
[500] // EDGE Enable Tagged RTS SHOOT1
TRANSLUCENCY=50%;
TYPE=SHOOT;
ACTIVATORS=PLAYER;
COUNT=1;
RADIUS_TRIGGER=ENABLE_TAGGED;


Now when we shoot this line the RTS script which is TAGged 105 will be triggered.



(3) Here's the code for the RTS script which will be triggered by our line:
//***********
//Glass pane
//***********
radiustrigger 0 0 -1
   SLEEP
   TAG 105 //corresponds to a line in the map
   unblock_lines 105 //allow things to cross the line
   spawnthing DEBRIS_GENERATOR 284 33 0 //Spawn our broken glass shards
   change_tex left_middle GLASSP1 105 //Front of line
   change_tex right_middle GLASSP1 105 //Back of line
   wait 2T
   change_tex left_middle GLASSP2 105
   change_tex right_middle GLASSP2 105
   wait 2T
   change_tex left_middle GLASSP3 105
   change_tex right_middle GLASSP3 105
   wait 2T
   change_tex left_middle GLASSP4 105
   change_tex right_middle GLASSP4 105
   wait 2T
   change_tex left_middle GLASSP5 105
   change_tex right_middle GLASSP5 105
   TAGGED_REPEATABLE 0
end_radiustrigger


NOTE: the textures GLASSP2 to GLASSP5 are "borrowed" from Blood.






Free Web Hosting