sgf1974 Posted June 11, 2013 Share Posted June 11, 2013 (edited) I've searched and searched and I've yet to find a way to spawn a dragon by reading a journal. Below, you'll find what is supposed to happen and then the script I'm using. Hopefully, someone can point me in the right direction so I can get this to work. Here is the goal- Read a journal left by a previous traveler- Upon reading it, a dragon is spawned which has a specific key needed to open a specific door - I created a new dragon by copying an existing one and giving it a new ID (RazortoothHallRazortoothDragon) - I simply added the necessary key to this dragon's inventory Here is what I have verified to work- I placed the new dragon at a certain location (it shows up just fine)- I fought and killed the dragon and obtained the key- The key allows me to open the door Further stepsAt this point, I removed the dragon and added the script below to the journal. I also added an Xmarker intended as the spawn point for the dragon (RazortoothHallRazortoothSpawn). Script usedScriptname RazortoothHallSpawnRazortooth extends Book {Reading Katt's Journal will spawn Razortooth} ActorBase property RazortoothHallRazortoothDragon autoObjectReference property RazortoothHallRazortoothSpawn autoint doOnce Event OnRead() if doOnce == 0 RazortoothHallRazortoothSpawn.PlaceActorAtMe(RazortoothHallRazortoothDragon).StartCombat(Game.GetPlayer()) doOnce = 1 endifendEvent What I gotThe script compiles just fine but when playing the game, I can read the book but the dragon does not spawn. Edited June 11, 2013 by sgf1974 Link to comment Share on other sites More sharing options...
Maverick827 Posted June 11, 2013 Share Posted June 11, 2013 Try removing the if statement and see what happens. Add something like Debug.MessageBox("Test") inside the event to see if it's firing. Link to comment Share on other sites More sharing options...
sgf1974 Posted June 11, 2013 Author Share Posted June 11, 2013 (edited) I can try that but I included the "if" statement to prevent the dragon from spawning every time the player reads the book. It should only happen once. EDIT: I removed the "if" statement and added the Debug.MessageBox("Test") but it looks like it didn't fire. Back to the drawing board, I guess. Thanks for the suggestion though. Edited June 11, 2013 by sgf1974 Link to comment Share on other sites More sharing options...
sgf1974 Posted June 11, 2013 Author Share Posted June 11, 2013 (edited) This is by far the best part about learning to script in Papyrus (or learning any scripting/coding language for that matter): learning a whole lot more than I would have otherwise, just by trying to fix one small problem. I'm loving it!!! From what I just read, I think I need to try the following (when I get home from work tonight). Scriptname RazortoothHallSpawnRazortooth extends Book {Reading Katt's Journal will spawn Razortooth} Actor property RazortoothHallRazortoothDragon autoActorBase RazortoothHallRazortoothDragonBaseObjectReference property RazortoothHallRazortoothSpawn autoint doOnce Event OnInit() RazortoothHallRasortoothDragonBase = RazortoothHallRazortoothDragon.GetBaseObject() as ActorBaseEndEvent Event OnRead() if doOnce == 0 RazortoothHallRazortoothSpawn.PlaceActorAtMe(RazortoothHallRazortoothDragonBase).StartCombat(Game.GetPlayer()) doOnce = 1 endifendEvent Edited June 11, 2013 by sgf1974 Link to comment Share on other sites More sharing options...
sgf1974 Posted June 12, 2013 Author Share Posted June 12, 2013 None of the above has worked. I'm trying a different angle now... Link to comment Share on other sites More sharing options...
Kraeten Posted June 12, 2013 Share Posted June 12, 2013 (edited) I can help! Watch this tutorial by the very respectable darkfox127. What you'll do is use his script which will enable an x-marker. You'll create your dragon, then make the x-marker the dragon's enable parent. So when you read the journal, the x-marker is enabled and thus so too the dragon. The tutorial goes over furtinture, but it could be used on anything really including actors as my own Grayhill Keep mod demonstrates. https://www.youtube.com/watch?v=JWvPaUt8f8s&list=FLykrxnY2sp6lsbZxdxQaKpA&index=5 Feel free to PM me if you need any more help! Edited June 12, 2013 by Kraeten Link to comment Share on other sites More sharing options...
GrimyBunyip Posted June 12, 2013 Share Posted June 12, 2013 (edited) None of the above has worked. I'm trying a different angle now...Anyways I can think of 2 possible reasons why your code isn't working.First of all, when you didn't initialize doOnce, when you don't doOnce = None, not doOnce = 0int doOnce = 0 The other is that you try to spawn the dragon and start combat with it in the same line of code.You need to do one then the other.Actually you probably don't even need the start combat code, if the dragon's faction is supposed to be aggressive with the player, it will start combat with the player automatically. Also, don't use the doOnce thing at all.doOnce variable is instanced for each book. So if you spawn 2 books, you read one, it spawns a dragon, then it won't spawn anymore dragons.but if you read the other, it will spawn another dragon. Instead use the "IsRead" function, that way if you spawn 2 books, you will only spawn 1 dragon ever. Scriptname RazortoothHallSpawnRazortooth extends Book Actor property RazortoothHallRazortoothDragon auto ObjectReference property RazortoothHallRazortoothSpawn auto Event OnRead() if !Self.IsRead() RazortoothHallRazortoothSpawn.PlaceActorAtMe(RazortoothHallRazortoothDragon) endif endEvent Edited June 12, 2013 by GrimyBunyip Link to comment Share on other sites More sharing options...
sgf1974 Posted June 13, 2013 Author Share Posted June 13, 2013 (edited) Kraeten - That was the "new angle" I was trying although I hadn't read anything about it and was trying it on my own. It's good to know I was on the right track. Thank you for your suggestion! Also, watching that tutorial video made me a new fan of darkfox127. Ultimately, this is the method I used and it works perfectly... so well that I used it to create the next step for obtaining access to Razortooth Hall. GrimyBunyip - Thank you for your suggestion. Even though I ended up using Kraeten's suggestion (just ended up more suitable for the situation), yours will come in very handy when I get further along in my mod. I really appreciate the help you guys have provided. Thanks again! Edited June 13, 2013 by sgf1974 Link to comment Share on other sites More sharing options...
Recommended Posts