didiusdeddysalam Posted January 30, 2016 Share Posted January 30, 2016 I try to make the NPCs teleport script but it seem not to work at all.... =============================scn aaaHQCMSelectionSpellScriptint Buttonint ButtonPressedref Meref Senecaref Arissaref Nashcaarref Lotteref Vrenneref WolfyBegin ScriptEffectStart set Me to Getself set Seneca to aaaSenecaRef set Arissa to aaaArissaRef set Nashcaar to aaaNashcaarRef set Lotte to aaaLotteRef set Vrenne to aaaVrenneRef set Wolfy to WolfyRef MessageBox "Teleport CMHQ","Seneca","Arissa","Nashcaar","Lotte","Vrenne","Wolfy" set buttonPressed to 1EndBegin ScriptEffectUpdate if ButtonPressed == 1 set Button to GetButtonPressed If Button == 0 Seneca.moveto Me 100, 0, 0 set ButtonPressed to 0 Elseif Button == 1 Arissa.moveto Me 100, 0, 0 set ButtonPressed to 0 Elseif Button == 2 Nashcaar.moveto Me 100, 0, 0 set ButtonPressed to 0 Elseif Button == 3 Lotte.moveto Me 100, 0, 0 set ButtonPressed to 0 Elseif Button == 4 Vrenne.moveto Me 100, 0, 0 set ButtonPressed to 0 Elseif Button == 5 Wolfy.moveto Me 100, 0, 0 set ButtonPressed to 0EndifEndifEndBegin ScriptEffectFinishend==================================can anybody help me to fix this broken script ? Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted January 30, 2016 Share Posted January 30, 2016 In my own observations I found ScriptEffectUpdate blocks to be rather unreliable. In some spells of mine they actually never ran even once, only ...Start and ...Finish did.So first off you might want to check if your ScriptEffectUpdate block that is analyzing your button press is even executed to begin with. Then I just read in the Wiki tutorials, as I already forgot most I ever knew about messageboxes by now and first went there to refresh it again, that you also have to make sure your spell will not "expire" before the ...Update block is run the first time "after" your button press was registered. They said something about it usually taking a couple frames for that to happen, and in the meantime the return value will always remain "-1". So even if your ...Update block does indeed run at least once, make sure the spell will last a long enough timespan to at least have a chance to catch your button press as well. Coming to think of it, you can also make the spell have an insanely long runtime, like so it almost never expires, or like not inside your lifetime at least, yet still, as soon as your button press evaluation was performed and the appropriate action executed, you can just "RemoveSpell" it from the caster again and it will immediately expire. edit: Argh, utter nonsense for real spells! Scratch that last line. It will not terminate a running spell, it will remove the spell from your book. My bad. Link to comment Share on other sites More sharing options...
didiusdeddysalam Posted January 30, 2016 Author Share Posted January 30, 2016 should we use the ref and the variables then ? I thought not using the ref and the var may work....like this : If Button == 0 SenecaRef.moveto Player 100, 0, 0 maybe.... Link to comment Share on other sites More sharing options...
lubronbrons Posted January 30, 2016 Share Posted January 30, 2016 scn FenrirSummonScript short bHasPorted float fAngle Begin ScriptEffectStart set bHasPorted to 0 End Begin ScriptEffectUpdate if (bHasPorted == 0) Set bHasPorted to 1 FenrirRef.SetIgnoreFriendlyHits 1 if WolfFollow && Player.GetLineOfSight FenrirRef set WolfFollow to 0 Message "'Fenrir, stay here.'" FenrirRef.RemoveScriptPackage FenrirRef.AddScriptPackage FenrirWander else set WolfFollow to 1 FenrirRef.MoveTo Player 60 20 30 Set fAngle to FenrirRef.GetAngle z + FenrirRef.GetHeadingAngle Player FenrirRef.SetAngle z fAngle Message "'Fenrir, come to me.'" FenrirRef.RemoveScriptPackage FenrirRef.AddScriptPackage FenrirFollow endif FenrirRef.PlayGroup Idle 1 endif End Begin ScriptEffectFinish FenrirRef.EvaluatePackage End Link to comment Share on other sites More sharing options...
didiusdeddysalam Posted February 9, 2016 Author Share Posted February 9, 2016 In my own observations I found ScriptEffectUpdate blocks to be rather unreliable. In some spells of mine they actually never ran even once, only ...Start and ...Finish did.So first off you might want to check if your ScriptEffectUpdate block that is analyzing your button press is even executed to begin with. Then I just read in the Wiki tutorials, as I already forgot most I ever knew about messageboxes by now and first went there to refresh it again, that you also have to make sure your spell will not "expire" before the ...Update block is run the first time "after" your button press was registered. They said something about it usually taking a couple frames for that to happen, and in the meantime the return value will always remain "-1". So even if your ...Update block does indeed run at least once, make sure the spell will last a long enough timespan to at least have a chance to catch your button press as well. Coming to think of it, you can also make the spell have an insanely long runtime, like so it almost never expires, or like not inside your lifetime at least, yet still, as soon as your button press evaluation was performed and the appropriate action executed, you can just "RemoveSpell" it from the caster again and it will immediately expire. edit: Argh, utter nonsense for real spells! Scratch that last line. It will not terminate a running spell, it will remove the spell from your book. My bad.thanks moderator dude :laugh: now it is working fine and smooth....you are the best moderator here...hehehe... Link to comment Share on other sites More sharing options...
didiusdeddysalam Posted February 9, 2016 Author Share Posted February 9, 2016 scn FenrirSummonScript short bHasPorted float fAngle Begin ScriptEffectStart set bHasPorted to 0 End Begin ScriptEffectUpdate if (bHasPorted == 0) Set bHasPorted to 1 FenrirRef.SetIgnoreFriendlyHits 1 if WolfFollow && Player.GetLineOfSight FenrirRef set WolfFollow to 0 Message "'Fenrir, stay here.'" FenrirRef.RemoveScriptPackage FenrirRef.AddScriptPackage FenrirWander else set WolfFollow to 1 FenrirRef.MoveTo Player 60 20 30 Set fAngle to FenrirRef.GetAngle z + FenrirRef.GetHeadingAngle Player FenrirRef.SetAngle z fAngle Message "'Fenrir, come to me.'" FenrirRef.RemoveScriptPackage FenrirRef.AddScriptPackage FenrirFollow endif FenrirRef.PlayGroup Idle 1 endif End Begin ScriptEffectFinish FenrirRef.EvaluatePackage End gee...thanks friend :laugh: Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted February 9, 2016 Share Posted February 9, 2016 -snip-thanks moderator dude :laugh: now it is working fine and smooth....you are the best moderator here...hehehe... Why, thank you, glad I was of help, but that wasn't moderator business. I was already sharing my modding knowledge whenever it was needed in the past, long before I became a moderator, and I'm still doing it now.When there's no orange in my postings, I'm just your everyday's mod author sharing with other authors, or helping out mod users instead, is all. And it's just "Drake" in these forums, we're among friends here. :sleep: Link to comment Share on other sites More sharing options...
Recommended Posts