Jump to content

Npc Cannot Path. Keeps Getting Stuck on the Ground


Recommended Posts

Edited from original posting for clarification:

 

 

I tried to fix that section of the script but it still works improperly.

If (GetItemCount ALArmorAmicus == 1)
		If (KillProfligates == 0)
			ALAmicusREF.additem ALArmorLeatherReinforcedAmicus 1
			ALAmicusREF.removeitem ALArmorAmicus 1
			ALAmicusREF.removefromfaction VCaesarsLegionFaction
			ALAmicusREF.equipitem ALArmorLeatherReinforcedAmicus
		Endif
	Endif
	If (GetItemCount ALArmorLeatherReinforcedAmicus == 1)
		If (KillProfligates == 1)
			ALAmicusREF.addtofaction VCaesarsLegionFaction 0
			ALAmicusREF.additem ALArmorAmicus 1
			ALAmicusREF.equipitem ALArmorAmicus
		Endif
	Endif
 If (DoOnce2 != 1)
   set KillProfligates to 1
   set DoOnce2 to 1
 Endif

You do realize you changed the logic of the script from the first one? You no longer have the equivalent of the "logical AND" in the original first line

 

You need to put in some "debug messages" so you can see the values you are testing in order to determine how the logic is flowing. IF the logic flow is correct (the values you expect are present), then the problem is your logic isn't doing what you want.

 

Your "DoOnce2" variable value needs to be tested somewhere earlier so it controls where some logic is followed. All you are doing is setting the value once the code above it is processed, but then you never use "DoOnce2" to control anything else. Usually you set "DoOnce2" only after you know you have done what you want to happen only once. As it is now, you are setting it regardless of what happened in the conditional tests above (even if it was all "do nothing") at the end of the first pass.

 

So what is it you want to only do once? As it is right now in this latest version, you will replace "ALArmorAmicus" with "ALArmorLeatherReinforcedAmicus" only on the first pass, because you are only "set KillProfligates to 1" after the first pass. Then you won't process the "ALArmorLeatherReinforcedAmicus" test because you no longer have the "ALArmorAmicus" on the second and subsequent passes, so you fail to process anything under that condition. In your original version you at least would process the "ALArmorLeatherReinforcedAmicus" test when the first armor test failed. But because you were not setting "KillProfligates to 1" anywhere, you never actually passed that condition. So you never actual restored the "ALArmorAmicus".

 

Suggest you write out the logic of how the conditional tests of this should flow as a series of "pseudo code" statements like I did in my previous reply. Worry about the exact code after you have the logic worked out. Right now your logic is faulty. I've all but written out what you need to do, but if you don't figure it out yourself then you aren't really learning anything. Logic flow is the core of programming/scripting.

 

And none of this code addresses your "Actor doesn't move" problem.

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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