PanzerOfGod Posted June 5, 2007 Share Posted June 5, 2007 Here are some scripts for a mod I'm making: scn TestHircUnderGroundHallTrigZone00Script Short Controlvar Begin OnTrigger PlayerIf Controlvar != 4MessageBox "This deer is wounded, human. What does your soul command you to do?"Player.MoveTo TestHircDeerTestCellXMarkerRefset controlvar to 4endifend scn TestHircTestDeerScript short controlvar Begin OnDeath PlayerIf controlvar != 3MessageBox "Perhaps your soul is not worthy? Fortunately for you, I am merciful, so I will give you another chance. Keep in mind, though, if you cannot help this creature, you will remain in this place forever."set controlvar to 3endifTestHircTestDeerRef.resurrectend Begin OnMagicEffectHit REHEPlayer.Moveto TestHircUnderGroundXMarkerRefMessageBox "Congratulations, you have passed the test, proving your soul to be worthy. Take your reward proudly."end I want to script it so that when the player walks through the TrigZone (TestHircUnderGroundHallTrigZone00) that the first script belongs to, he is moved to an X marker (TestHircDeerTestCellXMarkerRef) another cell and gets that message. Then, in this new cell, the player must hit a specific deer (TestHircTestDeer) that the second script belongs to with a healing spell (EffectID REHE), to get moved to an X marker (TestHircUnderGroundXMarkerRef) I put in the original cell that had the TrigZone. The problem is that when I try the mod ingame and get to the part where I cast the healing spell on the deer, the moment the spell hits, the screen flashes blue very rapidly and then the game crashes to the desktop. My question is: Is there a problem with my scripts that could cause this error? Better yet, is there a less glitchy way to get the player back to the original cell? Link to comment Share on other sites More sharing options...
Vagrant0 Posted June 5, 2007 Share Posted June 5, 2007 Begin OnMagicEffectHit REHEPlayer.Moveto TestHircUnderGroundXMarkerRefMessageBox "Congratulations, you have passed the test, proving your soul to be worthy. Take your reward proudly."endYou might want to do it instead like...Begin onload set self to getself set counter to 0 end Begin gamemode if self.hasmagiceffect REHE && counter == 0 && self.getdistance player <= 5000 MessageBox "Congratulations, you have passed the test, proving your soul to be worthy. Take your reward proudly." set counter to 5 endif end Begin gamemode if counter >= 2 set counter to counter -1 elseif counter == 1 set counter to 0 Player.MovetoMarker TestHircUnderGroundXMarkerRef endif endThis way it is doing the effects at a more gradual pace, and allows the script to run before moving the player. The crash may be caused since within the same frame it's detecting the effect, moving the player, then trying to show a message box. Since moving the player effectivly acts like a return, it causes problems. The additional conditions within the effect detection script are there to prevent the script from recycling endlessly if the player uses a duration based healing spell. You should also be using player.movetomarker rather than moveto. Link to comment Share on other sites More sharing options...
PanzerOfGod Posted June 5, 2007 Author Share Posted June 5, 2007 which of the items (deer or trigzone) is this code for? And thanks for your help with this script, now if only there were a way to give kudos twice... Edit:I suppose it's for the deer, caus that was the problem script. Thanks again, you've saved this mod twice :) . Link to comment Share on other sites More sharing options...
PanzerOfGod Posted June 5, 2007 Author Share Posted June 5, 2007 There was a couple problems with your script...1. It always takes two casts before the message appears.2. I don't get moved back to the XMarker, but rather I get moved into the cell with the deer again, but it's all black.3. When saving the script, I had to put "ref self" and "short counter" at the start for it to work. I suppose I'll have to come up with another way to get the player back... maybe put another triggerzone where the player is after he/she casts the spell on the deer... Link to comment Share on other sites More sharing options...
Vagrant0 Posted June 5, 2007 Share Posted June 5, 2007 I suppose I'll have to come up with another way to get the player back... maybe put another triggerzone where the player is after he/she casts the spell on the deer...What do you mean back? If you're talking about wherever the player was before entering the cell, you've got to use another marker. If the location of the player at that point is known and fixed, you can just position the new marker there. If the location of the player is unknown or can change, you'll need to move the new marker via scripting (marker.movetoplayer) before the player enters the new cell. Then have the player get moved to that marker, and the marker reset to a neutral location (anywhere that's already part of the mod, but is reachable). It should only take one cast to trigger, not sure why that isn't working. Link to comment Share on other sites More sharing options...
PanzerOfGod Posted June 6, 2007 Author Share Posted June 6, 2007 hmmm... that black room problem wasn't with your script. I tried to make it so that casting the spell on the deer gets you a key, and the key goes to a door that leads you out of the cell and back to the original, but when you enter the door, the same black thing happens. Do you suppose it's a problem with my trigzone script? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.