bronzeP Posted June 29, 2012 Share Posted June 29, 2012 (edited) Hi ^^ if you are good in scripting then could you please tell me how i could make a script where lets say a dragon grows when you are attacking him like for example if he only has 50% of life that he grows double the size and after 25% health a second time? I would like to improve myself in scripting but that goes far beyond my skills :( Thank you very much if you could help me! ^.=.^ edit: thats my script so far: (i think there happens nothing atm XD) Scriptname dragongrow extends ObjectReference {; Dragon Grow float dragonscale dragonscale = game.getdragon().getscale() if (dragonscale < 2.5) dragonscale = dragonscale + 0.05 game.getdragon().setscale(dragonscale) endif} Edited June 29, 2012 by bronzeP Link to comment Share on other sites More sharing options...
Korodic Posted June 29, 2012 Share Posted June 29, 2012 game.getdragon() is not a function. These are functions:http://www.creationkit.com/Category:Papyrus The problem is your function does not exist, therefore it does not know what dragon you are even talking about. If there is a single error in your script it won't run during game time correctly if at all. That link will give you a whole list of ... things that do things. It's justa matter of bending them for what you want. You may also want to become comfortable with using variables, and assigning them values ("properties"). That is how you define the who and what. You script seems right for what you want for the most part, you just need to define it a little more. One of things you may also want to know. There are things called "events" they are used to catch certain interactions with the world. You want to check the dragons health right? So can we say that we want to check the dragons health everytime the dragon is hit? That sounds about right, so you would want to put your code inside of this event: http://www.creationkit.com/OnHit_-_ObjectReference also this is not java, using the { code block } has a different function in papyrus. It is used to create tool tips for variables like you will see in many "default" scripts made by the developers. Link to comment Share on other sites More sharing options...
bronzeP Posted June 29, 2012 Author Share Posted June 29, 2012 (edited) game.getdragon() is not a function. These are functions:http://www.creationkit.com/Category:Papyrus The problem is your function does not exist, therefore it does not know what dragon you are even talking about. If there is a single error in your script it won't run during game time correctly if at all. That link will give you a whole list of ... things that do things. It's justa matter of bending them for what you want. You may also want to become comfortable with using variables, and assigning them values ("properties"). That is how you define the who and what. You script seems right for what you want for the most part, you just need to define it a little more. One of things you may also want to know. There are things called "events" they are used to catch certain interactions with the world. You want to check the dragons health right? So can we say that we want to check the dragons health everytime the dragon is hit? That sounds about right, so you would want to put your code inside of this event: http://www.creationkit.com/OnHit_-_ObjectReference also this is not java, using the { code block } has a different function in papyrus. It is used to create tool tips for variables like you will see in many "default" scripts made by the developers. well, thx a lot! I appreciate your help, as you can see i have 0% skills in scripting XD but i really wanna do this for a friend and i will do everything to make it work!I think you helped me a lot. edit: my scripts looks now like this: (i know that there are still missing important things but it says that the compiling succeeded/the dragon's size still hasnt changed with the script ^^") Scriptname dragongrow extends ObjectReference {; Dragon Grow float lvlDragonscale lvlDragonscale = game.getlvlDragon().getscale() if (lvlDragonscale < 2.5) lvlDragonscale = lvlDragonscale + 0.5 game.getlvlDragon().setscale(lvlDragonscale) endif} Edited June 29, 2012 by bronzeP Link to comment Share on other sites More sharing options...
Korodic Posted June 29, 2012 Share Posted June 29, 2012 because like I said before, using { and } is meant to enclose a tool tip, not code. Here... this script would go on the specific dragon you want to do this do. Remember, changing the base object as opposed to the REFERENCE object means the difference between changing every dragon of that ID in the game, and a single ID/instance of that object. Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \ bool abBashAttack, bool abHitBlocked) float DragonsHealth = self.GetActorValuePercentage("health") if (DragonsHealth < HealthFactor && self.GetScale() < 2.5) ;If "HealthFactor" was set to 0.5, it would mean the dragon has less than half their health left increaseSize() decreaseHealthFactor() endif EndEvent function increaseSize() self.SetScale(self.GetScale() + 0.5) endfunction function decreaseHealthFactor() HealthFactor=HealthFactor-0.1 endfunction float property HealthFactor=0.5 auto {Health factor defaults to 0.5} This may not be perfect. But it's a lot closer. Link to comment Share on other sites More sharing options...
bronzeP Posted June 29, 2012 Author Share Posted June 29, 2012 thank you! you are really friendly. people like you are nowaydays pretty rare ^^. anyways i gave you kudos. i copied your script and replaced it with mine but the dragon still stays at the same size :/ I hope that someday i can finish this mod for my pal. (dont ask why he wants growing dragons, it would confuse you ^^ ) Link to comment Share on other sites More sharing options...
Korodic Posted June 29, 2012 Share Posted June 29, 2012 Scriptname JDDragonTestScript extends Actor Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \ bool abBashAttack, bool abHitBlocked) float DragonsHealth = self.GetActorValuePercentage("health") if (DragonsHealth < HealthFactor && self.GetScale() < 2.5) ;If "HealthFactor" was set to 0.5, it would mean the dragon has less than half their health left increaseSize() decreaseHealthFactor() endif EndEvent function increaseSize() self.SetScale(self.GetScale() + 0.5) endfunction function decreaseHealthFactor() HealthFactor = HealthFactor - 0.1 endfunction float property HealthFactor=0.5 auto {Health factor defaults to 0.5} It should work now, I tested this code and tried it in game. & ty for the kudos. Be sure to check out my up-coming mod Dwemer Colosseum :] Link to comment Share on other sites More sharing options...
bronzeP Posted June 29, 2012 Author Share Posted June 29, 2012 (edited) I will for sure, looks awesome your mod :O! Thank you so much, it worked! ^.=.^ (my master will be happy hehehe) edit: if im adding this script into the main script for dragons does that mean that every dragon will grow then? cus my last goal is to make every dragon that attacks you growing ^^ (i mean the dragonactorscript) btw, i just realised that if he grows while in air he will become VERY glitchy ^^ edit 2: my new idea to prevent glitching is that i will make a new dragontype which has more health than lets say the ancient dragons and everyone knows that a dragon wont fly anymore if his health gets under (i think) 40-50% abd so i will change the script that the dragon grows at 20 or 30% that he cant get glitchy in air. To make sure that he doesnt get too glitchy on ground i will try to reduce the scale that he doesnt get too big ;) I know how to change this ^^ but i just want to know if thats a good solution to prevent glitching ^^ -->hasnt worked ^^ is there a way to prevent that the dragon animation gets messed up? Edited June 29, 2012 by bronzeP Link to comment Share on other sites More sharing options...
Korodic Posted June 29, 2012 Share Posted June 29, 2012 not that I know of. Changing scale generally isn't a good idea. Link to comment Share on other sites More sharing options...
bronzeP Posted June 29, 2012 Author Share Posted June 29, 2012 not that I know of. Changing scale generally isn't a good idea.ok, well maybe someone will find a solution. if not then i have to stay with my dragonworm xD Link to comment Share on other sites More sharing options...
Korodic Posted June 29, 2012 Share Posted June 29, 2012 Worm? Can I see a screenshot? lol Link to comment Share on other sites More sharing options...
Recommended Posts