Forum Archive

Go Back   3D Realms Forums > 3D Realms Topics > Duke Nukem > Duke Nukem 3D Modifications
Blogs FAQ Community Calendar

Notices

 
 
Thread Tools
Old 06-25-2001, 07:53 PM   #1
Guest
Guest
Working on Bot, CON help?
Ok, I am in no way a newbie. I know how to CON edit fairly (Notice FAIRLY) well and I made a bot before. However, the bot I made for REGULAR Duke3D only shoots in one direction.

In EDuke I am attempting to use the new and wonderful features in CON to make him target specific monsters. Not knowing how to use EDuke's new features in the way I want to use them, I came here for some guidance.

Here are my questions:

1) How do I use 'findnearactor' in order to make my Bot seek out (For sake of example) a Liztroop? What do I put as the type, just 'LIZTROOP'?

2) Next, what do I need to go after 'findnearactor' to make him face it? Kind of like faceplayer but for the target in mind?

3) When all Liztroops are dead in the sector (Since it is a sector based code), what do I need to put in the code that will make him stop and wait, scanning for new targets?

4) I've been trying to make the Bot have a death animation, but no matter what I do, the guy just explodes. I've tried calling an action, starting up an ai, or calling a state. I even tried cactor with a actor that simply died. None of it has worked. Can someone show me how to (Simply) make a useractor have a death animation? I even tried copying what the Liztroop did when he died and utilizing it in my code.

Thanks in advance for any help received.

Also, is it possible I could get a copy of 2.1? I asked Matt for it when there was still a Dukeworld UBB Forum, but he never replied...Matt?
 
Old 06-26-2001, 01:20 PM   #2
cyborg

cyborg's Avatar
Re: Working on Bot, CON help?
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Predator120:
[QB]1) How do I use 'findnearactor' in order to make my Bot seek out (For sake of example) a Liztroop? What do I put as the type, just 'LIZTROOP'?<HR></BLOCKQUOTE>

Actor and range are the parameters I believe.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>
2) Next, what do I need to go after 'findnearactor' to make him face it? Kind of like faceplayer but for the target in mind?
<HR></BLOCKQUOTE>

Using trigonometry. The angle from one point to another using ARCTAN is:

angle = arctan y1-y2/x1-x2

The angle is the arctan of the gradient of the line in the xy plane. If you need the elavation repeat in the z plane.

Well I'm going to assume some mathmatical competense if you can write CONs.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>
3) When all Liztroops are dead in the sector (Since it is a sector based code), what do I need to put in the code that will make him stop and wait, scanning for new targets?
<HR></BLOCKQUOTE>

It's not sector based. Ignore the FAQ. Matteus changed it.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>
4) I've been trying to make the Bot have a death animation, but no matter what I do, the guy just explodes.
<HR></BLOCKQUOTE>

It simply sounds like your code is wrong to me. There's no need for any Eduke code at all. ifhitweapon and action should do.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Also, is it possible I could get a copy of 2.1? I asked Matt for it when there was still a Dukeworld UBB Forum, but he never replied...Matt?<HR></BLOCKQUOTE>

EMAIL HIM!!! He said enough times that people should email him.
__________________
You lose.
cyborg is offline  
Old 06-26-2001, 01:56 PM   #3
Guest
Guest
Re: Working on Bot, CON help?
Thanks Cyborg. I appreciate that.

Yeah I guess I missed something in my code, I'll start again from scratch.

Since it isn't a sector based code, I can't do it? Or just have it so if he can't see his target he can't shoot?

Thanks again.
 
Old 06-26-2001, 02:13 PM   #4
cyborg

cyborg's Avatar
Re: Working on Bot, CON help?
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Predator120:
Since it isn't a sector based code, I can't do it? Or just have it so if he can't see his target he can't shoot?<HR></BLOCKQUOTE>

Use a traceline either by the ridiculously complex route (which basically involves rewriting the code in Build for the second method in the CONs) or by using an instant projectile to test the path of the shot.
__________________
You lose.
cyborg is offline  
Old 06-26-2001, 03:26 PM   #5
Guest
Guest
Re: Working on Bot, CON help?
Ok, I went into EDuke and started writing up my code, but I realized I didn't really know how to put the ARCTAN into code the way I wanted to. Do I just use a bunch of different variables? Could you give me an example of what you mean?

I did say I know how to do it fairly well, but I get lost easily...

Will the 'findnearactor' actually work? Also, there is a third value needed for it: findnearactor <type> <maxdist> <actorID>

What do I put in for the ActorID? I put findnearactor LIZTROOP 81920, but what do I put in the ActorID part?

Basically, I want my bot to do the following things:

1) Scan for a Liztroop.
2) Face him at all times (Until he is dead) and then face the next Liztroop.
3) While facing the Liztroop he will shoot SHOTSPARK1 and spawn shells.
4) When no more Liztroops are around or visible, the bot will stay ducked and wait for a new target.

How do I go about doing this? Is there anything I mentioned that just can't be done?

It would REALLY help if you showed examples instead of just saying things. You can't assume I am as good as you. Or if there is a CON guide for EDuke which would help?

Thanks.
 
Old 06-26-2001, 04:14 PM   #6
cyborg

cyborg's Avatar
Re: Working on Bot, CON help?
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Predator120:
Ok, I went into EDuke and started writing up my code, but I realized I didn't really know how to put the ARCTAN into code the way I wanted to. Do I just use a bunch of different variables? Could you give me an example of what you mean?
<HR></BLOCKQUOTE>

You need to create a table of values that will convert a range of arctan values into build angle units:

ifvarg ARCTAN 1 setvar ANGLE 45

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Is there anything I mentioned that just can't be done?<HR></BLOCKQUOTE>

