LucasForums

LucasForums (http://www.lucasforums.com/index.php)
-   Tutorials: Scripting (http://www.lucasforums.com/forumdisplay.php?f=597)
-   -   Random Explosions Tutorial (http://www.lucasforums.com/showthread.php?t=135584)

StormTrooper789 09-12-2004 05:52 PM

Random Explosions Tutorial
 
Have you ever wanted to make a module look like it's under attack like the Endar Spire? WELL NOW YOU CAN, with this script created by StormTrooper789!
Code:

void main()
{
object oPc=GetFirstPC();
object oRand=GetNearestObject(OBJECT_TYPE_ALL,oPc,1);
location lRand=GetLocation(oRand);
ApplyEffectAtLocation(0,EffectVisualEffect(3003),lRand,0.0f);
PlayRumblePattern(1);
}

Now let's explain this junk :) :
object oPc=GetFirstPC() means to find your character in the module.
object oRand=GetNearestObject(OBJECT_TYPE_ALL,oPc,1) means to see what objects are near your character that are of any type(sound,placeable,character,door,waypoint, and trigger)
location lRand=GetLocation(oRand) This will generate a location for oRand so the explosions can be made.
ApplyEffectAtLocation(0,EffectVisualEffect(3003),l
Rand,0.0f)
This will create an explosion at the randoms objects. 3003 means fragmentation grenade effect.
PlayRumblePattern(1) This will create a rumble effect around the explosion.

Compile the script and your not finished quite yet. We need the script to loop so it wont work only once. Open the *.are file of your module and add the script name without extension to the OnHeartBeat entry. CONGRATULATIONS! ;)

tk102 recommends Injecting this script into the heartbeat

Original thread


All times are GMT -4. The time now is 07:29 AM.

Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.