View unanswered posts | View active topics It is currently Sun Dec 01, 2024 4:36 am



Reply to topic  [ 11 posts ] 
 Noob Help 
Author Message
User avatar

Joined: Sat Dec 02, 2006 11:51 pm
Posts: 204
Reply with quote
Post 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
Profile WWW

Joined: Sun Aug 24, 2008 2:08 am
Posts: 3
Reply with quote
Post 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
Profile
User avatar

Joined: Sat Dec 02, 2006 11:51 pm
Posts: 204
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Wed Nov 21, 2007 7:49 pm
Posts: 189
Reply with quote
Post Re: Noob Help
Pistol is an HDFirearm, not a HeldDevice, methinks.


Sun Aug 24, 2008 4:27 pm
Profile

Joined: Thu Aug 16, 2007 10:09 am
Posts: 163
Reply with quote
Post 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
Profile
User avatar

Joined: Sat Dec 02, 2006 11:51 pm
Posts: 204
Reply with quote
Post 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
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Dec 26, 2007 6:33 am
Posts: 1743
Location: Trapped in UCP. Send help.
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Wed Dec 27, 2006 10:05 pm
Posts: 100
Reply with quote
Post Re: Noob Help
vvv this works vvv
Code:
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
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Dec 27, 2006 10:05 pm
Posts: 100
Reply with quote
Post Re: Noob Help
fine, sorry i acted like an ♥♥♥hole :-( can you forgive me?


Mon Aug 25, 2008 8:06 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

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.030s | 13 Queries | GZIP : Off ]