Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 16th Mar 2005 09:43
i am wondering how to make and enemy, and make it walk around. i will add other things later, but ifi could just get it to move would be great. my code is there. if anyone could add an enemy, or help me out with this, i would greatly appreciate it.
Monty87
21
Years of Service
User Offline
Joined: 8th Dec 2003
Location: not very deep in the west country, eng
Posted: 18th Mar 2005 03:23
rotate it in a random direction, then make it walk in that direction for a random amount of time. then when it finishes redo.

Monty
iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 18th Mar 2005 06:27
how would i do that? could you post some code so i can see? i just need the basic idea, and i should be able to do the rest. thanks.
Ragnarok89
20
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 18th Mar 2005 07:12 Edited at: 18th Mar 2005 07:14
Hmmm...while I wait for someone to answer my post about collision boxes I guess I can try to find a way to wright a function for you to use or get the idea from, oh well shouldn't take me to long.

Oh yeah, you can figure out the A.I. stuff like attacking and stuff. I havn't even tried that stuff yet lol.
Ragnarok89
20
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 18th Mar 2005 07:44 Edited at: 18th Mar 2005 08:00
How about I just explain it instead .

Now so you dont ahve to type it over and over in your code Let's make it a function.

Function Enemymove(ob#)

That will be what you use in your code to tell it to move your object. After that you give it variables to decide what you want it to do.

MT#=0
YR#=RND()

Now on to the actualy command you want your object to do.You want to check to see if the object is moving or sitting still. If the object is sitting still you want it to rotate the object. Then If the Object Is still sitting still you want it to move the object forward. After that you want it to move the object for so long till the timer is 0. use some code like this...

If MT#=0 then MT#=5
If MT#=0 then YRotate Object ob#,YR#
If MT#>0 then Move Object ob#,4
If MT#>0 then MT#=MT#-.01

This Code will set the timer, rotate the object, move the object and slowly reduce the timer so it knows when to turn. This is the basic idea of walking and randomly turning. This may not work perfectly but I'm am still trying it out in my program. I will fix any problems and fix em here later.

This is the finished Code from above you will need to put at the end of your code OUTSIDE of the Do/Loop command

EDIT: Edited Code so it actually turns every so often. But for some reason it doesn't wait only when MT#=0 but also when MT#>0

iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 18th Mar 2005 07:44
that's cool, i just want to make him walk around first.
Ragnarok89
20
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 18th Mar 2005 08:32
Alright, I have Gotten this to where the object Walks in a random direction for a random amount of time between 0 and 4 secs (somewhere near there). It then Rotates and Immediatelly start walking in a random direction. I havn't gotten it to stop at the point it turns for a sec without completely stopping the program for that time. I will try and figure that out soon.

Heres the function.

Ragnarok89
20
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 18th Mar 2005 08:52
Alright. I have gotten more done on it finally, even though it really wasn't that long to do it lol. Anyways I will show you how to use this code for all the objects that you need to set this to because for some reason it won't let you just use the objects number you have to set a variable...blah blah blah.



Now Copy and paste this code AFTER your Do/Loop command.
After you do that Type the following in BEFORE your Do/Loop command...

MT#=0
ST#=0

Now in order to use this function for a object you need to put this INSIDE the Do/Loop command

ob#=10 `Change 10 to the object's number
Enemymove(ob#)

Alright you should be set. If any errors occur tell me and I'll fix em. (Jumps for joy cause he actually was helpful...YAY! ) lol.
iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 18th Mar 2005 10:33
wow, thanks. i'm trying it now.
iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 18th Mar 2005 11:06
it works, but he's not on the matrix, and isn't ising the "walk" animation. also, the counter appears in the corner, then moves quickly off the screen down. this is a lot farther than i thought i'd ever get though. thanks so much!
Mobiius
Valued Member
22
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Mar 2005 14:43
look in the codebase for my zombie ai code. That is full source for easy to use zombie AI.

1800+ XP - GeforceFX 5600 - 256MbDDR - 60Gb Hdd - XP Pro (SP2)
Ragnarok89
20
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 18th Mar 2005 22:10
Oops I forgot to load the animation lol. Add this after the if MT#>0 then move object line.

If MT#>0 then Loop Object ob#

This won't loop the animation perfect, it really isn't that hard to amke it do it though. Just sue the above command and add ,5,25 or so (5 is the starting frame and 25 is the looping frame.) Then it will play from frame 1 to the end and then loop between frame 5 and frame 25. If your usin that samari that comes with DBC then looping 5-25 will make him walk perfect.
iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 19th Mar 2005 09:29
ok, now the animation works, and i guess i'll have to guess on the animation frame thing until it works. how can i get him to walk on the matrix though? my character does fine, but my enemy won't/
iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 20th Mar 2005 01:20
i figured out the frames for the idle and walk animations, but they won't go together. i can make him walk constantly, or idle constantly. how can i make him idle when he's not moving, then walk when he is moving?
Ragnarok89
20
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 20th Mar 2005 02:27
Hmmm, I think you would have to use a completely different function to check to see whether or not the object is moving. Also, you must load both idle.x and walk.x to different numbers. Then have it, if the objectis moving (MT#>0) then to hide the idle.x object and loop the walk.x number. And if object isn't moving (MT#=0) then hide object walk.x and loop object idle.x. I'll right up this function, or gosub command or something. Whichever I find it easier to write .
iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 20th Mar 2005 02:39
thanks for your help. i pretty new at all this, but i'm learning pretty fast. i messed around with some of the function too, but i guess i didn't do the right thing to make it work.
Ragnarok89
20
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 20th Mar 2005 02:41 Edited at: 20th Mar 2005 02:42
Hmmm, actually you made it easier. I forgot about the append object command so actually I can make this part of the old function hehe.

Anyways, I looked at your new source for the function and I think all the you would have to do is change this line....



with this...



This way instead of it always looping it, it will only loop when MT#=0 (No Movement).

Now for your other question. Making him walk ON the matrix.
To do this I think all that you need is put the following line within the Do/Loop command...



With this command, it will place the object wherever it is on the X-Axis, wherever it is on the Z-Axis and Above the Matrix Wherever it's current position is at. Hope that works. (Alsom on the get ground height (1,OPX1,OPZ1) the first 1 that is alone is the number of the matrix your using for your ground. I looked at the code and i think that was the right matrix. Try it with the one and if it doesn't work try the other matrix's number.)
iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 20th Mar 2005 02:59
thanks a lot. he's walking on the matrix now. but he still won't do both the idle and walk animations. i put the code snippet in, and i tried that before, and it still won't work right.
Ragnarok89
20
Years of Service
User Offline
Joined: 27th Jun 2004
Location: Look behind you! Ahhhh!~
Posted: 20th Mar 2005 03:20
Yeah, I tried it myself and it won't do the walk animations for the goblin. Plus I can't even append the samari model cause it says it can't for some reason.

Anyways, there is another way that you could do the animation with. Just write another Function To check whether MT#>0 or MT#=0. That's the simpler part I guess you could say if your a complete noobie lol. Hmmm...using those two command you could write another function like this.

Function Moveanime
If MT#>0 then Hide Object 2
If MT#>0 then Show Object 1
If MT#>0 then Loop Object 1,5,25
If MT#=0 then Hide Object 1
If MT#=0 then Show Object 2
If MT#=0 then Loop Object 2
Endfunction

But in order to make this work you will have to change a few things in your program.
1)Load the "idle.x" file as object 2.
2)Load the "walk.x" file as object 1.
3)Position Object 1 at Object 2's Position.

It should end up something like so...



Hopefully you can figure out what all to change to make this work. Try it out and ask if there is anything you need more help with.(Lol, I'm learning about as much as you.)
iplaybass
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location: illegally hacking into gov. networks
Posted: 20th Mar 2005 03:53 Edited at: 20th Mar 2005 09:16
the animation still doesn't work,but i'll figure something out, then post it again. thanks for all your help!

well, i've tried for a while now, and can't seem to get it to work. if anyone else has an idea, or anything, i'd appreciate it. if not, i'll keep trying.

Login to post a reply

Server time is: 2025-05-31 05:39:09
Your offset time is: 2025-05-31 05:39:09