gametechmods

Robot Arena => General Support => Topic started by: Gigafrost on November 02, 2008, 10:01:30 AM

Title: Py Help... Making Claws Change Direction.
Post by: Gigafrost 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?
Title: Py Help... Making Claws Change Direction.
Post by: Madiaba 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?
 
..
Title: Py Help... Making Claws Change Direction.
Post by: Gigafrost 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.
Title: Py Help... Making Claws Change Direction.
Post by: Madiaba 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.
Title: Py Help... Making Claws Change Direction.
Post by: Gigafrost on November 02, 2008, 01:38:51 PM
Oh ok, c. would suit me best for this arena.
Title: Py Help... Making Claws Change Direction.
Post by: Madiaba on November 02, 2008, 01:57:55 PM
OK. BRB.
Title: Py Help... Making Claws Change Direction.
Post by: Madiaba on November 02, 2008, 02:01:42 PM
Here, try this:
clawtop_Reversing_Claw (http://www.madiaba.gametechmods.com/clawtop_Reversing_Claw.rar)]clawtop_Reversing_Claw (http://www.madiaba.gametechmods.com/clawtop_Reversing_Claw.rar)
 
(Just put the py in the 'Arenas' folder)
 
Note how it works...
..[/URL]
Title: Py Help... Making Claws Change Direction.
Post by: Gigafrost 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!
Title: Py Help... Making Claws Change Direction.
Post by: Somebody 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.
Title: Py Help... Making Claws Change Direction.
Post by: Gigafrost 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.
Title: Py Help... Making Claws Change Direction.
Post by: Clickbeetle 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.