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

Thread: Advanced Landmine, Expression 2

  1. #1
    Wire Sofaking singilli's Avatar
    Join Date
    Jun 2007
    Location
    Garšabęr, Iceland
    Posts
    498

    Post Advanced Landmine (and ChatMine as of request)

    [ame="http://www.youtube.com/watch?v=zysvYraOZfw"]YouTube - Enginn's tutorial #2 - Advanced landmine (E2)[/ame]

    Now includes ChatMine at bottom as requested.

    Whenever you pick up the prop the e2 was spawned on it will not explode, when it comes to a stop it will arm that part of the explosive again.


    Advanced Landmine:

    Part 1 - Building the contraption

    1. First spawn a PHX 1x1 plate, freeze it.

    2. Place a wired "Button" onto the plate toggled with Value on: 1 and Value off: 0, it is under Wire - I/O.

    3. Place an "Explosive" and make sure the trigger value is at 1 other options are up to you, it is under Wire - Physics.


    Part 2 - The expression 2

    [highlight=e2]@name Advanced Landmine
    @inputs Button
    @outputs Detonate
    @persist Plate:vector True

    #Whenever you update the Epression it won't explode
    if (first()) {Plate=entity()os()}
    #Makes it run every game tick or 10 milliseconds, this way it won't be affected by lag
    runOnTick(1)

    #If player holds the entity the Expression is welded to the explosive can't explode
    if (entity():isWeldedTo():isPlayerHolding()) {True=0}

    #Gets the position of the expression as a vector
    Plate=entity()os()
    #If True equal 0 and the plate has stopped moving True is set to 1 again and that part of the explosive gets armed
    if (True==0&$Plate==vec(0,0,0)) {True=1}
    #If the delta of the plate is not 0/if it has moved, the button is 1 and True is 1 Detonate is 1 else Detonate is 0
    if ($Plate&Button&True) {Detonate=1}
    #Self explanatory
    else {Detonate=0}
    [/highlight]

    Copy and paste the code and place the expression

    Part 3 - Wiring it all up


    1. Wire the "Button" input of the expression to the "Button".

    2. Wire the Explosives "Detonate" to the "Detonate" output of the expression.

    Part 4 - Better understanding of the expression used


    Line 1:
    [highlight=e2]if (first()) {Plate=entity()os()}[/highlight]
    If it's the first run of the expression it will get the vector position of the Plate so it doesn't blow it when you update it.

    Line 2:
    [highlight=e2]runOnTick(1)[/highlight]
    Makes it run every 10 millisecond.


    Line 3:
    [highlight=e2]if (entity():isWeldedTo():isPlayerHolding()) {True=0}[/highlight]
    If you hold the entity the expression is welded to with the physgun, it will make the variable True equal to 0. If True is 0 the explosive can't explode.


    Line 4:
    [highlight=e2]Plate=entity()os()[/highlight]
    Updates the position of the expression


    Line 5:
    [highlight=e2]if (True==0&$Plate==vec(0,0,0)) {True=1}[/highlight]
    If the variable True is equal to 0 and the Delta of the vector of the plate is 0/the Plate variable is not moving. It makes the True variable 1 and thus arming that part of the bomb.


    Line 6:
    [highlight=e2]if ($Plate&Button&True) {Detonate=1}[/highlight]
    If the Delta of the expression is changing/the expresion is moving and the Button is equal to 1 and True is equal to 1 Detonate = 1.


    Line 7:
    [highlight=e2]else {Detonate=0}[/highlight]
    If one of the variables at line 6 is not equal to 1, Detonate is equal to 0.

    -------------------------------------------------------------------------------------------------------

    ChatMine:

    Part 1 - Building the contraption

    1. First spawn a PHX 1x1 plate, freeze it.

    2. Place an "Explosive" and make sure the trigger value is at 1 other options are up to you, it is under Wire - Physics.


    Part 2 - The expression 2

    [highlight=e2]@name Chatmine
    @inputs Button
    @outputs Detonate
    @persist Plate:vector True ChatActivate

    #Whenever you update the Epression it won't explode
    if (first()) {Plate=entity()os()}
    #Makes it run every game tick or 10 milliseconds, this way it won't be affected by lag
    runOnTick(1)

    #Saves the last thing the owner said as the variable Arg
    Arg=owner():lastSaid()
    #If you say /act it will activate the mine
    if (Arg=="/act") {Chat=1}
    #Else if you say /deact it will deactivate the mine
    elseif (Arg=="/deact") {Chat=0}

    #If player holds the entity the Expression is welded to the explosive can't explode
    if (entity():isWeldedTo():isPlayerHolding()) {True=0}

    #Gets the position of the expression as a vector
    Plate=entity()os()
    #If True equal 0 and the plate has stopped moving True is set to 1 again and the explosive gets armed
    if (True==0&$Plate==vec(0,0,0)) {True=1}
    #If the delta of the plate is not 0/if it has moved, the button is 1 and True is 1 Detonate is 1 else Detonate is 0
    if ($Plate&Chat&True) {Detonate=1}
    #Self explanatory
    else {Detonate=0}[/highlight]

    Copy and paste the code and place the expression


    Part 3 - Wiring it up

    1. Wire the Explosives "Detonate" to the "Detonate" output of the expression.


    Part 4 - Better understanding of the expression used

    Line 1 (changed):
    [highlight=e2]Arg=owner():lastSaid()[/highlight]
    Makes the variable Arg become the last thing you said and is saved as a string.


    Line 2 (changed):
    [highlight=e2]if (Arg=="/act") {Chat=1}[/highlight]
    If the variable Arg is equal to that you said "/act" Chat is equal to 1.


    Line 3 (changed):
    [highlight=e2]elseif (Arg=="/deact") {Chat=0}[/highlight]
    Else if the variable Arg is equal to "/deact" Chat is equal to 0.

    Do note that I just threw this code in and it's very inefficient, ask for help if you want to know how to make it more efficient.
    Last edited by singilli; 07-04-2009 at 09:38 AM.

  2. #2
    Wire Sofaking singilli's Avatar
    Join Date
    Jun 2007
    Location
    Garšabęr, Iceland
    Posts
    498

    Default Re: Advanced Landmine, Expression 2

    Part 4 updated!

  3. #3
    Wire Sofaking singilli's Avatar
    Join Date
    Jun 2007
    Location
    Garšabęr, Iceland
    Posts
    498

    Default Re: Advanced Landmine, Expression 2

    bumpity bump

  4. #4
    Wire Sofaking Wizard of Ass's Avatar
    Join Date
    May 2009
    Location
    Germany Bremerhaven
    Posts
    1,044

    Default Re: Advanced Landmine, Expression 2

    Instead of the button you could use a chatController... and why you don't apply the phx plate model to the explosive?

  5. #5
    Wire Sofaking singilli's Avatar
    Join Date
    Jun 2007
    Location
    Garšabęr, Iceland
    Posts
    498

    Default Re: Advanced Landmine, Expression 2

    I know, I'm going into chat controllers later on. And what is the second thing you are talking about?

  6. #6
    B0B
    B0B is offline
    Wirererer B0B's Avatar
    Join Date
    Jul 2007
    Location
    Osdorf(SH) not in Hamburg!!!
    Posts
    181

    Default Re: Advanced Landmine, Expression 2

    You should change the model of the e2 (wire_expression2_model [modelpath]) or the model of the explosive so that you don't need an extra prop.

    And please don't use chat commands... or everyone will know if you activate the mine.

    But anyway: Nice Landmine I like the idea to be able to pick it up
    Any spelling or grammar mistake is just to amuse you and may be kept by the finder ^_^


  7. #7
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Re: Advanced Landmine, Expression 2

    You could use a chat command to arm it though, and then perhaps E:aimEntity() and E:keyUse() to deactivate it.

  8. #8
    B0B
    B0B is offline
    Wirererer B0B's Avatar
    Join Date
    Jul 2007
    Location
    Osdorf(SH) not in Hamburg!!!
    Posts
    181

    Default Re: Advanced Landmine, Expression 2

    Why want everyone to use chat commands? they are ******* ****.
    I suggest to do it like Lying said but activate it with it too and use hints for status.
    Any spelling or grammar mistake is just to amuse you and may be kept by the finder ^_^


  9. #9
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Re: Advanced Landmine, Expression 2

    Using chat commands however would allow them to activate them all simultaneously. Using my idea for both activation and deactivation would be very time consuming when laying a field of mines.

  10. #10
    Wire Sofaking singilli's Avatar
    Join Date
    Jun 2007
    Location
    Garšabęr, Iceland
    Posts
    498

    Default Re: Advanced Landmine, Expression 2

    [highlight=e2]@name Chatmine
    @inputs Button
    @outputs Detonate
    @persist Plate:vector True ChatActivate

    #Whenever you update the Epression it won't explode
    if (first()) {Plate=entity()os()}
    #Makes it run every game tick or 10 milliseconds, this way it won't be affected by lag
    runOnTick(1)

    #Saves the last thing the owner said as the variable Arg
    Arg=owner():lastSaid()
    #If you say /act it will activate the mine
    if (Arg=="/act") {Chat=1}
    #Else if you say /deact it will deactivate the mine
    elseif (Arg=="/deact") {Chat=0}

    #If player holds the entity the Expression is welded to the explosive can't explode
    if (entity():isWeldedTo():isPlayerHolding()) {True=0}

    #Gets the position of the expression as a vector
    Plate=entity()os()
    #If True equal 0 and the plate has stopped moving True is set to 1 again and the explosive gets armed
    if (True==0&$Plate==vec(0,0,0)) {True=1}
    #If the delta of the plate is not 0/if it has moved, the button is 1 and True is 1 Detonate is 1 else Detonate is 0
    if ($Plate&Chat&True) {Detonate=1}
    #Self explanatory
    else {Detonate=0}[/highlight]

    Someone asked for code with chatcommands. Here it is. That is nothing special it doesn't include any super hard commands just your very basic Chatmine as I like to call it.

    Added to top post
    Last edited by singilli; 06-29-2009 at 01:44 PM.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Basic Landmine, Regular Gates and E2
    By singilli in forum Gate Nostalgia (Old School Wiring) Discussion & Help
    Replies: 16
    Last Post: 07-03-2009, 08:32 PM
  2. advanced Smoother in expression 2
    By Skyjets in forum Installation and Malfunctions Support
    Replies: 2
    Last Post: 05-20-2009, 02:31 PM
  3. Expression 2 Advanced targeting system: Omitting constrained props
    By JOTRkid in forum Expression 2 Discussion & Help
    Replies: 2
    Last Post: 04-16-2009, 11:32 PM
  4. Advanced Dupe and Expression 2 problems
    By tnecromancer in forum Installation and Malfunctions Support
    Replies: 1
    Last Post: 02-05-2009, 06:31 AM

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