Jump to content

Messagebox NPC Teleport Script


didiusdeddysalam

Recommended Posts

I try to make the NPCs teleport script but it seem not to work at all....

 

=============================

scn aaaHQCMSelectionSpellScript

int Button
int ButtonPressed

ref Me
ref Seneca
ref Arissa
ref Nashcaar
ref Lotte
ref Vrenne
ref Wolfy

Begin 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 1
End

Begin 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 0
Endif
Endif
End

Begin ScriptEffectFinish
end

==================================

can anybody help me to fix this broken script ?

Link to comment
Share on other sites

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


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

  • 2 weeks later...

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

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

 

-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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...