some quick questions pertaining to ai.
- fps
- Posts: 504
- Joined: Mon Sep 26, 2005 9:54 pm
- Location: in a magical land devoid of hope, happiness, and sanity.
some quick questions pertaining to ai.
i dont have my script in front of me but i know basically how it works, cause i wrote it.
my pawns process a list of 10 possible enemies on a map.
for example.
foe1 - foe10
I have a problem were pawns attack dead foes, this is a problem that breaks the feel of my game entirly. what i need is one of two solutions.
Either way i need the pawn to check the current targets health.
My problem is that i dont know how to do that part. can someone help me?
solution1; if pawn is visible and health is > 0 then attack. else goto either idle or alert for further serching.
solution2; check current targets health, if current targets health = 0 then take its name off the list of enemies alive.
how would i do a list of name to check that can have name taken off of it?
i have never done that before but it would be usefull.
thanks,
fps
my pawns process a list of 10 possible enemies on a map.
for example.
foe1 - foe10
I have a problem were pawns attack dead foes, this is a problem that breaks the feel of my game entirly. what i need is one of two solutions.
Either way i need the pawn to check the current targets health.
My problem is that i dont know how to do that part. can someone help me?
solution1; if pawn is visible and health is > 0 then attack. else goto either idle or alert for further serching.
solution2; check current targets health, if current targets health = 0 then take its name off the list of enemies alive.
how would i do a list of name to check that can have name taken off of it?
i have never done that before but it would be usefull.
thanks,
fps
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
I remember comming across the following command in the manual:
As far as a list of names, you could create an array such as:
You can set each element in the array to either 0 or 1 depending if somethign is dead or alive. You can assign values to the array like so:
Possible_TargetArray[0]=value for the first element
Possible_TargetArray[1]=value for the second element
Possible_TargetArray[2]=value for the third element
Seems like this will do itint EnemyExist(char *Attribute);
Returns the state of the current target. If the target actor has been removed from
the level it will return a 0. If the target doesn't have Attribute then it will return a 1.
If the value of Attribute is 0 or less it will return a 2. Otherwise it will return a 3. A
summary: if this function returns a 0 or 1 then the target is gone or of no interest
to the Pawn. A return value of 2 means the target is dead and the body still is
visible. A return value of 3 means the target is alive.
As far as a list of names, you could create an array such as:
Code: Select all
PossibleTarget_Array
{
PossibleTarget_Array0 [0]
PossibleTarget_Array1 [0]
PossibleTarget_Array0 [0]
}
Possible_TargetArray[0]=value for the first element
Possible_TargetArray[1]=value for the second element
Possible_TargetArray[2]=value for the third element
- fps
- Posts: 504
- Joined: Mon Sep 26, 2005 9:54 pm
- Location: in a magical land devoid of hope, happiness, and sanity.
Code: Select all
AquireTargets[ ()
{
for enemynumber = 0 to 10
{
if(IsEntityVsible("friendly_" # enemynumber) and ("friendly_" # enemynumber).health > 1)
{
SetTarget("friendly_" # enemynumber);
debug(self.target_name);
}
}
} ]
cause it gets a phrase error.
Code: Select all
AquireTargets[ ()
{
for enemynumber = 0 to 10
{
if(IsEntityVsible("friendly_" # enemynumber))
{
SetTarget("friendly_" # enemynumber);
debug(self.target_name);
if(EnemyExist(HEALTHATTRIBUTE) = 3)
{
SetTarget("friendly_" # enemynumber);
}
if(EnemyExist(HEALTHATTRIBUTE) = (0 or 1 or 2))
{
SetTarget(none);
return 0;
}
}
}
} ]
it runs but the enemy still attacks dead targets.
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
- fps
- Posts: 504
- Joined: Mon Sep 26, 2005 9:54 pm
- Location: in a magical land devoid of hope, happiness, and sanity.
Re: some quick questions pertaining to ai.
its always worked before, i have this in a different order.
its long but it works.
the other piece of code is so short, I did just add the "player" part to it could that be it?
Code: Select all
if((firetimer < self.time) and (GetCollideDistance("Bip01 R Hand",0,0,100000) > 50) and facing_ideal() and (bullets > 0) and (TraceToActor("Bip01 R Hand", GetBoneX(self.target_name, "Bip01"), GetBoneY(self.target_name, "Bip01"), GetBoneZ(self.target_name, "Bip01") + 1000) = (self.target_name or false or player or friendly_1 or friendly_2 or friendly_3 or friendly_5 or friendly_6 or friendly_7 or friendly_8 or friendly_9 or friendly_10)))
the other piece of code is so short, I did just add the "player" part to it could that be it?
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
- fps
- Posts: 504
- Joined: Mon Sep 26, 2005 9:54 pm
- Location: in a magical land devoid of hope, happiness, and sanity.
Re: some quick questions pertaining to ai.
is there really no one who can help me with this?
These fourms have been so quiet latley.
i hope this is not a sign of things to come.
These fourms have been so quiet latley.
i hope this is not a sign of things to come.
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
Re: some quick questions pertaining to ai.
What is your "phrase error" that you mentioned?
What do your debug statments say?
eg. Does the debug list all the entities it sees when AquireTargets() runs?
Also the way your code stands now, it will loop through all the entities, setting each as a target, then setting the next one as a target instead.
Idealy once you have a target you should break out of the loop.
What do your debug statments say?
eg. Does the debug list all the entities it sees when AquireTargets() runs?
Also the way your code stands now, it will loop through all the entities, setting each as a target, then setting the next one as a target instead.
Idealy once you have a target you should break out of the loop.
Re: some quick questions pertaining to ai.
Hey FPS, this does seem to be a fairly small community these days but I personally love RF because I think it has the best balance of ease and power, and I've tried pretty much everything out there. I'd only say RPGToolkit (http://www.toolkitzone.com) is easier to use if you want to make a 2D rpg, but for anything else, especially a 3d game RF wins it for me hands down, so the few of us will just have to help eachother.
If you can upload your game and have it set-up to run at the event you're trying to debug I can take a look at it and figure out what's wrong. It's very hard to do it from just code alone but if I'm able to try different things I think I'll be able to come up with some sort of solution eventually, so if you want to try that you can either post it here or PM me.
If you can upload your game and have it set-up to run at the event you're trying to debug I can take a look at it and figure out what's wrong. It's very hard to do it from just code alone but if I'm able to try different things I think I'll be able to come up with some sort of solution eventually, so if you want to try that you can either post it here or PM me.
- vrageprogrammer
- Posts: 566
- Joined: Wed Oct 31, 2007 2:59 pm
- Location: On top of a tree
- Contact:
Re: some quick questions pertaining to ai.
Hey, I've used Rpg toolkit, and it's kinda COOl.Juryiel wrote:Hey FPS, this does seem to be a fairly small community these days but I personally love RF because I think it has the best balance of ease and power, and I've tried pretty much everything out there. I'd only say RPGToolkit (http://www.toolkitzone.com) is easier to use if you want to make a 2D rpg, but for anything else, especially a 3d game RF wins it for me hands down, so the few of us will just have to help eachother.
If you can upload your game and have it set-up to run at the event you're trying to debug I can take a look at it and figure out what's wrong. It's very hard to do it from just code alone but if I'm able to try different things I think I'll be able to come up with some sort of solution eventually, so if you want to try that you can either post it here or PM me.
And you want to the forums to be active?
Wait and watch.
VRage is BACK!
It was not Possible to determine the dimensions of the image....
- fps
- Posts: 504
- Joined: Mon Sep 26, 2005 9:54 pm
- Location: in a magical land devoid of hope, happiness, and sanity.
Re: some quick questions pertaining to ai.
shadow,
yes my cade does debug the name of the entity it sees, but what do you mean it sets the target to the next one?
it is supposed to continually check for targets even when we have a target.
i am not in front of my computer but wehn i am tomorrow i will try to answer more.
Juryiel,
i will try to get that to you, asap
oops got to go i have class,
later
yes my cade does debug the name of the entity it sees, but what do you mean it sets the target to the next one?
it is supposed to continually check for targets even when we have a target.
i am not in front of my computer but wehn i am tomorrow i will try to answer more.
Juryiel,
i will try to get that to you, asap
oops got to go i have class,
later
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
Re: some quick questions pertaining to ai.
If you have a valid target why do you need to keep looking for another?
Perhaps if you post your code it would make more sense or give a clearer picture.
Perhaps if you post your code it would make more sense or give a clearer picture.
- fps
- Posts: 504
- Joined: Mon Sep 26, 2005 9:54 pm
- Location: in a magical land devoid of hope, happiness, and sanity.
Re: some quick questions pertaining to ai.
the reason for this is there are multiple targets on the screen, i want to make sure that the pawn targets whatever is visible.
I'll post the script today.
I'll post the script today.
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
- fps
- Posts: 504
- Joined: Mon Sep 26, 2005 9:54 pm
- Location: in a magical land devoid of hope, happiness, and sanity.
Re: some quick questions pertaining to ai.
ok, in clss i just learned that you can do an array search. can i do this in rf?
I am thinking of returning a list from the origional of all the atrgets that are dean and all the targets that are visible and such. mabey i dont need to do a search but if there is an easier way then let me know.
also shadow, do you mean that i have to set the target to foenumber - 1 because it continues counting so it moves one past the visible target?
I am thinking of returning a list from the origional of all the atrgets that are dean and all the targets that are visible and such. mabey i dont need to do a search but if there is an easier way then let me know.
also shadow, do you mean that i have to set the target to foenumber - 1 because it continues counting so it moves one past the visible target?
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.
2 wrote:
You say that like it's a bad thing.
1 wrote:
You are a bad thing.
Re: some quick questions pertaining to ai.
what you might want to try and do is set a true/false.
So...
if (PossibleTarget_Array[0] = false) or something to that nature.
So when the enemy is shot then you set the enemy's alive status to false. So then you just have it check what that value is then make its decision accordingly.
Maybe I made sense?
So...
if (PossibleTarget_Array[0] = false) or something to that nature.
So when the enemy is shot then you set the enemy's alive status to false. So then you just have it check what that value is then make its decision accordingly.
Maybe I made sense?
Jonas
Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack
Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it. If you aren't sure which way to do something, do it both ways and see which works better. - John Carmack