Help with States and Ai :)

thatoneguy117thatoneguy117 Member Posts: 31
edited November -1 in Working with GS (Mac)
Hey guys, this is an update of this thread: http://gamesalad.com/forums/topic.php?id=9939&replies=24#post-72531

(I started this new thread because I think the title of the old one put some people off and I really need help :D)

Problem:

Sorry, what I mean is I need it to change based off a set of commands I.E.

When attribute is above 240 change to state 1
When attribute is below 240 change to state 2
Etc.

The thing is I need it to be able to run the commands multiple times without having to change the attribute.

CodeMonkey Helped me with this and almost got it working.

I got it so it would change to state 0 and reload back to the other ones and this worked GREAT.

One problem though after the object that is chasing (state 1) change x and y coordinates via change attribute it no longer worked. So I need something that takes this into consideration with the other commands also, Thanks.


Here are some graphics of the problem:

image

image

image

image

image

image

image

image

Thanks again for the help I really appreciate it. :)

EDIT: Just realized the images came out kinda small, might need to zoom. Sorry :/

Comments

  • chosenonestudioschosenonestudios Member Posts: 1,714
  • thatoneguy117thatoneguy117 Member Posts: 31
    chosenonestudios said:

    ????

    Anybody? I could really use some help. I've been working on this for weeks. :/
  • chosenonestudioschosenonestudios Member Posts: 1,714
    thatoneguy117 said:
    ????

    Anybody? I could really use some help. I've been working on this for weeks. :/

    Sorry accidentally posted...
  • thatoneguy117thatoneguy117 Member Posts: 31
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Believe it or not I have really tried to rad your last thread carefully and try to understand exactly what the problem is, but for some reason I just am unable to visualize what you are trying to accomplish.

    Maybe a better description of what the gamer should experience when this AI system is working. In other words, what is the desired out come from the player's view point. I ask this because so far I have not been able to understand your descriptions that are from the developer's viewpoint.
  • thatoneguy117thatoneguy117 Member Posts: 31
    Ok, I'll try again.

    Im creating a simple Ai, basically air hockey..

    When its above 240 it activates a state, when its below 240 it also activates a state.

    The problem is it doesn't play the commands multiple times.

    When attribute is above 240 change state to 1

    When state = 1 move to bankety blank.

    The problem is it will only do this ONCE unless you change the state by making it go under 240. When it goes under 240 it changes to state 2. When it goes above 240 it will go back to state 2 and then it will work ONCE. This is the problem.

    EDIT: If theres is better way to build a AI PLEASE let me know. :)
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    so you are saying if I (the player) hit the puck the computer I am playing against defends and hits the puck back, but obviously it needs to be imperfect or the computer will always win.

    hmm... I'll think on it.
  • thatoneguy117thatoneguy117 Member Posts: 31
    Yeah basically, the problem is if I could get this to fire all the time I'd be done, but maybe I'm just not building it right...
  • JackBQuickJackBQuick Member Posts: 524
    Have you looked at the air hockey demos that are available?

    List of air hockey demos

    For example, eaguirre uploaded Tutorial: AI for Hockey recently. You can download the project, open it up, and see how he did it.
  • thatoneguy117thatoneguy117 Member Posts: 31
    Thanks Jack, I'll check it out.
  • thatoneguy117thatoneguy117 Member Posts: 31
    Hmmm doesn't seem to work for my game. Unfortunately :/ anybody else have suggestions?
  • victorkin11victorkin11 Member Posts: 251
    First problem I saw is what happen when it is 240 then what?

    state1 < 240 state? <state2

    Second, you need a timer to told the actor keep checking,
    if you can, you better use only one timer to active all the actor.
  • netdzynrnetdzynr Member Posts: 296
    If I understand what you're trying to do, I think you should use the position check/state to trigger a timer that repeatedly fires your action/event. There's no real repeat loop in GS, so you have to use a timer to accomplish this kind of thing.

    when attribute is > 240
    set state1 to true
    set state2 to false
    otherwise
    set state2 to true
    set state1 to false

    if state1 is true
    every X seconds
    do myRoutine1

    if state2 is true
    every x seconds
    do myRoutine2
  • Rob2Rob2 Member Posts: 2,402
    what you are trying to simulate is a 'do while' condition so you probably need some constrains in there? or timers as net says
  • thatoneguy117thatoneguy117 Member Posts: 31
    I tried doing that with the timers, but absolutely nothing happened. Like somehow it killed all the commands
  • thatoneguy117thatoneguy117 Member Posts: 31
    anybody???
  • thatoneguy117thatoneguy117 Member Posts: 31
    Anybody?
  • thatoneguy117thatoneguy117 Member Posts: 31
    Anybody???
  • thatoneguy117thatoneguy117 Member Posts: 31
    Anybody?
  • thatoneguy117thatoneguy117 Member Posts: 31
    Anybody
Sign In or Register to comment.