-
No, not at all.
??? -> broadcast -> areadamage
was supposed to be in your structure
Code:
hook(attack, functionThatYouWantCalledForEachAttack);
func void functionThatYouWantCalledForEachAttack ()
{
broadcast(attacker, functionThatYouWantCalledForEachAttackForEachNpc);
};
func void functionThatYouWantCalledForEachAttackForEachNpc (c_npc slf, c_npc attacker)
{
if (npc_couldBeHit(slf,attacker) == true)
{
Npc_TakeDamage(slf);
};
};
-
Zitat von Milky-Way
No, not at all.
??? -> broadcast -> areadamage
was supposed to be in your structure
Code:
hook(attack, functionThatYouWantCalledForEachAttack);
func void functionThatYouWantCalledForEachAttack ()
{
broadcast(attacker, functionThatYouWantCalledForEachAttackForEachNpc);
};
func void functionThatYouWantCalledForEachAttackForEachNpc (c_npc slf, c_npc attacker)
{
if (npc_couldBeHit(slf,attacker) == true)
{
Npc_TakeDamage(slf);
};
};
I am stupid!
Why I didn't think you mean this... Anyway, thank you very much for helping. If I'd have some problems or something I'll write here, but not today, because I am not at my sweet home.
-
I tested those scripts today (only today I have time to do something in Gothic :/) and I discovered a problem, viz, it's about the
Code:
HookEngineF(EV_AttackLeft, 5, _DMG_OnDmg);
HookEngineF(EV_AttackRight, 5, _DMG_OnDmg);
HookEngineF(EV_AttackRun, 5, _DMG_OnDmg);
when I use those, I am getting an error it does not exist.
BTW: I enquired about this, where are those implemented, but no one answered
Zitat von Abuyin Sharidi
But the one thing is, I don't know what are those things:
Code:
oCNpc::EV_AttackForward(oCMsgAttack *) 0x0074F400
oCNpc::EV_AttackLeft(oCMsgAttack *) 0x00750160
oCNpc::EV_AttackRight(oCMsgAttack *) 0x00750D00
oCNpc::EV_AttackRun(oCMsgAttack *) 0x007517D0
oCNpc::EV_AttackFinish(oCMsgAttack *) 0x00751AF0
nor where are those implemented...?
And yes, I am a pain in the ass person :P
-
Two quick questions to base a more detailed answer on:
Have you defined EV_AttackLeft?
Do you know how hooks are supposed to work?
-
Zitat von Milky-Way
Two quick questions to base a more detailed answer on:
Have you defined EV_AttackLeft?
Do you know how hooks are supposed to work?
I'll answer this:
Hooks get the function instance from the engine.
Code:
HookEngineF(EngineFunction, Bytes, FunctionIwantToUse);
example:
Code:
HookEngineF(6736583, 5, _DMG_OnDmg);
6736583 is an engine function (but I don't know what a function).
And there's one more problem, how can I define the EV_AttackLeft if I haven't ever seen engine functions?
-
That is almost it. The number that you have to fill in is the address of the function in the Gothic.exe (that's where you "find" the engine functions)
The list you were looking at
Code:
oCNpc::EV_AttackForward(oCMsgAttack *) 0x0074F400
oCNpc::EV_AttackLeft(oCMsgAttack *) 0x00750160
oCNpc::EV_AttackRight(oCMsgAttack *) 0x00750D00
oCNpc::EV_AttackRun(oCMsgAttack *) 0x007517D0
oCNpc::EV_AttackFinish(oCMsgAttack *) 0x00751AF0
already gives you that address, but in the hex system, so you have to convert it to a number in the decimal system. There are many converters online, you could also use a Daedalus function to convert hex to decimal (although there is no real reason to do so), see e.g. here
http://forum.worldofplayers.de/forum...1#post16881996
And I think the table in the attached file here:
http://forum.worldofplayers.de/forum...1#post17631567
implies that instead of a 5 as a second parameter you need a 6 or 7 depending on which of the functions you hook. Other people, please correct me if I'm wrong, I haven't used hooks in quite a while.
-
Your explanation is correct.
Abuyin, you shouldn't redirect the hook to _DMG_OnDmg, that function is used to manipulate the damage calculations of the engine. Redirect it to your own function and then deal AoE damage if you so desire. And you probably don't need all of those functions (maybe only EV_AttackFinish), no one has done what you're trying to do before, so you'll have to work out the kinks yourself - we're only giving you the tools to do so. Don't expect us to have a solution lying around, you'll have to do a lot of testing etc. yourself (which is why it will probably be hard if you don't understand a lot about it).
-
Zitat von Milky-Way
That is almost it. The number that you have to fill in is the address of the function in the Gothic.exe (that's where you "find" the engine functions)
The list you were looking at
Code:
oCNpc::EV_AttackForward(oCMsgAttack *) 0x0074F400
oCNpc::EV_AttackLeft(oCMsgAttack *) 0x00750160
oCNpc::EV_AttackRight(oCMsgAttack *) 0x00750D00
oCNpc::EV_AttackRun(oCMsgAttack *) 0x007517D0
oCNpc::EV_AttackFinish(oCMsgAttack *) 0x00751AF0
already gives you that address, but in the hex system, so you have to convert it to a number in the decimal system. There are many converters online, you could also use a Daedalus function to convert hex to decimal (although there is no real reason to do so), see e.g. here
http://forum.worldofplayers.de/forum...1#post16881996
And I think the table in the attached file here:
http://forum.worldofplayers.de/forum...1#post17631567
implies that instead of a 5 as a second parameter you need a 6 or 7 depending on which of the functions you hook. Other people, please correct me if I'm wrong, I haven't used hooks in quite a while.
You've made water from my brain now. O.o
I need to do what? Use the function you made to get the int?
Zitat von Lehona
Your explanation is correct.
Abuyin, you shouldn't redirect the hook to _DMG_OnDmg, that function is used to manipulate the damage calculations of the engine. Redirect it to your own function and then deal AoE damage if you so desire. And you probably don't need all of those functions (maybe only EV_AttackFinish), no one has done what you're trying to do before, so you'll have to work out the kinks yourself - we're only giving you the tools to do so. Don't expect us to have a solution lying around, you'll have to do a lot of testing etc. yourself (which is why it will probably be hard if you don't understand a lot about it).
Well... I guess I'll leave this AoE damage, because I don't think I am able to make it, if no one else did it before.
Lehona, I guess you're right, I should not be playing with those functions. I don't understand much of those, so the best way would be to learn the scripts and LeGo than trying to do something I don't know how to do. Well, maybe I'll try to do it in the future, when I'll learn LeGo, now, I don't think I could even do some begginer things (I don't speak about prints, which I can copy from original LeGo scripts and change the numbers of position, time etc.). Ok, then, thanks for your help. I know only in Gothic Payback Time was done an AoE damage function, just I don't know how and I didn't find the functions yet, so I cannot look for advices.
I wanted to redirect it with _DMG_OnDmg, because I wanted to trigger it with those functions.
-
Zitat von Abuyin Sharidi
You've made water from my brain now. O.o
I need to do what? Use the function you made to get the int?
0x0074F400 is the address of the function oCNpc::EV_AttackForward(oCMsgAttack *)
However, when you hook a function, it does not know what to do with an address like 0x0074F400, because it is in the hexadecimal system
http://en.wikipedia.org/wiki/Hexadecimal
LeGo only understands the decimal.
http://en.wikipedia.org/wiki/Decimal
Think about it as if someone writes you an email asking you to meet him at the train station at a certain time. Unfortunately, that person uses Roman numerals, so he writes you should meet him at X in the morning. Now, if you don't know that X is the Roman numeral for (the decimal) 10, you would not know the time at which you need to be at the train station.
In a similar way, LeGo does not know what 0x0074F400 means. However, you as a person can translate it for LeGo. You can do it by hand (there are algorithms you can look up online) or you use a converter, where you type in 0x0074F400 and get 7664640 as a result.
http://www.binaryhexconverter.com/he...imal-converter
When I first looked at how the conversion works, I decided to write a function (in Daedalus) that can convert a hex number to a decimal number. So you could also just use this function to find out the decimal number during runtime. However, there is no good reason for you not to do it beforehand already.
With that number, you are ready to hook a function / at the function start.
Code:
HookEngineF(7664640, Bytes, FunctionIwantToUse);
However, there is a complication:
the way hooks work internally is: they write in your RAM at the place where the function starts (7664640) that another function FunctionIwantToUse should be called and afterwards the game should go on with the normal function (whatever it does). Now, writing that the other function should be called takes space, so it overwrites whatever there was at the start of the function. To make sure that information is not lost (after all, you want the function you hooked to behave normally), LeGo first copies the bytes that would be overwritten, to make sure that code can be executed after FunctionIwantToUse and before it continues at the original code. The problem here is that you need to make sure that the would-be-overwritten code is still usable and LeGo doesn't copy half a command. So the big table that I gave you a link to tells you that, when you hook EV_AttackForward, then LeGo needs to copy 6 bytes to make sure only complete statements are copied. Hence, you give LeGo that information:
Code:
HookEngineF(7664640, 6, FunctionIwantToUse);
Now, whenever the code at 7664640 is executed, first FunctionIwantToUse is called and then the game continues as if you had never done anything.
So the hooking itself is rather simple. The difficulty comes from knowing where to hook and how to use the information available there.
Lehona suggests that it might be sufficient to hook EV_AttackFinish, probably because he thinks that this function will be called after any kind of attack, so you don't need to hook
Code:
oCNpc::EV_AttackForward(oCMsgAttack *) 0x0074F400
oCNpc::EV_AttackLeft(oCMsgAttack *) 0x00750160
oCNpc::EV_AttackRight(oCMsgAttack *) 0x00750D00
oCNpc::EV_AttackRun(oCMsgAttack *) 0x007517D0
separately.
However, you would still need to test whether the function is really called at exactly the right moments. Since we have not done it before, we cannot tell you for sure. (that's what Lehona probably wanted to tell you by writing that no-one has done it before - it is not necessarily difficult, we just don't know) We can help you with the technical issues, but the testing you have to do yourself, at least I personally do not have time for that.
_DMG_OnDmg are apparently already used for something else, so it is usually better not to mix up things but to create your own function that deals with just what it has to deal with.
By the way, referring to a Polish site on which we can only see 9 nondescript pictures (and maybe can use google translator for some hard to read text) does not give me any more information about what you want to do or how others have done it.
-
Well, I could try to make the AoE damage, but seriously, I don't know so really (at the moment I have no idea I mean) where to put those scripts. I don't know how to use them, I think I'll try it in some months/years, because it's non-sense to try to do something I don't know how to do.
I could post here the whole scripts from this modification, but I am not sure I can (you know, Copyright).
Watch this for a while to see AoE Damage in this mod.
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
|