Data Realms Fan Forums http://45.55.195.193/ |
|
Need help with changing sprites when hit. http://45.55.195.193/viewtopic.php?f=1&t=16444 |
Page 1 of 2 |
Author: | iKP [ Sat Sep 05, 2009 11:19 am ] |
Post subject: | Need help with changing sprites when hit. |
I'm working on a Big Daddy mod from Bioshock, and I want to know how I can change his eye color (Basically changing sprites) when he gets hit by gunfire. As Bioshock fans know, Big Daddies' eyes change from yellow to red when he gets angry. If you can, how about changing his eye colors back to yellow after a while of non-gunfire? Please help, thanks. |
Author: | mail2345 [ Sat Sep 05, 2009 5:52 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
Lua should do the trick. Code: function Create(self) self.ETimer = Timer() self.RHealth = self.Health end function Update(self) if self.ETimer.PastSimMS(<timehere>) then self.Frame = 0 else self.Frame = 1 end if self.RHealth != self.Health then if self.RHealth > self.Health then self.ETimer:Reset() end self.RHealth = self.Health end end You need two frames of animation, the first for when it's eyes are yellow, the second when they are red. |
Author: | iKP [ Sat Sep 05, 2009 8:08 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
Yay! Thanks alot! That really helped me. Now I just gotta make a Lua file. All I need in the file is the script you posted right? |
Author: | Benpasko [ Sat Sep 05, 2009 10:37 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
This mod is gonna be amazing, I think. A big daddy? I'll test for you, if you want. |
Author: | Mind [ Sat Sep 05, 2009 11:03 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
Download Notepad++ for one. Second, when saving it, save it as "whateveryournameis.lua" Then, for whatever you want to attach the script to, put this in the code for it Code: ScriptPath = Whateveryourrteis.rte/YourLuaFile.lua |
Author: | iKP [ Sun Sep 06, 2009 4:29 pm ] |
Post subject: | Bioshock mod help. |
Well, sorry but can I change this topic to overall Bioshock mod I'm working on? Anyways, one more question. I tried searching and found nothing so How do we attach a weapon via ini? I have: Code: AddInventory = HDFirearm CopyOf = Rivet Gun But all I get is an error saying "Referring to an Instance ('Rivet Gun') that hasn't been defined!" Please help! |
Author: | Mind [ Sun Sep 06, 2009 5:00 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
First of all, where is this in the mod? The actor? Second, looks like your tabbing is all messed up. Should only be one tab there. Third-ly? uh That prolly means you have that copyof either before the rivet gun is defined or there is no rivet gun at all. Make sure that code comes after] the rivet gun is defined. |
Author: | CrazyMLC [ Sun Sep 06, 2009 6:15 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
Check the preset names and confirm that they are identical. |
Author: | Grif [ Mon Sep 07, 2009 4:22 am ] |
Post subject: | Re: Need help with changing sprites when hit. |
Also Mail's script will not work right because Lua has ~=, not !=. |
Author: | mail2345 [ Mon Sep 07, 2009 6:38 am ] |
Post subject: | Re: Need help with changing sprites when hit. |
Was half alseep. So just change that. |
Author: | iKP [ Mon Sep 07, 2009 12:56 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
Mind wrote: First of all, where is this in the mod? The actor? Second, looks like your tabbing is all messed up. Should only be one tab there. Third-ly? uh That prolly means you have that copyof either before the rivet gun is defined or there is no rivet gun at all. Make sure that code comes after the rivet gun is defined. - This is in the actor -Sorry, typo there. Theres just 1 tab in the ini -It's the last line of the actor's code. Where do we define it? They are identical, the preset name in Rivet Gun.ini and this codein the Rosie.ini I'm such a n00b. Sorry. |
Author: | Lizardheim [ Mon Sep 07, 2009 2:50 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
In the index.ini you should have the rivetgun above the big daddy. |
Author: | iKP [ Mon Sep 07, 2009 2:59 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
YEA! Tahnk you so much guys! Now the Rosie comes with a Rivet Gun! Thanks again! Should I remove it from the buy menu now? Now I have to get working on offsets and, more importantly, THE LUA TO MAKE HIS LIGHTS CHANGE! NOES! |
Author: | Mind [ Mon Sep 07, 2009 4:36 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
Code: function Create(self) self.ETimer = Timer() self.RHealth = self.Health end function Update(self) if self.ETimer.PastSimMS(<timehere>) then self.Frame = 0 else self.Frame = 1 end if self.RHealth ~= self.Health then if self.RHealth > self.Health then self.ETimer:Reset() end self.RHealth = self.Health end end Now open Notepad++ and save that file as "Actor.lua" in your rte Go to the actor's code and go down to where he is defined. Put a line in that says this "ScriptPath = [filepath to the lua file]/Actor.Lua" Hope this helps |
Author: | CrazyMLC [ Mon Sep 07, 2009 5:10 pm ] |
Post subject: | Re: Need help with changing sprites when hit. |
You should probably make the Rivet Gun unbuyable. Copy this into gun code: Code: Buyable = 0 |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |