I have to ask. When is this going to be "shipped" ?
Looks very promising.
Also that SAVE_GetFuncID(func f) caught my eye. I tried to use function IDs in same way (I had some instance "blueprints") but MEM_GetFuncID inside instance always caused Acces Violation.. Is this some workaround ? http://lego.worldofplayers.de/?Buffs
Soon, I guess. I have exams currently, but maybe I can squeeze in an update. There's a couple of other scripts that will have to go along with it, mostly some convenience stuff, but maybe someone will find it helpful.
Yes, that function is meant exactly to avoid errors in instances
Daedalus works like this: Whenever there is something like instance.attribute (e.g. instance.attribute = 0), at first the "current instance" is set and then the class.member-offset is added to the address of that instance.
Within instances (i.e. the "constructors"), you can leave out the "instance.", because the instance was set when the constructor was called. Accessing attributes of a different object will override the "current instance" and screw up everything! If you look at the implementation of SAVE_GetFuncID() it's rather easy and can be done for any function (it simply saves the current instance, does the call and restores it afterwards).
To manually circumvent this, just explicitly state the instance once after a call, e.g.
Code:
instance inst (class) {
MEM_GetFuncID(f);
inst.name = "";
// Continue as normal
}
Zitat von Siemekk
Code:
var c_npc oth; oth = _^(victimPtr);
How i can assign to more than one NPC ?
victimPtr=EBP.
I do not know how I can explain this :/
My Version Hero>Collect npc from hero voblist > Set damage
As Mark56 said, that's not what that script is for. Instead it's useful to make your own damage calculations whenever a character is damaged "normally" (e.g. spells, melee hits, ...).
Edit: Apparently I'm an idiot, because the Buffs-Script hasn't even been uploaded to the SVN yet, it's still only on my laptop. Well, I guess you'll have to look at it whenever I get around to a release
Just make a small commit. I have few weeks until semester starts again, and would like to finish some scripts.
Done. Talents.d and Buffs.d are nowhere near final, though, so don't be angry when something changes I'll try to keep the interface, but I can't guarantee anything.
If I understand you want to do damage to everybody on hero voblist ?
Fucntion is for something entirely different...
Thanks I wrote a new function. Result is satisfactory(for me)
It is possible change vfx to zCVob ? In "Czas Zaplaty" collision is made from vfx (changed to zCVob ? )
By this function:
Code:
func int I_zCTreeSearchVFX(var int ptr)
{
if(ptr==0)
{
printdebug("ERROR!!!");
};
var string name;
name = "R_SWORDDAMAGE VOB";
var int label; var int val; var int first_ptr; var int previous;
first_ptr = ptr;
val = MEM_ReadInt(ptr+16);//data zCVobVFX?
if(val)
{
if(MEM_ReadInt(val)==8585884)&&(Hlp_StrCmp(MEM_ReadString(val+16),name))
{
return val;
};
};
MEM_InitLabels();
label = MEM_StackPos.position;
if(previous)
{
ptr = MEM_ReadInt(ptr+12);//next
}
else
{
ptr = MEM_ReadInt(ptr+8);//next
};
if(ptr==0)
{
previous=true;
ptr=first_ptr;
MEM_StackPos.position = label;
};
val = MEM_ReadInt(ptr+16);//data zCVobVFX?
if(val)
{
if(MEM_ReadInt(val)==8585884)&&(Hlp_StrCmp(MEM_ReadString(val+16),name))
{
return val;
}
else if (first_ptr!=ptr)
{
MEM_StackPos.position = label;
};
}
else
{
return 0;
};
};
And my question : How change vfx to zCVob (i have an idea for Steaths, but i don't know how i can change vfx to zCVob :/)
Thanks I wrote a new function. Result is satisfactory(for me)
It is possible change vfx to zCVob ? In "Czas Zaplaty" collision is made from vfx (changed to zCVob ? )
By this function:
Code:
func int I_zCTreeSearchVFX(var int ptr)
{
if(ptr==0)
{
printdebug("ERROR!!!");
};
var string name;
name = "R_SWORDDAMAGE VOB";
var int label; var int val; var int first_ptr; var int previous;
first_ptr = ptr;
val = MEM_ReadInt(ptr+16);//data zCVobVFX?
if(val)
{
if(MEM_ReadInt(val)==8585884)&&(Hlp_StrCmp(MEM_ReadString(val+16),name))
{
return val;
};
};
MEM_InitLabels();
label = MEM_StackPos.position;
if(previous)
{
ptr = MEM_ReadInt(ptr+12);//next
}
else
{
ptr = MEM_ReadInt(ptr+8);//next
};
if(ptr==0)
{
previous=true;
ptr=first_ptr;
MEM_StackPos.position = label;
};
val = MEM_ReadInt(ptr+16);//data zCVobVFX?
if(val)
{
if(MEM_ReadInt(val)==8585884)&&(Hlp_StrCmp(MEM_ReadString(val+16),name))
{
return val;
}
else if (first_ptr!=ptr)
{
MEM_StackPos.position = label;
};
}
else
{
return 0;
};
};
And my question : How change vfx to zCVob (i have an idea for Steaths, but i don't know how i can change vfx to zCVob :/)
You actually don't need a zCVob to detect collision. In fact, you don't even need Ikarus for that. All you need to do is add collision detection to your VFX, like so:
Code:
INSTANCE yourVFX (CFx_Base_Proto)
{
// ...
emActionCollDyn_S = "CREATEONCE COLLIDE"; // Effect is removed when it collides ("CREATE COLLIDE" will keep it alive)
emFXCollDyn_S = "impactFX; // VFX instance for a visual effect on collision (optional)
emFXCollDynPerc_S = "triggerPerception"; // VFX instance to send perception
emFXCollDynAlign_S = "COLLISIONNORMAL";
emCheckCollision = 1; // If this is a spell, set this to 2, then it won't automatically deal damage
}
INSTANCE triggerPerception (CFx_Base_Proto)
{
sendAssessMagic = 1; // This will call B_AssessMagic in which you can ask for the circumstances of the call and call other functions
};
You can add the respective CollStat options to also collide with static objects.
If that does not work for you check out this engine function:
I find your script interesting. I take it, it is for finding a VFX instance? My question is, what pointer do I need to pass to the function. Is there a gloabal vfxTree pointer of the world like a zCVobTree for oCVisualFx?
@mud-freak I guess siemekk is mostly rewriting someone elses scripts.
@Lehona Big thanks, there is little poroble though. I use LeGo on G1 which has most of the adressses ported. Most of them
Do you remeber what this "9298296" magic nuber is, or where in the IDA should I look for it ? I get AV on ReadIntArray... I hope its only bad adress
Spoiler:(zum lesen bitte Text markieren)
Code:
//========================================
// Aktuelle Instanz bearbeiten
//========================================
func void MEM_SetUseInstance(var int inst) {
var int ptr; ptr = MEM_ReadIntArray (currSymbolTableAddress, inst);
MemoryProtectionOverride(9298296, 10);
MEM_WriteInt(9298296, ptr);
MEM_WriteInt(9298296, MEM_ReadInt(ptr+28));
};
func int MEM_GetUseInstance() {
return MEM_ReadInt(9298296);
};
Edit: Sorry, just checked and its already ported adress. My bad.
Edit2: I looked into IDA and adresses seems to be correct. hmm any ideas ?
Edit3: Okay. I made little workaround. Since I was not able to fix it.
Here is code, if anybody with Gothic 1 has the same problem. (Based on ikarus function)
Spoiler:(zum lesen bitte Text markieren)
Code:
func int MEM_StringToFuncID(var string fnc) {
if (Hlp_StrCmp (fnc, "")) {
MEM_Error ("MEM_CallByString: fnc may not be an empty string!");
return -1;
};
/* Mikrooptimierung: Wird zweimal hintereinander die selbe Funktion
* mit CallByString aufgerufen, nicht nochmal neu suchen. */
var int symbID;
var string cacheFunc; var int cacheSymbID;
if (Hlp_StrCmp (cacheFunc, fnc)) {
symbID = cacheSymbID;
} else {
symbID = MEM_FindParserSymbol (fnc);
if (symbID == -1) {
MEM_Error (ConcatStrings ("MEM_CallByString: Undefined symbol: ", fnc));
return -1;
};
cacheFunc = fnc; cacheSymbID = symbID;
};
return symbID;
};
usable in instances like this
Code:
instance inst_name(...) {
a = 2l;//
on_click = MEM_StringToFuncID("fooo");
}
The address can stay the same, it's just expecting a zCPar_Symbol* instead of a symbol ID now (makes more sense, because MEM_GetUseInstance() returns a zCPar_Symbol*).
Das Script wurde schonmal im Forum gepostet, es erlaubt einem zwei Dinge zu tun:
Jeder NPC kann durch eine eindeutige, dauerhafte ID identifiziert (und gefunden) werden
Man kann eine beliebige Menge an Daten für jeden NPC speichern
ItemHelper.d
Dieses Script ist relativ langweilig, es erlaubt einem für eine beliebige C_Item (oder oCItem) Instanz einen gültigen Pointer zu bekommen.
Die Dokumentation im Wiki erfolgt in den nächsten Tagen.
English:
Spoiler:(zum lesen bitte Text markieren)
Talents.d
This script has been posted in this forum before, it enables you to do two things:
Get a unique, persistent identifier for any Npc and "find" the associated Npc for a given ID
Easily save an unlimited amount of data per NPC
ItemHelper.d
This script is rather mundane, you get a valid pointer for any given instance of C_Item (or oCItem). Probably only useful in fringe cases (e.g. rendering items on the screen).
I did, but apparently an old file snuck into the release? It seems to be just a typo (Talent_Name would've been right), which was literally the last fix/change I made before I (succesfully) started testing.
I'll have a deeper look into it tomorrow, so there'll be no other surprises.
Das ist genau, worauf Rayzer sich in Post #230 bezieht.
Ich habe noch keine neue Version hochgeladen, weil ich sichergehen wollte, dass sich nicht noch irgendwo anders alte Dateien eingeschlichen haben und weil ich mich (immernoch! ) in meinen Prüfungsvorbereitungen verloren habe.
Das ist genau, worauf Rayzer sich in Post #230 bezieht.
Ich habe noch keine neue Version hochgeladen, weil ich sichergehen wollte, dass sich nicht noch irgendwo anders alte Dateien eingeschlichen haben und weil ich mich (immernoch! ) in meinen Prüfungsvorbereitungen verloren habe.
Stimmt, da war ich etwas blind. Es ist ja zum Glück ein Fehler, den wohl jeder auch selbst beheben kann.
Hello another time
I use Cursor && Buttons to my new Menu. But when i'm in the city, cursor was very slow. How I can change DPI in game ? Because this is not good effect
Hello another time
I use Cursor && Buttons to my new Menu. But when i'm in the city, cursor was very slow. How I can change DPI in game ? Because this is not good effect
I actually had the same problem designing free aiming. There is no frame-lock on the cursor.
Here is what I did. (mouseDeltaX and mouseSensX are pointers to x movement and x sensitivity, respectively)
Code:
var int deltaX; deltaX = mulf(mkf(MEM_ReadInt(mouseDeltaX)), MEM_ReadInt(mouseSensX)); // Get mouse change in x
var int frameAdj; frameAdj = mulf(MEM_Timer.frameTimeFloat, fracf(16, 1000)); // Frame "lock"
deltaX = mulf(deltaX, frameAdj);
The 0.016 is approximate. I went through a long process of testing the mouse movement with different fps. 0.016 is the slope of the linear(!) regression line of the recorded mouse movements. Since gothic is not a serious shooter, I was satisfied with the level of consistency achieved by that multiplier. For a cursor this approximate solution should be even less of a problem.
Something like this should fix the problem (not tested) and could be implemented in the next LeGo update:
Cursor.d
Code:
func void _Cursor_GetVal() {
var _Cursor c; c = _^(Cursor_Ptr);
Cursor_RelX = c.relX;
Cursor_RelY = c.relY;
Cursor_fX = addf(mulf(mkf(Cursor_RelX), mulf(MEM_ReadInt(Cursor_sX), mkf(2))), Cursor_fX);Cursor_fY = addf(mulf(mkf(Cursor_RelY), mulf(MEM_ReadInt(Cursor_sY), mkf(2))), Cursor_fY);
var int deltaX; deltaX = mulf(mkf(Cursor_RelX), mulf(MEM_ReadInt(Cursor_sX), mkf(2)));
var int deltaY; deltaY = mulf(mkf(Cursor_RelY), mulf(MEM_ReadInt(Cursor_sY), mkf(2)));
var int frameAdj; frameAdj = mulf(MEM_Timer.frameTimeFloat, fracf(16, 1000)); // Frame lock
Cursor_fX = addf(mulf(deltaX, frameAdj), Cursor_fX);
Cursor_fY = addf(mulf(deltaY, frameAdj), Cursor_fY);
Cursor_X = roundf(Cursor_fX);
Cursor_Y = roundf(Cursor_fY);
Cursor_Wheel = c.wheel;
//...
};