Epicolor Posted June 6, 2012 Share Posted June 6, 2012 Hello. Im very new to modding and also very green in programing/scripting (only know the very basics). So. I made a little script that should affect the player right after the game loads in. (script probably wont work yet but that will be a later issue). The script is ready, but i don't really know where to "attach" or add this script. In the papyrus tutorial I learned how to add a script to an activator object like a stone, and write text on use. Now my script should change stats on the player if he hits an enemy. My only question is where should i add my script? I tried object/actor/player added on that? Last time i tried it the game crashed after 1 sec it loaded, but maybe just because my code was wrong. Thx for any help in forward. Link to comment Share on other sites More sharing options...
gasti89 Posted June 6, 2012 Share Posted June 6, 2012 I think it should be attached to a magic effect. Then you'd create an ability/perk that will use that magic effect and assign it to the player. Link to comment Share on other sites More sharing options...
Epicolor Posted June 6, 2012 Author Share Posted June 6, 2012 (edited) Thx gasti89 for the help. Thanks to you I made some prorgress. I created an alteration cast spell for it to just test it. Now it is working but it don't want to stack somewhy. I made a counter for it like: float n Event ... n = n + 0.5 function +1 + n happen Endevent It looks like the game dont store counters on spells like on objects at all. Only 1.5 happens every time and it dont increase for the next use. I basicly used this part of the tutorial to make things happen differently after more use. http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Variables_and_Conditionals But it looks like spells work differently? Update: Fixed the thing by just using game.getplayer().getscale() so I don't have to store information seperatly now. Edited March 19, 2013 by Epicolor Link to comment Share on other sites More sharing options...
Epicolor Posted March 19, 2013 Author Share Posted March 19, 2013 (edited) I don't want to open a new topic so here we go again with a problem. The mod last time I was trying to create was done and worked. But now that I wanted to improve it, since then I lost the mod because of a reinstall. I tried to recreate my mod but somehow I can't make it work.. The part of the script of "what to do" is working seperatly, but I forgot how to make the "when to do part". So here is my basic code: Scriptname NamiraMod extends activemagiceffect Event OnInit() Debug.MessageBox("Mod is Active") EndEvent ;This even onactive part probably wrong, I tried also Function Feed(), Function StartCannibal() etc.Event OnActivate(ObjectReference akActionRef) ; Some Random Things to happen here will get extended (placeholder) float playerscale playerscale = game.getplayer().getscale() playerscale = playerscale + 1.005game.getplayer().setscale(playerscale)Debug.MessageBox("Scale changed!") EndEvent What I want is when you have the Namira's ring equiped, and you start eating a corpse, you get bigger during the feed animation. (when this is done I will change that placeholder to weight and stat change and to SKSE code) Last time it worked well but I cant make it work again. I just forgeting out something, and now I starting to mess things up because I don't know what to fix, so there will be probably more error also. So currently I try it to attach the script to "DA11NamiraBlessingEffect" MagicEffect. But maybe I should add it to the Item it self, or to the Perk "DA11Cannibalism". Don't know the answer. Or maybe I just need the right Event or Function line to make it work when it should work. Update: Tipical, just when I try to ask for help after 2 days of searching I find the answer my self. I just implemented my script in the line of an already existing one in the DA11Cannibalism Perk. (atleast I now Have a documentation for my self here lol) ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 6Scriptname PRKF_DA11Cannibalism_000EE5C3 Extends Perk Hidden ;BEGIN FRAGMENT Fragment_0Function Fragment_0(ObjectReference akTargetRef, Actor akActor);BEGIN CODEGame.GetPlayer().StartCannibal(akTargetRef as Actor)DA11CannibalismAbility.Cast(Game.GetPlayer(), Game.GetPlayer())DA11CannibalismAbility02.Cast(Game.GetPlayer(), Game.GetPlayer()) float playerscale playerscale = game.getplayer().getscale() playerscale = playerscale + 0.1game.getplayer().setscale(playerscale)Debug.MessageBox("Scale changed") ;Game.GetPlayer().AddSpell(DA11CannibalismAbility);Game.GetPlayer().AddSpell(DA11CannibalismAbility02, abVerbose= false);END CODEEndFunction;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment PlayerVampireQuestScript Property PlayerVampireQuest Auto Edited March 19, 2013 by Epicolor Link to comment Share on other sites More sharing options...
Recommended Posts