Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
In Need of A.I. code !!!!!
Old
CallowGenius
Guest
 
Status:
Posts: n/a
Default In Need of A.I. code !!!!! - 10-27-2009, 08:42 PM

what i have:
-a few enemies
-a protagonist character
-an object representing a piece of technology

what i need (thats where you come in):
-the enemies are constantly trying to obtain the tech
-however, if the enemies come within 2 meters of the protagonist, and the player presses space, the enemy moves backwards 3 meters.
-the enemy shakes off the daze, and continues to get the object
-when the enemies reach the tech, they carry it back to a hole.
-if the protagonist comes within 2 meters of them, and presses space, they scatter 3 meters away leaving the object.
-once the protagonist touches the tech, he wins. with the enemies stopping where they are, and the protagonist lifting the tech in his mighty glory.


i need help with the aliens obtaining and dropping the tech, and with the space press and stuff. please help.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 10-27-2009, 10:11 PM

Try something like this for the alien's movement:

While alien is at least .5 meters from tech and daze == false
Alien move .05 meters duration 0 seconds towards tech

Tech set vehicle to alien
Alien turn to face hole

While alien is at least (hole's width) away from hole
alien move .05 meters duration 0 seconds towards tech

And this for when the player hits space:

If player is within 2 meters of alien
daze set value to true
alien move 3 meters away from player duration .5 seconds
else
do nothing

Then add a "when a variable changes" event which looks like this:

if daze == false
do nothing
else
wait 3 seonds
daze set value to false

Now, you'll have to write this code out yourself, copy the alien movement method to all three aliens, and there may be a few things you need to change to make it work smoothly (that's where YOU come in). If you have any other questions though, feel free to ask.


(')>
   
Reply With Quote
Old
xxledzeppelin2x3
Guest
 
Status:
Posts: n/a
Default 11-01-2009, 04:49 PM

nice job x2495, that is one great and easy to understand explanation
   
Reply With Quote
Old
CallowGenius
Guest
 
Status:
Posts: n/a
Default 11-01-2009, 09:27 PM

Quote:
Originally Posted by x2495iiii View Post
Try something like this for the alien's movement:

While alien is at least .5 meters from tech and daze == false
Alien move .05 meters duration 0 seconds towards tech

Tech set vehicle to alien
Alien turn to face hole

While alien is at least (hole's width) away from hole
alien move .05 meters duration 0 seconds towards tech

And this for when the player hits space:

If player is within 2 meters of alien
daze set value to true
alien move 3 meters away from player duration .5 seconds
else
do nothing

Then add a "when a variable changes" event which looks like this:

if daze == false
do nothing
else
wait 3 seonds
daze set value to false

Now, you'll have to write this code out yourself, copy the alien movement method to all three aliens, and there may be a few things you need to change to make it work smoothly (that's where YOU come in). If you have any other questions though, feel free to ask.
How do I set those values to false/true? why are they values? Im creating them as methods. Should they be functions?
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 11-01-2009, 10:54 PM

Oh. I'm saying you should create a boolean variable which is named something like daze, dazeTrue, or something like that, then have that variable set its value to true when the daze method is called, and false when its done.


(')>
   
Reply With Quote
Reply

Tags
a.i., artificial, if and else, intelligence, robot

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2021, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.