View unanswered posts | View active topics It is currently Sat Jun 01, 2024 6:28 am



Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
 Need help with changing sprites when hit. 
Author Message
User avatar

Joined: Sat Jul 04, 2009 9:30 pm
Posts: 55
Location: Bangkok, Thailand
Reply with quote
Post 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.


Sat Sep 05, 2009 11:19 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post 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.


Sat Sep 05, 2009 5:52 pm
Profile
User avatar

Joined: Sat Jul 04, 2009 9:30 pm
Posts: 55
Location: Bangkok, Thailand
Reply with quote
Post Re: Need help with changing sprites when hit.
:D 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?


Sat Sep 05, 2009 8:08 pm
Profile
User avatar

Joined: Sun Aug 09, 2009 9:26 am
Posts: 1633
Reply with quote
Post 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.


Sat Sep 05, 2009 10:37 pm
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1359
Location: USA
Reply with quote
Post 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

:)


Sat Sep 05, 2009 11:03 pm
Profile
User avatar

Joined: Sat Jul 04, 2009 9:30 pm
Posts: 55
Location: Bangkok, Thailand
Reply with quote
Post 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! :oops:


Sun Sep 06, 2009 4:29 pm
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1359
Location: USA
Reply with quote
Post 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.


Sun Sep 06, 2009 5:00 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Need help with changing sprites when hit.
Check the preset names and confirm that they are identical.


Sun Sep 06, 2009 6:15 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Need help with changing sprites when hit.
Also Mail's script will not work right because Lua has ~=, not !=.


Mon Sep 07, 2009 4:22 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Need help with changing sprites when hit.
Was half alseep. So just change that.


Mon Sep 07, 2009 6:38 am
Profile
User avatar

Joined: Sat Jul 04, 2009 9:30 pm
Posts: 55
Location: Bangkok, Thailand
Reply with quote
Post 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.


Mon Sep 07, 2009 12:56 pm
Profile
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Need help with changing sprites when hit.
In the index.ini you should have the rivetgun above the big daddy.


Mon Sep 07, 2009 2:50 pm
Profile
User avatar

Joined: Sat Jul 04, 2009 9:30 pm
Posts: 55
Location: Bangkok, Thailand
Reply with quote
Post 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! :cry:


Mon Sep 07, 2009 2:59 pm
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1359
Location: USA
Reply with quote
Post 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 :)


Mon Sep 07, 2009 4:36 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Need help with changing sprites when hit.
You should probably make the Rivet Gun unbuyable.
Copy this into gun code:
Code:
   Buyable = 0


Mon Sep 07, 2009 5:10 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 19 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.035s | 15 Queries | GZIP : Off ]