Results 1 to 4 of 4
  1. #1
    Member sagedread's Avatar
    Join Date
    Jan 2008
    Location
    New Mexico
    Posts
    74

    my ray shooting python script... I need help!!

    I am trying to make my FPS game to where once the ray hits the object and the fire button is pushed, the the ray ( crosshair ) sends a message to the object that was last hit a message to either lose health or be pushed bak. The only thing is that evry time i run the game engine, it always says "function takes exactly two argunments,only 1 given.
    heres the script im using...


    cont = GameLogic.getCurrentController()
    own = cont.getOwner()
    fire = cont.getSensor("fire")
    aim = cont.getSensor("aim")
    force = cont.getActuator("add_force")
    forceobj = aim.getHitObject()
    name = forceobj.getName()
    if fire.isPositive():
    if aim.isPositive():
    force.setToPropName("name")
    GameLogic.addActiveActuator("force,True")

    ( own is the crosshair btw )
    The .blend file can be found here http://www.mediafire.com/?9xjzz1hhmob
    The first person to tell me whats goin on will get a spot in the credits.
    THANKS!
    Last edited by sagedread; 24-Feb-08 at 16:28.



  2. #2
    Wow, I'm surprised nobody's responded to this. If this is the only problem, at the end where you say GameLogic.addActiveActuator("Force, True"), the correct syntax is GameLogic.addActiveActuator(Force, 1). The actuator name shouldn't be in quotes, and the true value should be 1 (Boolean values in Blender are either 1 or 0; 1 is true, and 0 is false). The string is counted as a single value. Check the console to see what the problem is; usually, the console will tell you what the error is and where it is if there is one. Hope that helped!



  3. #3
    Member sagedread's Avatar
    Join Date
    Jan 2008
    Location
    New Mexico
    Posts
    74
    ooooooooo thats why most my stuff wont work when i use . 'true/false' Thanks alot man!!!



  4. #4
    Member sagedread's Avatar
    Join Date
    Jan 2008
    Location
    New Mexico
    Posts
    74
    thnx alot man. This works so much better then makin a different message for every single object on the map.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •