Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[2.2]Programmable AI via scripting
I have here a patch that adds a previously unknown field in the sObject struct:
Code:
--- sgame.h    2013-06-12 13:18:41.033551073 -0400
+++ my_sgame.h    2013-06-12 13:40:13.569301698 -0400
@@ -213,7 +213,8 @@
     int frame3;
     int frame4;
     char facing;
-    char unkwn3[15];
+    char unkwn3[11];
+    int wait_counter;
     int ccatcher;
     int ctimer;
     int weapon_type;
I haven't actually tested this change. Please tell me if this is not the preferred way to submit patches.
EDIT: Changed name from delay_counter to wait_counter to reflect naming in data files :S
Reply
Thanks given by:
Could you enable the math add-on (http://www.angelcode.com/angelscript/sdk..._math.html)?

Also, you know how for some reason you can't handle Frame (or Itr or whatever) thingies?:
Code:
Frame x = game.objects[self.num].data.frames[0];
=>
ERROR : Data type can't be 'const Frame'
I don't know why it can't be Frame, but maybe it could be any or ref if those add-ons were enabled?

Also:
Code:
enum State {
    STANDING,WALKING,RUNNING,ATTACKING,JUMPING,DASHING,ROWING,DEFENDING,
    BROKEN_DEFENCE,CATCHING,CAUGHT,INJURED,FALLING,FROZEN,LYING,OTHER,DoP,
    DRINKING,BURNING,FIRERUNNING,LOUIS_DASH_ATTACKING=100,DEEP_STRAFING=301,
    TELEPORTING_ENEMY=400,TELEPORTING_FRIEND=401,RUDOLF_TRANSFORMING=500,
    RUDOLF_TRANSFORMING2=501,SELF_HEALING=1700,
}
EDIT: Ah yeah your version is much better.
Reply
Thanks given by:
(06-12-2013, 05:45 PM)zort Wrote:  I have here a patch that adds a previously unknown field in the sObject struct:
Code:
--- sgame.h    2013-06-12 13:18:41.033551073 -0400
+++ my_sgame.h    2013-06-12 13:40:13.569301698 -0400
@@ -213,7 +213,8 @@
     int frame3;
     int frame4;
     char facing;
-    char unkwn3[15];
+    char unkwn3[11];
+    int wait_counter;
     int ccatcher;
     int ctimer;
     int weapon_type;
I haven't actually tested this change. Please tell me if this is not the preferred way to submit patches.
EDIT: Changed name from delay_counter to wait_counter to reflect naming in data files :S
Currently there is not a preferred way to submit patches. Basically whatever works.
It's the time before you go to the next frame?

(06-14-2013, 07:21 PM)zort Wrote:  Could you enable the math add-on (http://www.angelcode.com/angelscript/sdk..._math.html)?
Will do.

(06-14-2013, 07:21 PM)zort Wrote:  Also, you know how for some reason you can't handle Frame (or Itr or whatever) thingies?:
Code:
Frame x = game.objects[self.num].data.frames[0];
=>
ERROR : Data type can't be 'const Frame'
You actually can but it is quite unintuitive the way it works.
In the above code you are declaring a new Frame object and setting it equal to an existing one. First of all if you could do that it would be wasteful in resources as the data is already stored in memory somewhere else, and on top of that you aren't allowed to do so anyway because I haven't registered a factory function for the types anyway.
The way to do it is by using handles (signified by using an @ symbol).
Also since all of the API objects are declared as "const" you will have to use "const" as well.
The following code loops through standing frames and displays their bodys:
    CPP-Code:
int n = 0;
for(const Frame <DVZ_ME#0> = target.data.frames[0];;@frame = target.data.frames[frame.next]){
    print("<frame> "+n+"\n");
 
    for(int i = 0;i<frame.bdy_count;++i){
        const Bdy <DVZ_ME#1> = frame.bdys[i];
 
        print("   bdy: \n"
              "      kind: "+bdy.kind+"  x: "+bdy.x+"  y: "+bdy.y+"  w: "+bdy.w+"  h: "+bdy.h+"\n"
              "   bdy_end:\n");
    }
 
    print("<frame_end>\n\n");
 
    n = frame.next;
    if(n >= 400 || n <= 0 || !target.data.frames[n].exists) break;
}


(06-14-2013, 07:21 PM)zort Wrote:  Also:
Code:
enum State {
    STANDING,WALKING,RUNNING,ATTACKING,JUMPING,DASHING,ROWING,DEFENDING,
    BROKEN_DEFENCE,CATCHING,CAUGHT,INJURED,FALLING,FROZEN,LYING,OTHER,DoP,
    DRINKING,BURNING,FIRERUNNING,LOUIS_DASH_ATTACKING=100,DEEP_STRAFING=301,
    TELEPORTING_ENEMY=400,TELEPORTING_FRIEND=401,RUDOLF_TRANSFORMING=500,
    RUDOLF_TRANSFORMING2=501,SELF_HEALING=1700,
}
Will add that as well.
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:
(06-14-2013, 10:39 PM)Someone else Wrote:  It's the time before you go to the next frame?
Each frame, it counts up from 0 until it hits the current frame's wait value, at which point the object goes to its next frame and wait_counter gets reset to 0. That's what it appears to do from observation.
(06-14-2013, 10:39 PM)Someone else Wrote:  The way to do it is by using handles (signified by using an @ symbol).
Also since all of the API objects are declared as "const" you will have to use "const" as well.
Haha, I tried const and I tried @, but I guess I didn't try them both together. Awesome.
Reply
Thanks given by:
Updated.
  • Basically added what zort asked for (kind of that is):
    • Added wait_counter to Object.
    • Added the AngelScript math-add on.
    • Added enum ObjectStates:
      ObjectStates (Click to View)

Download: http://www.mediafire.com/folder/pxd026nq...2ddWrapper
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:
We always want more features... Excuse me, but can you also enable the file add-on? I have some serious reason to output the states of ALL objects in the scene to a dump file and analyse it carefully, better than reading off the console window. I will appreciate so much for having this feature. Thank you.
Reply
Thanks given by:
The wait_counter only returns 0 on both self and target objects for me (but unkwn3[7] seems to display the required behaviour).

Also do we have a game time variable?
Reply
Thanks given by: Deep
(04-24-2015, 10:52 AM)YinYin Wrote:  The wait_counter only returns 0 on both self and target objects for me (but unkwn3[7] seems to display the required behaviour).
I'll try to fix this, but I don't have much time right now.

(04-24-2015, 10:52 AM)YinYin Wrote:  Also do we have a game time variable?
No. I found it once (using cheat engine), but I have not added it to the API.
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:
No worries then. I can deal with unkwn3[7] for now and have found other means than game time to limit some attack frequencies.
Reply
Thanks given by:
I tried to download the dDrawDll and extracted it, then place dll file in LF2 folder (as mentioned in the post).


Ran lf2.exe to start the game ddraw.dll was deleted by antivirus in my laptop.

Threat detected - WS.Reputation.1

I think it is not safe link if you don't have a good antivirus installed in your laptop/desktop.
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)