Author Topic: Arena Help  (Read 1791 times)

Offline WhamettNuht

  • *
  • Posts: 1302
  • Rep: 12
  • Robot Building Drag Queen
    • View Profile
    • Awards
  • Discord: WhamettNuht #1457
Arena Help
« on: July 05, 2015, 01:46:59 PM »
Hi Guys,

I've been working on this lil' arena today and whilst I've learnt a few things that I've never been able to do before (e.g. the spikes I would never have been able to do) I've still hit a snag:-

The blades that I've added on the two walls don't spin... Originally 1 did (the other three didn't spin but could turn if you hit them) but then I shortened the height of the fence corners and now none of them spin plus my game lags when using the arena :L

Was wondering if someone could have a look at it all for me and let me know if I've done something wrong for future reference? :)

Here is said arena:
http://www.mediafire.com/download/hdmobbb0ixrmfcr/HELPME.rar

If someone wouldn't mind helping me and educating me as to where I went wrong I would be very grateful indeed ^-^

Thanks :)
Damn I should probably put something fancy in this bit huh?

Offline daleksec7

  • Heavyweight
  • Posts: 421
  • Rep: 8
  • Working hard
    • View Profile
    • Awards
Re: Arena Help
« Reply #1 on: July 05, 2015, 02:48:50 PM »
Got more than Ive done in arenas good job :3 as for helping not sure but still nice job :)

Offline Trovaner

  • *
  • Posts: 1222
  • Rep: 32
    • View Profile
    • Awards
Re: Arena Help
« Reply #2 on: July 14, 2015, 08:49:08 AM »
I just remembered that nobody answered your question...

Based on the fact that your hinges are spinning, your Arena.gmf is working.

In the Arena.py, I see two issues.
1. You need to define 4 variables instead of just 1 so that you can reference each Hinge individually. Right now, you are using "self.spinner" for all four of you hinges so only the last hinge would be accessible inside of the Tick method (since you are overwriting the reference to the hinge object each time).
2. You need to apply force every tick for the blade to spin continuously.

If this doesn't help, I can take a more thorough look at your code when I get home from work...

Offline WhamettNuht

  • *
  • Posts: 1302
  • Rep: 12
  • Robot Building Drag Queen
    • View Profile
    • Awards
  • Discord: WhamettNuht #1457
Re: Arena Help
« Reply #3 on: July 20, 2015, 07:38:49 AM »
Thanks for answering, Trov! However, you've kinda lost me...

1. I thought I would have done this already after looking through other PY codes? Would you mind going into more detail?
2. Again, would you mind going into more detail?

While I'm here, nothing to do with this arena but I have a few other arenas in production at the moment but the only thing thats holding me back is the whole PY coding. Every time I try to add or modify a hazard, the arena either doesnt show up in the Arena List or it causes the 'Beta Arena' glitch. Even changing the coordinates of the Collision Lines ends up making them null and void (they no longer work, despite being in the PY). Am I missing a trick here? If you would be able to go into more depth with this I would be really grateful!
Damn I should probably put something fancy in this bit huh?

Offline Trovaner

  • *
  • Posts: 1222
  • Rep: 32
    • View Profile
    • Awards
