Author Topic: Py Help... Making Claws Change Direction.  (Read 1717 times)

Offline Gigafrost

  • *
  • Posts: 805
  • Rep: 0
  • You'll never know what I'll think of next.
    • View Profile
    • Awards
Py Help... Making Claws Change Direction.
« on: November 02, 2008, 10:01:30 AM »
I have been trying to work on the following code:

def HazardsOn(self, on):
        if on:
            self.flame4a = Hazards.Flame((-3.96, -.19, -11.04), (0, 7, 0), (.2, .4, .2), .8)
            self.AddHazard(self.flame4a)
            self.flame4b = Hazards.Flame((-6.23, -.19, -11.04), (0, 7, 0), (.2, .4, .2), .8)
            self.AddHazard(self.flame4b)
            self.flame3a = Hazards.Flame((4.21, -.19, -11.04), (0, 7, 0), (.2, .4, .2), .8)
            self.AddHazard(self.flame3a)
            self.flame3b = Hazards.Flame((6.47, -.19, -11.04), (0, 7, 0), (.2, .4, .2), .8)
            self.AddHazard(self.flame3b)
            self.flame1a = Hazards.Flame((-6.37, -.19, 11), (0, 7, 0), (.2, .4, .2), .8)
            self.AddHazard(self.flame1a)
            self.flame1b = Hazards.Flame((-4.1, -.19, 11), (0, 7, 0), (.2, .4, .2), .8)
            self.AddHazard(self.flame1b)
            self.flame2a = Hazards.Flame((4.06, -.19, 11), (0, 7, 0), (.2, .4, .2), .8)
            self.AddHazard(self.flame2a)
            self.flame2b = Hazards.Flame((6.33, -.19, 11), (0, 7, 0), (.2, .4, .2), .8)
            self.AddHazard(self.flame2b)
       
            self.ambience = plus.createSound("Sounds/hzd_rotclaw_loop.wav", False, (0, 0, 0))
            plus.loopSound(self.ambience)
           
            self.RegisterZone("flamezone01",1)
            self.RegisterZone("flamezone02",2)
            self.RegisterZone("flamezone03",3)
            self.RegisterZone("flamezone04",4)
 
            self.claw1 = self.GetHinge("Hinge01")
            self.claw1.SetAutoLocks(False, True)
            self.claw1.SetPowerSettings(9, 1000)
            self.claw1.Lock(False)
            self.claw1.SetDirection(100)
           
           
            self.claw2 = self.GetHinge("Hinge02")
            self.claw2.SetAutoLocks(False, True)
            self.claw2.SetPowerSettings(9, 1000)
            self.claw2.Lock(False)
            self.claw2.SetDirection(100)Now I know that the segment self.claw1(or 2).SetDirection(100) is responsible for the direction of which the claw turns in the clawtop. However, I don't know how to make it change direction when the flames set off. Or in other words, I don't know how to make a trigger.


Does anyone know how to solve this issue?


Offline Madiaba

Py Help... Making Claws Change Direction.
« Reply #1 on: November 02, 2008, 12:02:51 PM »
Quote
I don't know how to make it change direction when the flames set off.
[/COLOR][/COLOR]
Gig, How are you controlling the flames?
Smart zone(looks like it), timer, situation?
 
Can you send me the py?
 
..
Input is appreciated. :)
-Arrogance is a quantity devoid of quality...
-As a client once told me "This is my story, and it's sticking to me!"
-Relationships these days are like the 'Arrival' section of the airport: a lot of baggage is being revealed in one place, and not a lot of it is being correlated to its real owners...

Offline Gigafrost

  • *
  • Posts: 805
  • Rep: 0
  • You'll never know what I'll think of next.
    • View Profile
    • Awards
Py Help... Making Claws Change Direction.
« Reply #2 on: November 02, 2008, 12:26:00 PM »
Yeah Here it is:

https://gametechmods.com/uploads/files/clawtop-reversedirection.zip

I am using the smartzone method. I basically changed only one value (the 100 one) from the stock clawtop, but every time I try to put an "else:" or "if on:" variable too add an opposite command, the arena doesn't show up in the game.

Offline Madiaba

