Data Realms Fan Forums http://45.55.195.193/ |
|
Halp with some code http://45.55.195.193/viewtopic.php?f=73&t=15142 |
Page 1 of 2 |
Author: | MaximDude [ Tue Jun 02, 2009 8:08 pm ] |
Post subject: | Halp with some code |
Ok, so, I have a gun that shoots a shell with 'poison'. The shell travels and hits a target (Must be a live human to work), then it gibs and then the lua part must kick in. Sadly, this ♥♥♥♥ ain't workin'. I've put the code together with some copypasta and editing from other mods (Cause I fail at lua, obviously >_<) Code: function Create(self) self.hurtTimer = Timer(); self.hurtInterval = 10; end function Update(self) for actor in MovableMan.Actors do if actor.PresetName == "Browncoat Light" or actor.PresetName == "Browncoat Heavy" or actor.PresetName == "Soldier Light" or actor.PresetName == "Soldier Heavy" or actor.PresetName == "Dafred" or actor.PresetName == "Mia" or actor.PresetName == "Dimitri" or actor.PresetName == "Brutus" or actor.PresetName == "Sandra" or actor.PresetName == "Gordon" then if self.hurtTimer:IsPastSimMS(self.hurtInterval) then actor.Health = actor.Health - 3; self.hurtTimer:Reset(); end end end end What is wrong? |
Author: | ProjektTHOR [ Tue Jun 02, 2009 8:33 pm ] |
Post subject: | Re: Halp with some code |
I'll help you when you spell right. Intentional grammatical and spelling errors are not witty or humorous. |
Author: | Flammablezombie [ Tue Jun 02, 2009 8:42 pm ] |
Post subject: | Re: Halp with some code |
Intentional refusal to help over such a tiny thing as intentional misspells is not witty or humorous. Don't flame him for a choice he made intentionally for effect. |
Author: | MaximDude [ Tue Jun 02, 2009 8:47 pm ] |
Post subject: | Re: Halp with some code |
ProjektTHOR wrote: I'll help you when you spell right. Intentional grammatical and spelling errors are not witty or humorous. Wait, let me fix that. Don't be an ass, if aren't willing to hAlp, don't even post. |
Author: | Grif [ Wed Jun 03, 2009 12:53 am ] |
Post subject: | Re: Halp with some code |
MaximDude wrote: Wait, let me fix that. Don't be an ass, if aren't willing to hAlp, don't even post. If you need help don't be an ass about accepting it? |
Author: | MaximDude [ Wed Jun 03, 2009 5:00 am ] |
Post subject: | Re: Halp with some code |
Grif wrote: MaximDude wrote: Wait, let me fix that. Don't be an ass, if aren't willing to hAlp, don't even post. If you need help don't be an ass about accepting it? If you're not offereing help, don't try proving somebody else is an ass and don't post? Seriously people. |
Author: | Grif [ Wed Jun 03, 2009 5:57 am ] |
Post subject: | Re: Halp with some code |
What's wrong is that you haven't designated any actor to do it to. Either on update or destroy copy the target finding code from the coalition missile launcher, then do whatever you need to to it. Also, to designate a holy ♥♥♥♥ of things at once, try using a list rather than individually listing all of them. It's faster and neater. |
Author: | MaximDude [ Wed Jun 03, 2009 11:58 am ] |
Post subject: | Re: Halp with some code |
Grif wrote: What's wrong is that you haven't designated any actor to do it to. Either on update or destroy copy the target finding code from the coalition missile launcher, then do whatever you need to to it. Also, to designate a holy ♥♥♥♥ of things at once, try using a list rather than individually listing all of them. It's faster and neater. Ok, thanks, i'll ty that. :D Also, mind explaining how to make a list? |
Author: | Geti [ Wed Jun 03, 2009 12:17 pm ] |
Post subject: | Re: Halp with some code |
Code: actorlist = {"ActorName", "AnotherActorName", etc} |
Author: | MaximDude [ Wed Jun 03, 2009 12:19 pm ] |
Post subject: | Re: Halp with some code |
Geti wrote: Code: actorlist = {"ActorName", "AnotherActorName", etc} Ok... Simple enough... How do I define it in the 'if' part? 'if actor.PresetName' and then? |
Author: | Geti [ Wed Jun 03, 2009 1:10 pm ] |
Post subject: | Re: Halp with some code |
Code: actorlist = {list of strings} for actor in MovableMan.Actors do if string.find (table.concat(actorlist),actor.PresetName) then --stuff end end |
Author: | MaximDude [ Wed Jun 03, 2009 1:20 pm ] |
Post subject: | Re: Halp with some code |
Ok, thank you very much, good sir. Hopefully, i'll manage to get it working. |
Author: | Daman [ Wed Jun 03, 2009 7:04 pm ] |
Post subject: | Re: Halp with some code |
Geti wrote: Code: string.find (table.concat(actorlist),actor.PresetName) I really can't tell if you're copypasting the code you post from somewhere else or what, because there's always a mistake like this~ |
Author: | MaximDude [ Wed Jun 03, 2009 7:18 pm ] |
Post subject: | Re: Halp with some code |
What is wrong with it? |
Author: | Geti [ Wed Jun 03, 2009 9:12 pm ] |
Post subject: | Re: Halp with some code |
looking at my post, and then back to yours, it looks like you're seeing color tags for some reason.. i cant see them in my post though, so im thinking its something your end. i am copypasting from notepad++, so i can indent easily. no idea why that would lead to color tags in your quote of my post without them though. |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |