Pawns attacking pawns
Pawns attacking pawns
Ok, here it goes:
I am trying to make a battlefield where team A finds the nearest Team B player, and will attack them, but if they are attacked they attack the one who is attacking them (And the same with team B), I know it has to do with the distance finding function (the name escapes me) and making it go to an order if it is true... could someone tell me the functions that would be used to create this?
If it takes a while it's ok, I still need to make the models for the game!
I am trying to make a battlefield where team A finds the nearest Team B player, and will attack them, but if they are attacked they attack the one who is attacking them (And the same with team B), I know it has to do with the distance finding function (the name escapes me) and making it go to an order if it is true... could someone tell me the functions that would be used to create this?
If it takes a while it's ok, I still need to make the models for the game!
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawns attacking pawns
I asked the same question and Juutis helped me out,I couldn't find the topic,but I think it's name was "Here's A Hard One" look for it,not very much time passed since I asked it.
Re: Pawns attacking pawns
So this is the topic here?
http://www.realityfactory.info/forum/vi ... A+Hard+One
With the perfectai.s? (quite a long script I feel sorry for the person who wrote it ) So I would just change HostileDifferent to true, or is it more complicated (if it isn't, yay! )
http://www.realityfactory.info/forum/vi ... A+Hard+One
With the perfectai.s? (quite a long script I feel sorry for the person who wrote it ) So I would just change HostileDifferent to true, or is it more complicated (if it isn't, yay! )
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawns attacking pawns
It's more complicated,I think it's already done,I've changed HostileDifferent to true,and there was no effect,it's too late and I can't think now maybe in the morning I'll be able to help.. ,sorry it's just..my mind is gone aay I'm so sleepy right now.
Try reading the topic,I think that all will get clear to you,Juutis explains really well how the scripts work,I've learned a lot from him so far!
Try reading the topic,I think that all will get clear to you,Juutis explains really well how the scripts work,I've learned a lot from him so far!
Re: Pawns attacking pawns
Ok, time to crawl over that impossibly long script!
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Re: Pawns attacking pawns
So basically, you are trying to create a pawn that switches to attacking different pawns and the player. I have a similar system in my game which I used for my scripted player as an auto targeting function. The way I did it however is a very long and sloppy, and I'm sure there is an easier way, but here it is anyways:
Firstly, you need to set your pawns field of view. Do this in your setup or spawn order by adding this command SetFOV(90); the brackets must contain the ammount in degrees that you want your pawn's visible to be.
Add this command to the pawn most frequently executed order eg. the run or idle orders:
Then add this order to your script:
You will need to give the pawns you want to be attacked the entitynames: enemy1, enemy2, enemy3 (however many you want), just make sure that none of the pawns share the same entityname. Once you've done that, then you just add the IsEntityVsible command along with the SetTarget command to the newtarget order (as above) and bobs your uncle. Basically what the newtarget order does is check to see if your pawn can see the the entity with the specified entityname and if it returns true, set that entity to be the current target. What makes this process long is the fact that you have to define every single entity that you want to be a possible target into the newtarget order.
I don't know what your script looks like, but bear in mind that this was run from low level orders in my script. Hope this helps...
Firstly, you need to set your pawns field of view. Do this in your setup or spawn order by adding this command SetFOV(90); the brackets must contain the ammount in degrees that you want your pawn's visible to be.
Add this command to the pawn most frequently executed order eg. the run or idle orders:
Code: Select all
if(self.enemy_vis=false)
{
newtarget();
}
Code: Select all
newtarget[ ()
{
if(IsEntityVsible("enemy1"))
{
SetTarget("enemy1");
}
if(IsEntityVsible("enemy2"))
{
SetTarget("enemy2");
}
if(self.enemy_vis = false)
{
SetTarget("");
}
}]
I don't know what your script looks like, but bear in mind that this was run from low level orders in my script. Hope this helps...
A good warrior knows his limits, but a great warrior finds his way around them.
Re: Pawns attacking pawns
Sorry, I almost forgot! If you want to target the player, simply change in the SetTarget("enemy#") command in the newtarget order to SetTarget("Player").
A good warrior knows his limits, but a great warrior finds his way around them.
Re: Pawns attacking pawns
TargetPlayer();Masta_J wrote:Sorry, I almost forgot! If you want to target the player, simply change in the SetTarget("enemy#") command in the newtarget order to SetTarget("Player").
Dunno if it's always the case but for me SetTarget("Player") wouldn't work.
Pain is only psychological.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Pawns attacking pawns
Yeah, TargetPlayer(); is the one which works.
Re: Pawns attacking pawns
Thank you very much... I don't really fret over long scripts, they don't take up too much space (like the GML coding, that has every single function planned out and everything... no fun at all, and I like fun! At least I hope so )
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Re: Pawns attacking pawns
Isn't there a funtion to find a pawn with a certain variable? I remember something about finding a target wit "enemy_health" or something in the maual or Making 3D games with Reality Factory.
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56
Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56