+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Prop Controller

  1. #1
    Wire Sofaking jacoby6000's Avatar
    Join Date
    Feb 2008
    Location
    behind you when you aren't looking
    Posts
    792

    Default Prop Controller

    Ok so far what i have is

    Code:
    @name Roller mine spin around you thing...
    @persist Vector:vector D E Timer
    runOnTick(1)
    Timer=Timer+2
    D=sin(Timer)*300
    E=cos(Timer)*300
    if (Timer>=360) { Timer=0 }
    Vector=owner():pos()-(find():pos()-vec(D,E,105)) 
    if (owner():isCrouch()) {
    Vector=owner():aimPos()-(find():pos()-vec(0,0,50)) 
    }
    find():applyForce(($Vector*15+Vector)*(find():mass()))
    findByModel("models/roller.mdl")
    http://www.wegame.com/watch/Spinnie_turret/

    What this does is it finds the closest rollermine, then makes it spin around you, and when you crouch it flys at what you look at.



    What i need help with is making it target an infinate amount of rollermines, so i can have a halo of death basically (after a few modifications of course)^_^

    Ive been working on this for days PLZ HELP =P
    Last edited by jacoby6000; 06-05-2009 at 02:16 PM.

  2. #2
    Wire Amateur RabidCrab's Avatar
    Join Date
    Jan 2008
    Location
    Oregon
    Posts
    90

    Default Re: Prop Controller

    You're looking for a loop, which is the one thing E2 lacks, but there's a way to emulate looping in E2 that would work with your setup. applyForce() is only applied for 10 ms, so the first thing you want to do is maximize how often the chip executes. I'm not sure if runOnTick(1) would be faster than interval(10), but I'm betting it is on 66 tick and less servers, which is generally what you find.

    I didn't test this, but this is what you can do to loop through countless mines

    [highlight=e2]
    @name Roller mine spin around you thing...
    @persist Vector:vector D E Timer Iterator Mines:array

    interval(10)

    if (Iterator <= Mines:count())
    {
    Timer=Timer+2
    D=sin(Timer)*300
    E=cos(Timer)*300
    if (Timer>=360) { Timer=0 }

    Vector=owner()os()-(Mines:entity(Iterator)os()-vec(D,E,105))
    if (owner():isCrouch())
    {
    Vector=owner():aimPos()-(Mines:entity(Iterator)os()-vec(0,0,50))
    }

    Mines:entity(Iterator):applyForce(($Vector*15+Vect or)*(Mines:entity(Iterator):mass()))

    Iterator++;
    }
    else
    {
    Iterator = 1

    findByModel("models/roller.mdl")
    Mines = findToArray()
    }
    [/highlight]

    I wrote that code by hand so don't be surprised if it doesn't work :mellow:. This code emulates a loop by iterating the value Iterator and the end of every successful execution, which will eventually apply force to every roller mine it finds. Hopefully you get the gist of how it should work and be able to move from there.
    I'm named after the crustacean, not the STD.




    All my crap is built on Drunkie's server

  3. #3
    Wire Sofaking jacoby6000's Avatar
    Join Date
    Feb 2008
    Location
    behind you when you aren't looking
    Posts
    792

    Default Re: Prop Controller

    ill tell you how it goes but thanks =D (if it doesnt work i can figure it out... hopefully)

  4. #4
    Wire Sofaking jacoby6000's Avatar
    Join Date
    Feb 2008
    Location
    behind you when you aren't looking
    Posts
    792

    Default Re: Prop Controller

    WOA THIS DOESNT GO HOW I EXPECTED BUT WOWWWW!! =D im still gunna fix it tho

    also theres a typo on line 21 take out the semi-colon

    WOW



    EDIT: just talked to a guy who knows how to but wont tell me how he says he uses 1 array, and he has force being applied to 5 things at a time, so like what you gave me but with 5 indexes being used at once... if that makes sense


    EDIT EDIT:Heres what i have now

    PHP Code:
    @name Roller mine spin around you thing...
    @
    persist Vector:vector D E Timer A Mines:array V:vector B C F G V2:vector V3:vector V4:vector
     
    interval
    (10)
     
    if (
    <= Mines:count())
    {
        
    Timer=Timer+2
        F
    =sin(Timer/Mines:count())*(Mines:count()/5)*300
        G
    =cos(Timer/Mines:count())*(Mines:count()/5)*300

     
        Vector
    =owner():pos()-(Mines:entity(A):pos()-vec(0,0,105)) 
        if (
    owner():isCrouch()) 
        {
            
    Vector=owner():aimPos()-(Mines:entity(A):pos()-vec(0,0,F+105)) 
        }
     
        
    Mines:entity(A):applyForce(($Vector*15+Vector)*(Mines:entity(A):mass()))
     
        
    A++
    }
    else
    {
        
    1
        B 
    A+1
        C 
    B+1
        D 
    C+1
        E 
    D+1
     
        findByModel
    ("models/roller.mdl")
        
    Mines findToArray()
    }

        
    V=(Mines:entity(A):pos())-(Mines:entity(B):pos()-vec(0,0,0)) 

        
    Mines:entity(B):applyForce(($V*15+V)*(Mines:entity(B):mass()))
     


        
    V2=(Mines:entity(B):pos())-(Mines:entity(C):pos()-vec(0,0,0)) 


        
    Mines:entity(C):applyForce(($V2*15+V2)*(Mines:entity(A):mass()))
     


        
    V3=(Mines:entity(C):pos())-(Mines:entity(D):pos()-vec(0,0,0)) 
       
        
    Mines:entity(D):applyForce(($V3*15+V3)*(Mines:entity(A):mass()))
     


        
    V4=(Mines:entity(D):pos())-(Mines:entity(E):pos()-vec(0,0,0)) 

        
    Mines:entity(E):applyForce(($V4*15+V4)*(Mines:entity(A):mass())) 
    Last edited by jacoby6000; 06-05-2009 at 03:30 PM.

  5. #5
    Wire Amateur RabidCrab's Avatar
    Join Date
    Jan 2008
    Location
    Oregon
    Posts
    90

    Default Re: Prop Controller

    Sorry bout the semi-colon, I'm too used to playing with C++ and C#

    I'm pretty sure it's causing issues because the timer isn't synced with each rollermine. Instead of the iterator (A) growing each execution, I moved it down to when the iterator resets. I also set the timer as (Timer + A) to make it so the rollermines don't float on top of each other. This should stop the glitching issue, and it should fix the really random looping.

    [highlight=e2]
    @name Roller mine spin around you thing...
    @persist Vector:vector D E Timer A Mines:array V:vector B C F G V2:vector V3:vector V4:vector

    interval(10)

    if (A <= Mines:count())
    {
    F=sin((Timer + A)/Mines:count())*(Mines:count()/5)*300
    G=cos((Timer + A)/Mines:count())*(Mines:count()/5)*300


    Vector=owner()os()-(Mines:entity(A)os()-vec(0,0,105))
    if (owner():isCrouch())
    {
    Vector=owner():aimPos()-(Mines:entity(A)os()-vec(0,0,F+105))
    }

    Mines:entity(A):applyForce(($Vector*15+Vector)*(Mi nes:entity(A):mass()))

    A++
    }
    else
    {
    A = 1
    B = A+1
    C = B+1
    D = C+1
    E = D+1

    Timer=Timer+2

    findByModel("models/roller.mdl")
    Mines = findToArray()
    }
    [/highlight]
    I'm named after the crustacean, not the STD.




    All my crap is built on Drunkie's server

  6. #6
    Wire Sofaking jacoby6000's Avatar
    Join Date
    Feb 2008
    Location
    behind you when you aren't looking
    Posts
    792

    Default Re: Prop Controller

    well they go in circles now, but not around me =/

  7. #7
    Wire Amateur RabidCrab's Avatar
    Join Date
    Jan 2008
    Location
    Oregon
    Posts
    90

    Default Re: Prop Controller

    Odd...

    add me to friends on steam so I can take a look at what's going on. I'm betting I'm just overlooking something, but I'm interested in finding out what's wrong ^_^
    I'm named after the crustacean, not the STD.




    All my crap is built on Drunkie's server

  8. #8
    Wire Sofaking jacoby6000's Avatar
    Join Date
    Feb 2008
    Location
    behind you when you aren't looking
    Posts
    792

    Default Re: Prop Controller

    figured it out, sorry i didnt get back to you

  9. #9
    Wire Amateur Rasputin's Avatar
    Join Date
    Nov 2007
    Posts
    49

    Default Re: Prop Controller

    What does the

    -vec(0,0,F+105)Mean... sry just trying to learn

    i asking cause i didn't see a F variable?

    and what do you use G for?

  10. #10
    Banned shuntaiyo's Avatar
    Join Date
    Oct 2009
    Posts
    40

    Default Re: Prop Controller

    if you need moar help check out chinoto's force circle or ballz of steel which im pretty sure this idea stemmed from so this comment is pretty useless sorry
    edit: look at the force circle especially chinoto has an extremely useful code piece which allows the most most maximum prop amount (like up to 70)(it does bend the rules a bit though)

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Prop Projector
    By Flieboy in forum Ideas & Suggestions
    Replies: 12
    Last Post: 05-21-2009, 07:37 PM
  2. How do I "prop spawn" a not prop?
    By DPyro in forum Installation and Malfunctions Support
    Replies: 2
    Last Post: 01-08-2009, 06:24 AM
  3. prop secure
    By KubeN in forum Off-Topic
    Replies: 1
    Last Post: 10-24-2007, 09:38 AM
  4. Wire Prop Controller
    By kai990 in forum Ideas & Suggestions
    Replies: 2
    Last Post: 07-03-2007, 03:38 AM
  5. Prop Igniter
    By TheRussian in forum Gate Nostalgia (Old School Wiring) Discussion & Help
    Replies: 1
    Last Post: 06-20-2007, 03:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots