Author |
Message |
FarvanTorna
Joined: Sat Dec 02, 2006 11:51 pm Posts: 204
|
Noob Help
Trying to make it where if any actor has a Pistol in his held device it will fling him Code: for actor in MovableMan.Actors do if actors.HeldDevice("Pistol") then MovableMan.Actors do actors.Vel = Vector(3, -10) end end Keep getting a error of needs a = somewhere. kinda pieced this code together from differnt people on this forum(didn't work)
|
Sun Aug 24, 2008 3:07 pm |
|
|
Joudoki
Joined: Sun Aug 24, 2008 2:08 am Posts: 3
|
Re: Noob Help
Try this for actor in MovableMan.Actors do if actor.HeldDevice("Pistol") then actor.Vel = Vector(3, -10) end end
|
Sun Aug 24, 2008 3:10 pm |
|
|
FarvanTorna
Joined: Sat Dec 02, 2006 11:51 pm Posts: 204
|
Re: Noob Help
I no longer get the error(thank you) but it cannot find helddevice recalls it as a nil
|
Sun Aug 24, 2008 3:19 pm |
|
|
NickFury666
Joined: Wed Nov 21, 2007 7:49 pm Posts: 189
|
Re: Noob Help
Pistol is an HDFirearm, not a HeldDevice, methinks.
|
Sun Aug 24, 2008 4:27 pm |
|
|
robowurmz
Joined: Thu Aug 16, 2007 10:09 am Posts: 163
|
Re: Noob Help
FarvanTorna wrote: Trying to make it where if any actor has a Pistol in his held device it will fling him Code: for actor in MovableMan.Actors do if actors.HeldDevice("Pistol") then MovableMan.Actors do actors.Vel = Vector(3, -10) end end Keep getting a error of needs a = somewhere. kinda pieced this code together from differnt people on this forum(didn't work) Needs to be this: Code: for actor in MovableMan.Actors do if (actors.HeldDevice =="Pistol") then MovableMan.Actors do actors.Vel = Vector(3, -10) end end You weren't checking to see if it was something or not: you were instead setting the variable to that.
|
Sun Aug 24, 2008 9:27 pm |
|
|
FarvanTorna
Joined: Sat Dec 02, 2006 11:51 pm Posts: 204
|
Re: Noob Help
robowurmz wrote: FarvanTorna wrote: Trying to make it where if any actor has a Pistol in his held device it will fling him Code: for actor in MovableMan.Actors do if actors.HeldDevice("Pistol") then MovableMan.Actors do actors.Vel = Vector(3, -10) end end Keep getting a error of needs a = somewhere. kinda pieced this code together from differnt people on this forum(didn't work) Needs to be this: Code: for actor in MovableMan.Actors do if (actors.HeldDevice =="Pistol") then MovableMan.Actors do actors.Vel = Vector(3, -10) end end You weren't checking to see if it was something or not: you were instead setting the variable to that. not working.....ummm.... error unexpected symbol near "" also go an error right after that says expected =
|
Sun Aug 24, 2008 10:49 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Noob Help
Code: for actor in MovableMan.Actors do if actors.HeldDevice == "Pistol" then MovableMan.Actors do actors.Vel = actor.Vel(3, -10); end end That should work. Maybe.
|
Sun Aug 24, 2008 10:56 pm |
|
|
Ophanim
Joined: Wed Dec 26, 2007 6:33 am Posts: 1743 Location: Trapped in UCP. Send help.
|
Re: Noob Help
Code: for actor in MovableMan.Actors do if (actors.HeldDevice == "Pistol") then MovableMan.Actors do actors.Vel = Vector(3, -10) end end He missed a space.
|
Sun Aug 24, 2008 10:57 pm |
|
|
casey
Joined: Wed Dec 27, 2006 10:05 pm Posts: 100
|
Re: Noob Help
vvv this works vvvCode: for a in MovableMan.Actors do if a.HDFirearm==Pistol then a.Vel=Vector(3, -10) end end I've removed this as part of my apology
Last edited by casey on Mon Aug 25, 2008 8:12 pm, edited 2 times in total.
|
Mon Aug 25, 2008 1:09 am |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
Re: Noob Help
casey wrote: nice try but all of those are wrong Code: for a in MovableMan.Actors do if a.HDFirearm==Pistol then a.Vel=Vector(3, -10) end end okay, heres what mistakes you made. pistol can't have () that's only for varibles. a or in your codes actor is just a new name for an item, it isn't special, and you sited a different variable "actors" which caused a (nil'). even then it only works for the instant that you press enter. for it to be ongoing you need to set up a timer & put the code into a notepad. im still learning about timers P.S. spaces arent read, they dont acctually matter It's funny how wrong your post is. What are you talking about pistol can't have () it's only for variables? () is for functions. It usually encases arguments. How the ♥♥♥♥ is that going to cause nil? Wrong again. An instant that he presses enter? Ongoing? What? Who mentioned that. Augh. This isn't working because the variable doesn't exist YOU GUYS. Oh and spaces do matter because Code: forainMovableMan.Actorsdoifa.HDFirearm==Pistolthena.Vel=Vector(3, -10)endend is not going to work.
|
Mon Aug 25, 2008 1:27 am |
|
|
casey
Joined: Wed Dec 27, 2006 10:05 pm Posts: 100
|
Re: Noob Help
fine, sorry i acted like an ♥♥♥hole can you forgive me?
|
Mon Aug 25, 2008 8:06 pm |
|
|
|