Jump to content

Can you find whats wrong?


Oblis

Recommended Posts

Yes, that is what Lanceor said: SetPos just sets the new XYZ values within the same worldspace (interior cells are a worldspace of their own).

 

PositionCell, PositionWorld and MoveTo are the ones to use to change cells, if necessary, and position at a given XYZ.

 

The three do exactly the same thing. The only difference is that MoveTo retrieves the Worldspace/Cell and XYZ values from the referred object while PositionCell and PositionWorld get them from the parameters you provide.

 

I still don't see why your first script does not work. It seems OK to me. I must be overlooking something.

Link to comment
Share on other sites

I have a better idea of what's happening now. :)

 


  •  
  • Moving NPCs to an XMarker often doesn't work for some reason. Try using an XMarkerHeading instead. (And if that still doesn't work, try a marker rat.)
  • There has to be a pathgrid node at the point where the NPC is MoveTo'd otherwise they'll end up at the nearest node instead. If there's no pathgrids at all (as evidenced by the NPC walking into walls) then there's no telling where the NPC will end up.

Link to comment
Share on other sites

Ok this worked for spell.

I first deleted the Quest script that spawned those npcs with PlaceAtMe. I drag the npcs into the world as persistert. Then I put in the Quest script for each random number rolled, to disable the other two. So only 1 of the 3 stayed in game.

Their refID is NPC01ARef, NPC01BRef, NPC01CRef,

 

Then I created a spell (self) with the followng script:

 

ScriptName NPC01SummonSpellScript

string_var NPC01ARefName 
string_var NPC01BRefName 
string_var NPC01CRefName 

Begin ScriptEffectStart

Set NPC01ARefName to NPC01ARef.GetName
Set NPC01BRefName to NPC01BRef.GetName
Set NPC01CRefName to NPC01CRef.GetName

End

Begin ScriptEffectFinish

NPC01ARef.MoveTo Player
NPC01BRef.MoveTo Player
NPC01CRef.MoveTo Player

if Getdistance NPC01ARef < 70
MessageBoxEX "%z will concider this place as home.", NPC01ARefName
elseif Getdistance NPC01BRef < 70
MessageBoxEX "%z will concider this place as home.", NPC01BRefName
elseif Getdistance NPC01CRef < 70
MessageBoxEX "%z will concider this place as home.", NPC01CRefName
endif

End

 

which worked fine and appeared the message box as well.

 

and then I put the same line into the scull:

 

scriptname NPCScullScript

string_var NPC01ARefName 
string_var NPC01BRefName 
string_var NPC01CRefName 

Begin OnDrop Player

Set NPC01ARefName to NPC01ARef.GetName
Set NPC01BRefName to NPC01BRef.GetName
Set NPC01CRefName to NPC01CRef.GetName

NPC01ARef.MoveTo Player
NPC01BRef.MoveTo Player
NPC01CRef.MoveTo Player

if Getdistance NPC01ARef < 70
MessageBoxEX "%z will concider this place as home.", NPC01ARefName
elseif Getdistance NPC01BRef < 70
MessageBoxEX "%z will concider this place as home.", NPC01BRefName
elseif Getdistance NPC01CRef < 70
MessageBoxEX "%z will concider this place as home.", NPC01CRefName
endif

End

 

If i am in exterior and the npcs is in the same cell, it will be spawned to me without the messagebox (dunno why this is not working)

If I am in different cell (in a house for example) while he is outside, the script is not working. Neither spawn nor messagebox.

 

Of course I could use the spell, but who really wants 20 spells for 20 sets of npcs in his spellbook right?

At least with scull, each npc shall carry it in his inventory at start, or let it placed in his home.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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