Py Help... Making Claws Change Direction.
« Reply #3 on: November 02, 2008, 01:16:10 PM »
Anything coding under Init or Hazards, is loaded and set at the start(not changable).
If you want to alter these, then you need to pull the desired parts into Tick, ZoneEvent, etc., so that it is controllable during the game...
----------------------

Gig, There are many ways to set this up. So how exactly HOW do you want it to work?
Examples: When a bot hits a certain (or any) zone it makes:
1. a certain (or all) claw(s):
....a. turn a certain way continuously.
....b. turn a certain way temporarily(while in the zone).
....c. turn a certain way temporarily(until the zone is entered again).
 
Let me know and we'll go through the coding.
Input is appreciated. :)
-Arrogance is a quantity devoid of quality...
-As a client once told me "This is my story, and it's sticking to me!"
-Relationships these days are like the 'Arrival' section of the airport: a lot of baggage is being revealed in one place, and not a lot of it is being correlated to its real owners...

Offline Gigafrost

  • *
  • Posts: 805
  • Rep: 0
  • You'll never know what I'll think of next.
    • View Profile
    • Awards
Py Help... Making Claws Change Direction.
« Reply #4 on: November 02, 2008, 01:38:51 PM »
Oh ok, c. would suit me best for this arena.

Offline Madiaba

Py Help... Making Claws Change Direction.
« Reply #5 on: November 02, 2008, 01:57:55 PM »
OK. BRB.
Input is appreciated. :)
-Arrogance is a quantity devoid of quality...
-As a client once told me "This is my story, and it's sticking to me!"
-Relationships these days are like the 'Arrival' section of the airport: a lot of baggage is being revealed in one place, and not a lot of it is being correlated to its real owners...

Offline Madiaba

Py Help... Making Claws Change Direction.
« Reply #6 on: November 02, 2008, 02:01:42 PM »
Here, try this:
clawtop_Reversing_Claw]clawtop_Reversing_Claw
 
(Just put the py in the 'Arenas' folder)
 
Note how it works...
..[/URL]
Input is appreciated. :)
-Arrogance is a quantity devoid of quality...
-As a client once told me "This is my story, and it's sticking to me!"
-Relationships these days are like the 'Arrival' section of the airport: a lot of baggage is being revealed in one place, and not a lot of it is being correlated to its real owners...

Offline Gigafrost

  • *
  • Posts: 805
  • Rep: 0
  • You'll never know what I'll think of next.
    • View Profile
    • Awards
Py Help... Making Claws Change Direction.
« Reply #7 on: November 02, 2008, 04:09:39 PM »
Very Nice! Ok I am starting to understand how to do this. However I noticed that only 1 side of the flames work? It could be just me.

Never mind I got you. Thanks a lot!

Offline Somebody

  • *
  • Posts: 7201
  • Rep: 13
  • CP: +2
    • View Profile
    • Awards
Py Help... Making Claws Change Direction.
« Reply #8 on: November 03, 2008, 05:21:44 AM »
Would there be a way to make an arena work like the real battlebots arena.
Example: Someone does an AI tourney, and they operate the hazards.
I built that big robot on that TV show that time


Offline Gigafrost

  • *
  • Posts: 805
  • Rep: 0
  • You'll never know what I'll think of next.
    • View Profile
    • Awards
Py Help... Making Claws Change Direction.
« Reply #9 on: November 03, 2008, 08:20:35 AM »
Possibly... But that may need to be based on an input command of some sort.

example: A sketchy algorithm

Do Load Player 1-4 and/or AI

Do Tick/Timer command:
-If input button "Spacebar" is activated
-Activate Hammer in x direction with y speed and z power
else

Deactivate Hammer


There are many games created from pure python or c++ so it could be done.

Offline Clickbeetle

  • *
  • Posts: 3374
  • Rep: 21
  • In Soviet Russia, bugs stomp YOU!
  • Awards BOTM Winner
    • View Profile
    • Beetle Bros site
    • Awards
Py Help... Making Claws Change Direction.
« Reply #10 on: November 05, 2008, 11:25:28 PM »
Madiaba has exhausted his very extensive Python knowledge to try and make keyboard inputs work, with no success.  The game just doesn't register the keyboard.

To lack feeling is to be dead, but to act on every feeling is to be a child.
-Brandon Sanderson, The Way of Kings