Lolz1234567 Posted May 15, 2017 Share Posted May 15, 2017 alright so im having an issue with a horror mod im trying to create, long story short i wanted to create a "Ghost" enemy that flees from light, specificley the pip boy light, I created an AI type that should make the NPC flee and the script looks fine, but when i test in-game the NPC just stands still and doesnt move, even with the pip-boy light shining on it. Heres the script: scn RHLostSoulTEST Begin gamemode if player.ActorHasEffect PipBoyLight && (GetDistance Player <=700) AddScriptPackage RHFleepackageevp elseRemoveScriptPackage RHFleepackageEVP endifend-------- Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
uhmattbravo Posted May 15, 2017 Share Posted May 15, 2017 I had a similar issue trying to do a companion sit package the same way. I ended up just doing it with a quest script and a condition on the package checking a variable. scn RHLostSoulTEST Short runaway Begin gamemode If Runaway == 0 if player.ActorHasEffect PipBoyLight && (GetDistance Player <=700) Set Runaway to 1evp Endif elseif runaway == 1 if player.ActorHasEffect PipBoyLight && (GetDistance Player > 700) Set runaway to 0EVP Endif endifend Link to comment Share on other sites More sharing options...
Lolz1234567 Posted May 15, 2017 Author Share Posted May 15, 2017 the main problem im having right now is the AI, the NPC doesnt move or flee when i get near it, it just stands there. I have the Sandbox AI in the AI packages but still no movement, Link to comment Share on other sites More sharing options...
dubiousintent Posted May 15, 2017 Share Posted May 15, 2017 (edited) Try using the < ActorRefID >.AddScriptPackage syntax. Your last reference (as I interpret it) is to the Player, not your NPC. Also, pay attention to the notes on the GECK AddScriptPackage page:An actor can have only one script package at a time. [believe this includes ALL AI packages, including those attached directly to the NPC; not just those added by AddScriptPackage.] When calling the function twice on the same actor, the second package replaces the first one added.Unless the added package has some constraint on it ("must complete" and/or "must reach location"), it will be removed the next time the actor reevaluates his package. [This happens automatically every 10 seconds. EVP causes an immediate reevaluation.]Seems to me all the conditional tests in your script apply to the player, not the NPC. The AI packages on the NPC need to have their own conditions to determine when the packages run or don't. Just adding the package doesn't "enable" it with a true condition. Set a variable when your "has a light and distance <=700" condition is true, and have that variable enable/disable your script. That's what seems to be the "unseen" part of uhmattbravo's "runaway" variable is for. "Runaway" is probably the condition variable for the AI package itself. -Dubious- Edited May 15, 2017 by dubiousintent Link to comment Share on other sites More sharing options...
Lolz1234567 Posted May 15, 2017 Author Share Posted May 15, 2017 Try using the < ActorRefID >.AddScriptPackage syntax. Your last reference (as I interpret it) is to the Player, not your NPC. Also, pay attention to the notes on the GECK AddScriptPackage page:An actor can have only one script package at a time. [believe this includes ALL AI packages, including those attached directly to the NPC; not just those added by AddScriptPackage.] When calling the function twice on the same actor, the second package replaces the first one added.Unless the added package has some constraint on it ("must complete" and/or "must reach location"), it will be removed the next time the actor reevaluates his package. [This happens automatically every 10 seconds. EVP causes an immediate reevaluation.]Seems to me all the conditional tests in your script apply to the player, not the NPC. The AI packages on the NPC need to have their own conditions to determine when the packages run or don't. Just adding the package doesn't "enable" it with a true condition. Set a variable when your "has a light and distance <=700" condition is true, and have that variable enable/disable your script. That's what seems to be the "unseen" part of uhmattbravo's "runaway" variable is for. "Runaway" is probably the condition variable for the AI package itself. -Dubious-im still confused, I want the script to be on the NPC. Link to comment Share on other sites More sharing options...
dubiousintent Posted May 16, 2017 Share Posted May 16, 2017 (edited) Yes, which is why I said you should use the < ActorRefID >.AddScriptPackage syntax. < ActorRefID > should be that of the NPC, so it unambiguously assigns the added AIPackage to that NPC. When you made your conditional test "if player.ActorHasEffect PipBoyLight && (GetDistance Player <=700)" statement, you introduced the possibility of confusing the compiler into believing the "last reference" was to the "Player" instead of the NPC. Explicit references are always to be preferred to implicit ones. Please see the "Custom NPCs" section of the wiki "Getting started creating mods using GECK" article. And if that is not what is confusing you, try recapping what you now understand the script should be doing; especially with regard to the unspoken assumptions of what is happening behind the lines of script. -Dubious- Edited May 16, 2017 by dubiousintent Link to comment Share on other sites More sharing options...
Recommended Posts