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

Thread: different "fire modes" in e2?

  1. #1
    Wire Noob allthatstuffproductions's Avatar
    Join Date
    Jul 2008
    Posts
    16

    Default different "fire modes" in e2?

    As in my last post, i made that fail, 30 second chip that lets you throw props. Problem being, a lot of servers only equip you with a phys gun and tool gun. since i have 3 "fire modes" in the chip (Throwing, Lifting, Stopping), i need three keys, and the only ones are Me:keyUse(), Me:keyAttack1(), Me:keyAttack2(). What i want to do is when i press E (Me:keyUse()), the e2 cycles through the three modes and when the mode changes, it prints that in chat. When i press right click(Me:keyAttack2()) that fire mode happens. Ex: your on "Lifting mode". right click is pressed and you lift the prop. You press E and it goes to Stopping mode. You press right click and you stop props in mid air. Heres the code i have so far, when I'm done ill release it for funnzies. i know, i know, this is a possibly mingey chip and its very noobish. well im not a practical coder, i dont solve problems, i have fun or make them.

    Code:
    @name throwing props
    @persist Throwing Lifting Stopping
    runOnTick(1)
    
    It=entity():owner():aimEntity()
    if(first()){Throwing = 1,Lifting = 0,Stopping = 0}
    
    Me = owner()
    Mass = It:mass()
    
    
    if(Throwing==1&Me:keyUse())
    {
        Lifting = 1
        Throwing = 0
        Stopping = 0
        
    }
    if(Lifting==1&Me:keyUse())
    {
        Lifting = 0
        Throwing = 0
        Stopping = 1
    }
    if(Stopping==1&Me:keyUse())
    {
        Lifting = 0
        Throwing = 1
        Stopping = 0
    }
    
    if(Throwing)
    {
        print("now Throwing")
    }
    if(Lifting)
    {
        print("now Lifting")
    }
    if(Stopping)
    {
        print("now stopping")
    }
    
    
    
    
    if(Throwing == 1&Me:keyAttack2())
    {
    It:applyForce(Me:eye()*It:mass()*10000000) 
    It:setMass(9001)
    }
    else
    {
        It:setMass(Mass)
    }
    
    if(Lifting == 1&Me:keyAttack2())
    {
        It:applyForce(((It:pos() + vec(0,0,135))- It:pos())*It:mass()-It:vel()*(It:mass()/3))
    }    
    
    if(Stopping == 1&Me:keyAttack2())
    {
        It:applyForce(((It:pos() + vec(0,0,9))- It:pos())*It:mass()-It:vel()*(It:mass()/3))
    }
    [TEC] SnowstormFox: failure is not a option, it is a mission :3

  2. #2
    billywitchdoctor.com Whosdr's Avatar
    Join Date
    Dec 2008
    Posts
    2,300

    Default Re: different "fire modes" in e2?

    If you use a wired keyboard, you can use almost any key (except alt, start, escape)
    It spits out bytes, but its ok as toChar(97) == A
    .siht daer ot gniyrt emit detsaw ev'uoY

  3. #3
    Wire Noob allthatstuffproductions's Avatar
    Join Date
    Jul 2008
    Posts
    16

    Default Re: different "fire modes" in e2?

    i know, i was thinking of using a wire keyboard, but i dont think you can move around while using one, can you?
    [TEC] SnowstormFox: failure is not a option, it is a mission :3

  4. #4
    billywitchdoctor.com Schilcote's Avatar
    Join Date
    Jan 2009
    Location
    There.
    Posts
    2,006

    Default Re: different "fire modes" in e2?

    Go into the weapons tab and get out the Remote Control. It doesn't do anything if it isn't linked to a pod, so it should work for 99% of cases in which you need to use keyattack1/attack2/use().


    [19:16:47]Client "rcdraco" spawned in server
    [19:17:10]rcdraco: hamburgertime
    [19:18:04]rcdraco was killed by worldspawn
    [19:21:50]Dropped "rcdraco" from server

  5. #5
    Wire Noob allthatstuffproductions's Avatar
    Join Date
    Jul 2008
    Posts
    16

    Default hmm

    ya, i could use a remote control but the server i play on has it blocked for some apparent reason. i still think it would be cool to have a cycle sorta system.
    [TEC] SnowstormFox: failure is not a option, it is a mission :3

  6. #6
    Wirererer Talix's Avatar
    Join Date
    Aug 2009
    Posts
    265

    Default Re: different "fire modes" in e2?

    I remember a thread about a noweapon weapon coming out on loadout made for wiremod and e2 and etc.
    I know that plenty would support it, and I know a lot have talked about it on the forum and to me personally.

  7. #7
    Wirererer tepholman's Avatar
    Join Date
    Apr 2008
    Posts
    218

    Default Re: different "fire modes" in e2?

    Here's a quick bit of psuedocode to give you a idea.
    if (ChangeMode) {Mode = Mode + 1}
    if (Mode > 3) {Mode = 1}
    if (Mode < 1) {Mode = 3}
    if (Action & Mode = 1} {Action1}
    if (Action & Mode = 2} {Action2}
    if (Action & Mode = 3} {Action3}

  8. #8
    Wire Sofaking ktccd's Avatar
    Join Date
    Sep 2009
    Posts
    751

    Default Re: different "fire modes" in e2?

    That code looks annoying...

    Code:
    -snip-
    Now just use an if statement like "if Mode==0 {stuff with lifting code}"
    yada yada yada, you know the drill ^^.

    EDIT: With my new knowledge, I know this would not work, due to E:keyAttack1/2() being weird. Look at page 2 for code that works.
    Last edited by ktccd; 03-13-2010 at 03:59 PM. Reason: Error and update.

  9. #9
    Wire Noob krail's Avatar
    Join Date
    Jun 2009
    Location
    Sydney, Australia
    Posts
    23

    Default Re: different "fire modes" in e2?

    Quote Originally Posted by ktccd View Post
    That code looks annoying...

    Code:
    @persist Mode
    
    #Mode 0 is lifting
    #Mode 1 is throwing
    #Mode 2 is stopping
    
    if (changed(owner():keyUse()) & owner():keyUse())
    {
    Mode = (Mode + 1) % 3
    }
    
    #Tada!
    Now just use an if statement like "if Mode==0 {stuff with lifting code}"
    yada yada yada, you know the drill ^^.
    Eh? Could you please explain how this works because I must be missing something here... Anyway what tepholman said should work except you might want to use if(ChangeMode & ~ChangeMode) so you can't scroll past two options in one click if the chip is running frequently and also you don't need "if (Mode < 1) {Mode = 3}" if you only have one button to scroll up

  10. #10
    Wire Amateur WhiteWolf's Avatar
    Join Date
    Jan 2010
    Location
    North Carolina, USA
    Posts
    38

    Default Re: different "fire modes" in e2?

    Here's my Telekenesis chip. Look closely at how the chip knows when to grab, let go, throw, and move the prop. (hint: Use key and a persisted variable.)
    Code:
    @name Telekenesis (Stand Alone)
    @persist Telekenesis HoldMod Mouse1 Mouse2 Dist
    @persist TargEnt:entity O:entity
    @persist Direc:vector
    runOnTick(1)
    interval(10)
    Own=owner()
    if(first()){O=owner()}
    Said=Own:lastSaid()
    SaidWhen=Own:lastSaidWhen()
    Splode=Said:explode(" ")
    Use=O:keyUse()
    Mouse1=O:keyAttack1()
    Mouse2=O:keyAttack2()
    Mouse1C=changed(Mouse1)
    Mouse2C=changed(Mouse2)
    Weapon=(O:weapon():type()=="weapon_crowbar" | O:weapon():type()=="weapon_physcannon" ? 1 : 0)
    if(Use&Mouse1&Mouse1C&!Telekenesis&Weapon)
    {Telekenesis=1,TargEnt=O:aimEntity()}
    elseif(Use&Mouse2&Mouse2C&Telekenesis&Weapon)
    {TargEnt=noentity(),Telekenesis=0}
    elseif(Use&Mouse1&Mouse1C&Telekenesis&Weapon)
    {TargEnt:applyForce(Direc*5000),TargEnt=noentity(),Telekenesis=0}
    if(Telekenesis&clk("interval"))
    {
        Direc=O:eye()*100
        Pos=TargEnt:massCenter()
        EyeMod=Direc:length()+HoldMod
        HoldPos=O:shootPos()+O:eye()*EyeMod
        Dist=O:shootPos():distance(Pos)
        PVel=TargEnt:vel()
        OVel=O:vel()
        OAVel=O:angVel()
        PAVel=TargEnt:angVel()
        Mass=TargEnt:mass()
        Inert=TargEnt:inertia():length()/sqrt(3)
        TargEnt:applyForce(((HoldPos-Pos)*10-PVel+OVel)*Mass)
        TargEnt:applyAngForce(-(TargEnt:angles():setYaw(0)*25 + PAVel*2)*Inert)
    }
    elseif(TargEnt==noentity()|Telekenesis==0){Telekenesis=0,HoldMod=0}
    if(Mouse1&Telekenesis){HoldMod+=1}
    if(Mouse2&Telekenesis&Dist>=100){HoldMod-=1}
    
    if(Splode[1,string]=="!Teleken"&changed(SaidWhen))
    {
        if(Splode[2,string]:lower()=="me"){O=owner()}
        else{O=findPlayerByName(Splode[2,string])}
    }

+ Reply to Thread
Page 1 of 2 12 LastLast

Tags for this Thread

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