harark1 Posted May 2, 2011 Share Posted May 2, 2011 I think effects is the proper term. Ok in a mod I am working on I have a droid self destruct, I am assuming i need to creat a script for this but how do I have it spawn a explosion (specificlly the frag grenade explosion.)? As you can probally tell from my signature scripting really confuses me. Link to comment Share on other sites More sharing options...
JoFlashStudios Posted May 2, 2011 Share Posted May 2, 2011 Given that you have already created the variable "droid" containing the droid object that is being destroyed, it would be something like this: ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_GRENADE_FRAGMENTATION), GetLocation(droid)); This would be have to be called BEFORE: DestroyObject(droid, 0F, TRUE, 0F); Link to comment Share on other sites More sharing options...
harark1 Posted May 2, 2011 Author Share Posted May 2, 2011 Trying to compile and it finds a problem at the DestroyObject in script. Link to comment Share on other sites More sharing options...
JoFlashStudios Posted May 2, 2011 Share Posted May 2, 2011 Can you give me the error text? Link to comment Share on other sites More sharing options...
Qui-Gon Glenn Posted May 2, 2011 Share Posted May 2, 2011 // * qg_droidpercp.nss // * May 02 2011 void main() { int nEvent = GetUserDefinedEventNumber(); // OnPerception effect eFragger = EffectVisualEffect(VFX_FNF_GRENADE_FRAGMENTATION); object oDroid = OBJECT_SELF; if (nEvent == 1002) { ApplyEffectToObject(0, eFragger, oDroid); DelayCommand(0.5, DestroyObject(oDroid)); //this delay may not be necessary } //or an ActionWait may function better } Try this as a custom OnPerception script. The droid will explode when you are just about to enter melee range. You will need to also make a custom OnSpawn for your droid, which will involve simply removing two "//" that comment out the UserDefinedEvent for OnPerception. It looks like this (without the orange coloring on the //): [color=darkorange]//[/color]GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_PERCEPTION); //OPTIONAL BEHAVIOR - Fire User Defined Event 1002 In kotor1 the default OnSpawn script is called k_def_spawn01.nss. This is only a line from the big script of course You can extract an OnSpawn from any generic player, but really you should just get it from your Kotor 1 ---> BIFs --->scripts.bif. Extract that, delete the two "//" and save as some name you like, like droidspawn.nss. Compile, and place in override. Done Link to comment Share on other sites More sharing options...
harark1 Posted May 3, 2011 Author Share Posted May 3, 2011 On perception scripts will not work for this because it is from a dialouge option.( At least I think) Here is my script: void main ( DestroyObject(n_jimmy, 0F, TRUE, 0F); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_GRENADE_FRAGMENTATION), GetLocation(n_jimmy)); ) 3: Error syntax error at "DestroyObject". Link to comment Share on other sites More sharing options...
Dak Drexl Posted May 3, 2011 Share Posted May 3, 2011 On perception scripts will not work for this because it is from a dialouge option.( At least I think) Here is my script: void main ( DestroyObject(n_jimmy, 0F, TRUE, 0F); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_GRENADE_FRAGMENTATION), GetLocation(n_jimmy)); ) 3: Error syntax error at "DestroyObject". I know next to nothing about most of scripting, but I can tell you your script is structured all wrong. You need to have a "()" after void main. This is followed by the first curly bracket that signifies the start of your script. Finally you end the script with another curly bracket. Like this: void main[color="DarkRed"] () {[/color] DestroyObject(n_jimmy, 0F, TRUE, 0F); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_GRENADE_FRAGMENTATION), GetLocation(n_jimmy)); [color="DarkRed"]}[/color] Unfortunately I can't tell you if there's anything wrong with your actual script, but there's my beginner's level help Scripting is a pain for most people, you just have to keep at it and it will eventually click. That and try to stick to the source code and coding that people post here Edit: And listen to everything Qui-Gon tells you! Link to comment Share on other sites More sharing options...
Qui-Gon Glenn Posted May 3, 2011 Share Posted May 3, 2011 void main () { object oJimmy = GetObjectByTag(n_jimmy); effect eFragger = EffectVisualEffect(3003); [color=darkorange]// 3003 == VFX_FNF_GRENADE_FRAGMENTATION in nwscript.nss[/color] ApplyEffectToObject(0, eFragger, oJimmy); ActionWait(0.5); ApplyEffectToObject(0, eFragger, oJimmy); DestroyObject(oJimmy, 0.0f, TRUE, 0.0f); } Ok, thanks for the dialog tip... this ought to work ok though. The ApplyEffectAtLocation is unnecessary I think. I added a second VFX, easy to cut if you no likey. Also, pretty sure you can just destroy jimmy without all that other stuff.... "DestroyObject(oJimmy);" is probably sufficient, although I could be wrong on that. EDIT: Hahhah, Dak, I am no master! You took care of his first problem, the whole brackets n parens thing, just felt like working it out a little further for Harark1 Link to comment Share on other sites More sharing options...
harark1 Posted May 3, 2011 Author Share Posted May 3, 2011 Uh thanks( Really yelling "D*** it why did I forget the paratheses!?") Edit: You guys are probally thinking "Why is that droid named Jimmy?!" Well it was xxrevanxx's idea. (He is very strange and insane.) We are kinda co-creating a mod.(If you are thinking Return of the Exile that is not right.) Link to comment Share on other sites More sharing options...
JoFlashStudios Posted May 3, 2011 Share Posted May 3, 2011 Those extra parameters on DestroyObject() will ensure that the droid disappears immediately. Otherwise, you can get an annoying situation where there is an explosion, and then the driod stands there for half a moment after the explosion fades before it randomly vanishes. I'm assuming that there won't be more than one droid object with Jimmy's tag? If there is, you will have to loop and check for GetIsInConversation() on each object with that tag. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.