Jump to content

Home

Random Explosions Tutorial


BountyHUNTER12

Recommended Posts

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!

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),lRand,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! ;)

Link to comment
Share on other sites

  • 2 years later...
I tip my lightsaber off to you. Thanks for a great script!

 

You do realise that this is a more than 2 years old thread, which no one has posted in since 2004, and where the thread starter has not visited this forum for over a year? Please refrain from thread necromancy unless you have something pertinent to add to the topic. :)

 

I was just wandering could this script be used so if you are lightside and save bastila from the darkside that there random explosion on the next floor. where she is helping the republic.

 

Depends on what you want to happen. In general it should work, but if you want to make an explosion to happen within a specific area it's likely much quicker and easier to just create your explosions there, either at specified coordinates or randomly generated coordinates within a specific radius. The script posted by the thread starter generates the explosion at the nearest object.

Link to comment
Share on other sites

  • 7 months later...
Sorry for bringing this old thread up, but is the script for K1?

 

I think the reference to the Endar Spire answers your question. But may not apply for it working in K1, but yes the script does work for K1 as all those script functions are in the K1 NwScript.

 

Have you ever wanted to make a module look like it's under attack like the Endar Spire?
Link to comment
Share on other sites

Strange.. when I compile, I get this message:

 

Error: Syntax error at "Rand"

 

Leacked PStackEntry (h:\programmieren\vc7\gametools\kotor\nwntools-1.2\nsclib\ns[cannot read further]

ccontext.cpp.230)

(h:\programmieren\vc7\gametools\kotor\nwntools-1.2\nsclib\ns[cannot read further]

cparserroutines.cpp,4272)

(h:\programmieren\vc7\gametools\kotor\nwntools-1.2\nsclib\ns[cannot read further]

ccontext.cpp.230)

(h:\programmieren\vc7\gametools\kotor\nwntools-1.2\nsclib\ns[cannot read further]

ccontext.cpp,340)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...