Posts: 4,878
Threads: 162
Joined: Mar 2008
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
Thanks given by:
Posts: 19
Threads: 4
Joined: Jul 2012
07-27-2012, 04:14 PM
(This post was last modified: 07-27-2012, 04:16 PM by totokwok.)
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.
Thanks given by:
Posts: 1,018
Threads: 60
Joined: Mar 2008
07-27-2012, 04:41 PM
(This post was last modified: 07-27-2012, 04:43 PM by Boop.)
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.
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ʟᴇᴇᴘ.
Thanks given by:
Posts: 746
Threads: 55
Joined: Apr 2008
Announcing version 3.0:
Download: http://www.mediafire.com/?pxd026nqoqgw0
- You can now access even more information using.
- You can access the oid of an opoint like this:
"game.objects[self.num].data.frames[self.frame].opoint.oid"
- The Info structure (self, target), now has a data entry too. The following will give the same result as the above:
"self.data.frames[self.frame].opoint.oid"
- If you want a full list, either wait till someone else (as in, "not me"), compiles a complete list, or download the source code, and check out "sgame.h". (basic C syntax may be needed to understand it)
- You can now define Info structures like this:
"Info some_ball;"
- You can load them like this:
"some_ball = 123;" (123 can be replaced with any number from 0 to 399)
You can also check if it went well like this:
"if((some_ball = 123) == -1)"
- As a result of this you can do the same with target:
"target = 123;"
- In addition to scripts with valid id numbers as a name (-1.as, 0.as, 1.as etc.), files that start with an underscore (_), are also compiled at startup.
- 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.
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.
Posts: 2,340
Threads: 78
Joined: Mar 2008
08-22-2012, 02:42 PM
(This post was last modified: 08-22-2012, 03:25 PM by YinYin.)
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
Thanks given by:
Posts: 746
Threads: 55
Joined: Apr 2008
(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.
Thanks given by:
Posts: 746
Threads: 55
Joined: Apr 2008
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.
Posts: 1,556
Threads: 77
Joined: May 2011
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!
Thanks given by:
Posts: 820
Threads: 44
Joined: Mar 2011
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?
Thanks given by:
Posts: 4,878
Threads: 162
Joined: Mar 2008
(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
|