No.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>
It would REALLY help if you showed examples instead of just saying things. You can't assume I am as good as you. Or if there is a CON guide for EDuke which would help?
<HR></BLOCKQUOTE>

I'm sure it would but you can't assume I have as much time to idle away as you do.

As I have often said before there is a dirty great big text file that comes with the bloody thing. Read it.
__________________
You lose.
cyborg is offline  
Old 06-26-2001, 08:12 PM   #7
Guest
Guest
Re: Working on Bot, CON help?
I did read the thing. It didn't help.
 
Old 06-26-2001, 08:13 PM   #8
Mblackwell

Mblackwell's Avatar
Re: Working on Bot, CON help?
The fact that your bot explodes in blood when you don't want to infers something to me... you didn't program it from scratch, you're just modifying. Am I right? Cause if you do it from scratch there's no way that would happen outside of your control.

*sigh*
__________________
I don't wanna be like other people are
Don't wanna own a key, don't wanna wash my car
Don't wanna have to work like other people do
I want it to be free, I want it to be true

Eduke32.com : The Rejected Applications : The Meadhall of the Comitatus
Mblackwell is offline  
Old 06-27-2001, 04:09 PM   #9
Guest
Guest
Re: Working on Bot, CON help?
mblackwell-

Actually, cyborg was right. It was a small mistake in my code. I forgot to call for the action in one of my states. I fixed it and worked out a few things and it works just fine.

cyborg-

Here is my table:

onevent EVENT_ENTERLEVEL
gamevar TARGET LIZTROOP 0
gamevar ARCTAN 0 0
gamevar ANGLE 0 2
{
ifvarg ARCTAN 0 setvar ANGLE 0
ifvarg ARCTAN 1 setvar ANGLE 45
ifvarg ARCTAN 2 setvar ANGLE 90
ifvarg ARCTAN 3 setvar ANGLE 135
ifvarg ARCTAN 4 setvar ANGLE 180
ifvarg ARCTAN 5 setvar ANGLE 225
ifvarg ARCTAN 6 setvar ANGLE 270
ifvarg ARCTAN 7 setvar ANGLE 315
}
{
ifvarg ANGLE 0 setactor[THISACTOR].ang ANGLE
ifvarg ANGLE 45 setactor[THISACTOR].ang ANGLE
ifvarg ANGLE 90 setactor[THISACTOR].ang ANGLE
ifvarg ANGLE 135 setactor[THISACTOR].ang ANGLE
ifvarg ANGLE 180 setactor[THISACTOR].ang ANGLE
ifvarg ANGLE 225 setactor[THISACTOR].ang ANGLE
ifvarg ANGLE 270 setactor[THISACTOR].ang ANGLE
ifvarg ANGLE 315 setactor[THISACTOR].ang ANGLE
}
endevent

Is that the general idea of things? I know I'm probably missing a lot, but there's my table.

Now, how can I utilize all of that to make the actor face the Liztroop and shoot at him. Do I do that through more variables or do I do that with setactorangle?
 
Old 06-27-2001, 04:27 PM   #10
cyborg

cyborg's Avatar
Re: Working on Bot, CON help?
Erm, the second part of the table is about as useful as a chocolate fireguard but yes that's the general idea.
The figures I wrote were also completely and utterly plucked from the air. To get a good table you'll need to mutliply the x,y values before deriving the gradient to avoid getting excessive fractional values otherwise you'll find there's barely any variation in your code per angle.
Also you won't need every angle in the table because the tangent repeats and you'll need to remember that there are 2048 units in a build rotation.

Now how you use it is your problem, the part most people will have problems with is understanding the basic maths for getting the angle between two points, making the arctan table, and optimising it (because there are no fractional values and a repeating period).
__________________
You lose.
cyborg is offline  
Old 06-27-2001, 07:22 PM   #11
Mblackwell

Mblackwell's Avatar
Re: Working on Bot, CON help?
ugh, more stupid assed state based enemies...

also, you can get fractional values by using division, but that's hell.

obviously:

setvar HALF 1
divvar HALF 2

but it can get pretty hairy.
__________________
I don't wanna be like other people are
Don't wanna own a key, don't wanna wash my car
Don't wanna have to work like other people do
I want it to be free, I want it to be true

Eduke32.com : The Rejected Applications : The Meadhall of the Comitatus
Mblackwell is offline  
Old 06-28-2001, 02:24 AM   #12
cyborg

cyborg's Avatar
Re: Working on Bot, CON help?
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mblackwell:
ugh, more stupid assed state based enemies...

also, you can get fractional values by using division, but that's hell.

obviously:

setvar HALF 1
divvar HALF 2

but it can get pretty hairy.
<HR></BLOCKQUOTE>

I'm sure I've told you before that ALL the variables are 32bit numbers NOT floating point variables so the result of your calculation will either be 1 or 0 depending on how it's rounded.

So in short, you CANNOT have fractional values which is why you must increase the scale for trig calculations (sine and cosine take place within -1 +1 range).
__________________
You lose.
cyborg is offline  
Old 06-28-2001, 07:42 AM   #13
Mblackwell

Mblackwell's Avatar
Re: Working on Bot, CON help?


[ 06-28-2001: Message edited by: Mblackwell ]
__________________
I don't wanna be like other people are
Don't wanna own a key, don't wanna wash my car
Don't wanna have to work like other people do
I want it to be free, I want it to be true

Eduke32.com : The Rejected Applications : The Meadhall of the Comitatus
Mblackwell is offline  
 

Bookmarks


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


All times are GMT -6. The time now is 12:34 PM.

Page generated in 0.14610291 seconds (100.00% PHP - 0% MySQL) with 18 queries

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

Website is ©1987-2014 Apogee Software, Ltd.
Ideas and messages posted here become property of Apogee Software Ltd.