Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[2.2]Programmable AI via scripting
#71
Oh, I forgot that only "return 1" overwrites the original AI. Makes things a lot clearer, thanks!
Silverthorn / Blue Phoenix
~ Breaking LFE since 2008 ~

"Freeze, you're under vrest!" - Mark, probably.

» Gallery | » Sprites | » DeviantArt
Reply
Thanks given by:
#72
sorry, may I ask how to write the script so that the AI will do D>J when target is on his right and D<J when target is on his left? (no matter which direction they are facing) Thank you very much.
Reply
Thanks given by:
#73
Hi, of course you may :). Welcome to LFE. In the future you should make a separate thread for any questions you have (so this thread doesn't get cluttered).

You can do it by reading the x variable of self and target. If target.x > self.x then you should do DrJ() else you should do DlJ() . In code form this looks like this:

Code:
if (target.x > self.x)
{
    DrJ();
}
else
{
    DlJ();
}

If you were a perfectionist you could change to an else if ( target.x < self.x) and add another else to decide what to do if they are on the same x. The version I posted will do D<J if they are on the same x coordinate.
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by:
#74
Announcing version 3.0:

Download: http://www.mediafire.com/?pxd026nqoqgw0

Change log (Click to View)
I will soon update my Data Changer, so it will include color coding for the changes.
Age ratings for movies and games (and similar) have never been a good idea.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.
Reply
Thanks given by: YinYin
#75
working on a list for the data struct
(08-22-2012, 02:11 PM)Someone else Wrote:  
  • As a result of this you can do the same with target:
    "target = 123;"
so that's basically like loadTarget(i) except allowing multiple ones with any name we want?
that will make my basic AI a lot easier to handle

(08-22-2012, 02:11 PM)Someone else Wrote:  
  • This is useful for sharing variables between scripts. (more on this later)
  • If a file is compiled this way "module" will be defined. Otherwise "character" is defined.
could you mash up a quick example for this?


edit: game.objects[self.num].data.frames[self.frame].opoint.oid
this example does not work

this one does:
self.data.frames[self.frame].opoint.oid
Reply
Thanks given by:
#76
(08-22-2012, 02:42 PM)YinYin Wrote:  edit: game.objects[self.num].data.frames[self.frame].opoint.oid
this example does not work
Fixed.

Version 3.1 I guess.
Download: http://www.mediafire.com/?pxd026nqoqgw0
Age ratings for movies and games (and similar) have never been a good idea.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.
Reply
Thanks given by:
#77
Version 3.2:
  • Fixed a bug causing target to be the same as self.
  • Switching to the newest version of AngelScript. (version 2.24.1)
Download: http://www.mediafire.com/?pxd026nqoqgw0
Age ratings for movies and games (and similar) have never been a good idea.
One can learn a lot from reinventing wheels.
An unsound argument is not the same as an invalid one.
volatile in C++ does not mean thread-safe.
Do not make APIs unnecessarily asynchronous.
Make C++ operator > again
Trump is an idiot.
Reply
Thanks given by: YinYin , Kevin , A-Man
#78
Pretty much appreciated. Good job and Thanks ^^.
Also, did you guys figure a way to make the armor work? Do u think its even possible?
I really wanna help you with what you're doing, but i guess I need some more time to grasp what you've learnt before (these reverse engineering and hex stuff). Thanks again!
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:
#79
In this thread, you posted a method for patching the exe to load rarara.dll. But this dll seems to work without any patching in LF2.exe (v2.0a). I am interested in knowing how.
Also, does this dll work on exes that have resource edits?
[Image: icyboards-ad-468x60.gif]
Reply
Thanks given by:
#80
(09-24-2012, 02:38 PM)Electric Shock Wrote:  In this thread, you posted a method for patching the exe to load rarara.dll. But this dll seems to work without any patching in LF2.exe (v2.0a). I am interested in knowing how.
LF2 requires ddraw.dll to display the graphics on-screen. At first, it'll search for the dll in the folder the exe is located in; if the dll is not there, it'll go to into the windows\system32\-folder. Basically, the patched ddraw.dll executes the AI-related stuff and then calls the original dll. This means that
(09-24-2012, 02:38 PM)Electric Shock Wrote:  Also, does this dll work on exes that have resource edits?
Yes. I'm using it with an overly patched exe (resources + dll-framework + various hex-edits around the place) and it's working flawlessly :)
Silverthorn / Blue Phoenix
~ Breaking LFE since 2008 ~

"Freeze, you're under vrest!" - Mark, probably.

» Gallery | » Sprites | » DeviantArt
Reply
Thanks given by: A-Man , Electric2Shock




Users browsing this thread: 3 Guest(s)