Re: Arena Help
« Reply #4 on: July 21, 2015, 03:30:49 AM »
1. You currently have something like this:
Code: [Select]
    def HazardsOn(self, on):
        self.spinner = self.GetHinge("Hinge01")
        self.spinner.SetAutoLocks(False, False)
        self.spinner.Lock(False)

        self.spinner = self.GetHinge("Hinge02")
        self.spinner.SetAutoLocks(False, False)
        self.spinner.Lock(False)

        self.spinner = self.GetHinge("Hinge03")
        self.spinner.SetAutoLocks(False, False)
        self.spinner.Lock(False)

        self.spinner = self.GetHinge("Hinge04")
        self.spinner.SetAutoLocks(False, False)
        self.spinner.Lock(False)

        self.prism = self.AddPrismatic("floor", "bladewall", 0, -1, 0, 0, 3, 0)
        self.prism.SetAutoLock(False)
        if on:
            self.SetSubMaterialSound("blade1", "metal", 2.0, "Sounds\\spinnerhit.wav")
            self.spinner.SetPowerSettings(150,68)
            self.spinner.SetDirection(-100)

            self.SetSubMaterialSound("blade2", "metal", 2.0, "Sounds\\spinnerhit.wav")
            self.spinner.SetPowerSettings(150,68)
            self.spinner.SetDirection(-100)

            self.SetSubMaterialSound("blade3", "metal", 2.0, "Sounds\\spinnerhit.wav")
            self.spinner.SetPowerSettings(150,68)
            self.spinner.SetDirection(-100)

            self.SetSubMaterialSound("blade4", "metal", 2.0, "Sounds\\spinnerhit.wav")
            self.spinner.SetPowerSettings(150,68)
            self.spinner.SetDirection(-100)

What I'm saying is that you should have something like this:
Code: [Select]
    def HazardsOn(self, on):
        self.spinner1 = self.GetHinge("Hinge01")
        self.spinner1.SetAutoLocks(False, False)
        self.spinner1.Lock(False)

        self.spinner2 = self.GetHinge("Hinge02")
        self.spinner2.SetAutoLocks(False, False)
        self.spinner2.Lock(False)

        self.spinner3 = self.GetHinge("Hinge03")
        self.spinner3.SetAutoLocks(False, False)
        self.spinner3.Lock(False)

        self.spinner4 = self.GetHinge("Hinge04")
        self.spinner4.SetAutoLocks(False, False)
        self.spinner4.Lock(False)

        if on:
            self.SetSubMaterialSound("blade1", "metal", 2.0, "Sounds\\spinnerhit.wav")
            self.spinner1.SetPowerSettings(150,68)
            self.spinner1.SetDirection(-100)

            self.SetSubMaterialSound("blade2", "metal", 2.0, "Sounds\\spinnerhit.wav")
            self.spinner2.SetPowerSettings(150,68)
            self.spinner2.SetDirection(-100)

            self.SetSubMaterialSound("blade3", "metal", 2.0, "Sounds\\spinnerhit.wav")
            self.spinner3.SetPowerSettings(150,68)
            self.spinner3.SetDirection(-100)

            self.SetSubMaterialSound("blade4", "metal", 2.0, "Sounds\\spinnerhit.wav")
            self.spinner4.SetPowerSettings(150,68)
            self.spinner4.SetDirection(-100)

Since "self.spinner" is just a variable, you could have called it anything but, by having them named the same, you are only setting the power and direction for the last spinner rather than all of them. This wouldn't have mattered if it weren't for the fact that you use object assigned to the variable again after the IF condition ("if on:").

It might help if I make an analogy... Let's say bikes can only hold one person at a time and there are 2 people that want to ride it to different destinations. If we followed the logic that you have than we would have one person get on a bike and immediately get off of it so that the next person can get on and go to their destination. If we follow my logic than we would have two bikes so that both people can go to their destinations. The bikes are our variables, the people are our hinges, and the destinations are the properties that we assign to our variable after the IF condition. This analogy kind of falls apart if you read too much into it but I hope it helps in getting my point across.

2. When I posted that, I was thinking you were going to have to make calls to ApplyTorque but, now that I think about it, I think there is a way of setting it up so that you don't need to tell it to spin once per Tick. IIRC, Mars Base Arena does something like the former with the rover's wheels. I'd suggest taking a look at that. Edit: I checked and it may be as simple as setting your autolocks so that the first value is False and the second value is True (I can't remember what these correspond to but this is how I did it in one of my custom arenas).

As for your other issues...
3. Having a blank arena list or missing arena usually means that there was a syntax error in your code.

4. When you add collision lines, the first two numbers represent the position of one end of the line while the second two numbers represent the position of the other end. The line between the two points acts as an "obstacle" to the AI that they will try not to cross. There isn't really much else to it. Perhaps you are mixing them up with POVs?