YukiAburame Posted September 14, 2012 Share Posted September 14, 2012 I'm just wondering if it would be possible to control a NPC (Pet in this case) with a spell. This "spell" would be able to set aggression on or off, and make the pet follow the player more closely or from a greater distance.My idea is for the pet to be able to ether support the player with a buff (defensive or offensive) while it's not set to attack and when it dose attack it would help you deal damage. How could I (or others if interested) manage to accomplish this? For starters i would like to know if it's possible to change aggression with a spell without targeting the NPC. Link to comment Share on other sites More sharing options...
dfac364 Posted September 14, 2012 Share Posted September 14, 2012 i believe so, im far from a scripting genius but i think you could make a self cast spell that triggered a script that pointed at a specific reference, but i dont know if there is a command to set aggression although im guessing there is one for distance because of the follower mods out there that already do that but it might also just be a reference to an ai package which i dont think you can give to a pet Link to comment Share on other sites More sharing options...
JanusForbeare Posted September 14, 2012 Share Posted September 14, 2012 dfac is right, it is possible through scripted spells. The precise function you want is MyPetProperty.SetAV("Aggression", X) Where X is a value between 0-3 (the higher the value, the more aggressive the creature will be). Link to comment Share on other sites More sharing options...
YukiAburame Posted September 15, 2012 Author Share Posted September 15, 2012 Thank you, will start to check more into the scripting tomorrow then. Another question regarding the pet. I have made a spell that can only be added by console for now, it's a constant effect on self. What it dose is that it summons a creature when the spell is added and the summon should last "forever". Problem right now with this is that even thought i have marked the summon as essential it still dies, might be because of lack of the bleed out situation (event thingy). Anyway, how could i make the spell recast the summon if the summon dies. Should i make a different effect (spell) that checks if the summon spell is in effect if not then activate it (just thought of this, lol.) Link to comment Share on other sites More sharing options...
YukiAburame Posted September 17, 2012 Author Share Posted September 17, 2012 Have worked some on the pet, decided to make it an animal follower for now. It can follow orders such as "take" and "attack", I can also open its inventory (it only has 20 carry weight). Now, since I'm new to scripting I don't really know how to script. I have checked different tutorials but nothing seems to be close to what i'm looking for. This is my take on the script that should set the aggression for the pet ((0 and 2 were chosen as the ck has 0,1,2,3 were 3 frenzies and 0 doesn't attack )I think?) Scriptname ABUFoxPetCalmScript extends activemagiceffect Hidden Event OnEffectStart(actor akTarget, actor akCaster) If (ABUEncFox.getav("aggression", 2)) ABUEncFox.setav("aggression", 0)else ABUEncFox.setav ("aggression", 2) endifendevent The problem with this is that the compiler doesn't know what "ABUEncFox" is pointing at since in this it's a variable.Would anyone be able to help me on how to refer a specific actor, not via pointing at the target but withing a script? Maybe help me fix this script? Link to comment Share on other sites More sharing options...
JanusForbeare Posted September 17, 2012 Share Posted September 17, 2012 From the looks of it, all you're missing is a declaration of your ABUEncFox property. There are several ways to do this, but the easiest and most common is to insert the line Actor Property ABUEncFox auto Above the first line of your event. Then, in the edit window of the reference that contains your script, click on "Properties", and in the window that pops up, assign your pet to the ABUEncFox property. Also, you probably don't need to set your script to hidden, but I don't think it will hurt anything. Link to comment Share on other sites More sharing options...
YukiAburame Posted September 18, 2012 Author Share Posted September 18, 2012 Thank you for the quick answer. I added the line and tried to compile and now i get this error. "too many arguments passed to function" for the line "If (ABUEncFox.getav("aggression", 2))" And don't really know what to do, also I tried to rewrite it to, "If (ABUEncFox "aggression" == 2)" (This should work the same way?) More to test if it worked the same than to fix the problem. Got the same error. And also you said to assign the pet to ABUEncFox property. I have no idea what type it should be or if i need an initial value. The only thing i have used properties really is follower dialogue related. And that was by following a tutorial to add existing properties. Link to comment Share on other sites More sharing options...
Ghaunadaur Posted September 19, 2012 Share Posted September 19, 2012 To fill the property, click on 'Properties' in the script section, select the property -> edit value and choose the pet from the drop-down menu. But before, the script needs to be compiled, try this code: Scriptname ABUFoxPetCalmScript extends activemagiceffect Actor Property ABUEncFox auto Event OnEffectStart(actor akTarget, actor akCaster) If (ABUEncFox.getav("aggression") as int) == 2 ABUEncFox.setav("aggression", 0) else ABUEncFox.setav ("aggression", 2) endif endevent Link to comment Share on other sites More sharing options...
YukiAburame Posted September 22, 2012 Author Share Posted September 22, 2012 To fill the property, click on 'Properties' in the script section, select the property -> edit value and choose the pet from the drop-down menu. But before, the script needs to be compiled, try this code: Scriptname ABUFoxPetCalmScript extends activemagiceffect Actor Property ABUEncFox auto Event OnEffectStart(actor akTarget, actor akCaster) If (ABUEncFox.getav("aggression") as int) == 2 ABUEncFox.setav("aggression", 0) else ABUEncFox.setav ("aggression", 2) endif endevent Thank you, that seems to work, at least compile fine. As for properties when I clicked the script it already showed the ABUEnchFox actor property that I didn't change in anyway since I don't know if and what I should have changed there, if anything.In game the spells only works when I target the pet Fox and shows the particles i have chosen and all, but that seems to be it. I can not see any change in aggression, tried to fight without using it and then after i had used it and even mid fight. No change seems to be applied. Is this just a error with the numbers? Should i use 1, 2 or 3 as stated before by JanusForbeare, or should the 0 to 4 that i currently use work? Will probably try changing that anyway. Might take a while for me to even make minor changes though, Borderland 2 is out and i have other games to play as well... Link to comment Share on other sites More sharing options...
Recommended Posts