Alasyre Posted May 10, 2010 Share Posted May 10, 2010 I've got a simple script that uses "placeatme" to drop a bomb on an enemy upon successfully striking them, like with the various artillery mods. I'd like to add a10 second delay between the actual attack and the script effect. What would I need to add to the script to make this happen? The script is as follows: scn SCRIPTNAME begin gamemode if isininterior == 0 placeatme SCRIPTEFFECT, 1 showmessage SCRIPTMESSAGE endif end Thanks! Link to comment Share on other sites More sharing options...
BadPenney Posted May 10, 2010 Share Posted May 10, 2010 You would need a timer to add a delay. Cipscis has a tutorial on timers. Link to comment Share on other sites More sharing options...
Alasyre Posted May 10, 2010 Author Share Posted May 10, 2010 I must not be understanding something. Using the information in the stage delay tutorial, I came up with this: scn SCRIPTNAME float fTimerint iStage begin gamemode if isininterior == 0 elseif fTimer > 0 set fTimer to fTimer - GetSecondsPassed elseif iStage == 0 set iStage to 1 set fTimer to 10 showmessage SCRIPTMESSAGE elseif iStage == 1 placeatme SCRIPTEFFECT, 1 endif end However, this does nothing at all. What am I missing? Link to comment Share on other sites More sharing options...
BadPenney Posted May 11, 2010 Share Posted May 11, 2010 Actually I had no idea how you expected the first script to accomplish your stated goals, but you didn't ask about that before. So first of all, what sort of script are you writing, effect, object or quest? (Writing your script in a codebox that preserves indents would be helpful.) What will this script be applied to? At first glance, if you were to see any action from this script at all as written, I would guess that it would hit the player with the script effect and messagebox as soon as he enters an exterior cell and then they would both be continually applied endlessly, since there is nothing in the script to tell them to stop. I see nothing that would apply this effect to an enemy when struck. I do not understand why you write "int iStage" rather than "short iStage" if that is your DoOnce condition for the timer. In short, it makes no sense to me. More detail might help, but I can't tell if you are so much better at scripting than me that I cannot suss what you are doing, or if instead you are a novice and do not know what you are doing either. Rather than this script, it might be simpler to create a weapon enchantment that would strike the enemy with a script effect. Then create a script effect that includes a delay, an explosion, a command to show a messagebox, a command to make the messagebox go away, and a markfordelete on the placeatme explosion so that you don't bloat your savegames with their remnants. Cipscis always comes to mind when I think of FO3 uberscripters, but there are plenty of folks around here more skilled at it than me. Maybe someone will chime in. Link to comment Share on other sites More sharing options...
Alasyre Posted May 11, 2010 Author Share Posted May 11, 2010 The script works, it only affects the target once and stops after. It's actually already linked to the weapon by a weapon enchantment. I'm not good at scripting, to be honest. This script is "borrowed" and modified for my purposes. Anyway, what it does is this. If in an exterior cell, hitting a target with the weapon triggers the original script, launching the bomb at the target. What I want is to delay the bomb for a few seconds. It works like this: Target is hit, object effect (linked to the weapon) engages, which engages the base effect, which uses the script I posted. The bomb then drops onto the target. Oh, and I used the intStage because that is what was posted on the site you mentioned. I'm really out of my league here. Actually, I barely understood the tutorial. Like I said, I'm no scripter. Link to comment Share on other sites More sharing options...
BadPenney Posted May 11, 2010 Share Posted May 11, 2010 Not sure if this will do the trick, but you can try it if you like: scn SCRIPTNAME float fTimer int iStage short doOnce begin gamemode if isininterior == 0 if iStage == 0 && doOnce == 0 set fTimer to 10 set doOnce to 1 showmessage SCRIPTMESSAGE if fTimer > 0 set fTimer to fTimer - GetSecondsPassed elseif fTimer <= 0 set iStage to 1 placeatme SCRIPTEFFECT, 1 set doOnce to 0 endif endif endif end Link to comment Share on other sites More sharing options...
Dyadya_Fedor Posted May 11, 2010 Share Posted May 11, 2010 I suggest, what that script will not work (bacause of DoOnce condition) Since we use weapon effect:scn SCRIPTNAME float fTimer short iStage Begin ScriptEffectStart if IsInInterior == 0 set iStage to 1 set fTimer to 10 showmessage SCRIPTMESSAGE endif end Begin ScriptEffectUpdate if iStage == 1 if fTimer > 0 set fTimer to (fTimer - GetSecondsPassed) else placeatme SCRIPTEFFECT, 1 set iStage to 0 endif endif end Note, what if you hit target again until timer expires, effect will be replaced (with new 10 sec delay). To avoid this, you can store timer elsewere (in quest script, for example) Weapon effect scriptscn SCRIPTNAME short iStage Begin ScriptEffectStart if IsInInterior == 0 set iStage to 1 if MuQuest.fTimer <= 0 ;if timer expired, set again set MuQuest.fTimer to 10 endif showmessage SCRIPTMESSAGE endif end Begin ScriptEffectUpdate if iStage == 1 if MuQuest.fTimer > 0 set MuQuest.fTimer to (MuQuest.fTimer - GetSecondsPassed) else placeatme SCRIPTEFFECT, 1 set iStage to 0 endif endif end Quest Scriptscn MyQuestScript float fTimer And dont forget about effect duration (15 sec is ok) Link to comment Share on other sites More sharing options...
Alasyre Posted May 11, 2010 Author Share Posted May 11, 2010 BadPenny, that script displays the message properly, but doesn't do anything after that. Dyadya_Fedor, the first script you posted had the same problem as BadPenny's, the message displayed, but nothing else happened. I didn't try the second one yet. It seems like I shouldn't need a quest to make it work. Any other ideas? I really appreciate the help, guys. Edit: Cipcis' validate program says that both of the scripts have an "Invalid blocktype for Begin statement on line 14" and line 15 for the second script, which is the Begin ScriptEffectUpdate. Link to comment Share on other sites More sharing options...
Dyadya_Fedor Posted May 12, 2010 Share Posted May 12, 2010 This blocktype is valid http://geck.bethsoft.com/index.php/Category_3ablocktypesPossible sources of problem:1) duration of effect (Game Effects->Object Effects->MyEffect->(Weapon)->Effects->New) is not enought (make it bigger than 10 sec). And you can replace GetSecondsPassed with ScriptEffectElapsedSeconds for better timing.2) your placeatme.whatever command do nothing. To make shure, what this command executed, temporarily replace it with some debug command (like Player.additem caps001 1 or PlaySound UILevelUpText) Link to comment Share on other sites More sharing options...
Recommended Posts