|
-
Zitat von Rayzer
I'm trying to call a function by hooking hero melee weapon attacks, but my problem is that the function is calling several times during one a single attack.
Code:
HookEngineF (7668064, 6, HeroAttack); //left
HookEngineF (7671040, 7, HeroAttack); //right
HookEngineF (7673808, 7, HeroAttack); //forward attack
HookEngineF (7664640, 6, HeroAttack); //combo
Is this possible to call function only once per attack?
I had the same problem. you could use a variable to only perform your desired action once when the attack is performed:
Code:
var int attackonce;
if attackright && attackonce == FALSE{
//your desired action
attackright = FALSE;
attackonce = TRUE;
}
Geändert von TheEternal (30.06.2015 um 15:14 Uhr)
Grund: //
-
Hello. I created queue which uses list to store handles to my new class items . But unfortunately it crashes sometimes when loading. Especialy when list is populated (loading save, which was done at time when list stored some handles ) with handles. I guess my function tries to use those handles but my class objects are not archived, so upon loading those handles refer to nothing and that causes crash. Do I need to create some kind of archiver as other lego classes have ? If yes, could you explain me how to do it ?
Mfg Mark
-
I can't say anything until you show me your code.
-
Looks like I sorted it out. I had to destory list in Init_global, in case it was not empty. More or less fixed...
-
bars
Hi, anyone knows how to make 2-colored bar in Gothic 1 or 2?
I am making 2 bars on 1 surface, but the second bar is partially covered due to low transparency of first standard HP Bar.
-
What exactly do you want it to look like?
-
Hello. I still have problem with those lists. So its notification system based on list. Notifications are added to the list and then one after another gets rendered and removed.
List is most of the time empty. Problem occurs when I save the game with list containing more nodes. Game crashes trying to use data from the list ( I guss ). I looked in the scriptsave.sav and the list is stored in there with the data (handles to NMsg ), but the handles itself are not in the file.
I really want to be able to save/load list and objects it stores handles to. Hope anyone can help me.
Code:
var int NMsg_List; // zCList
var int NMsg_Active; //
class NMsg
{
var int type;
var string text1;
var string text2;
var string sound;
};
instance NMsg@(NMsg);
func int List_CreateH(var int data) // create list return handle
{
var int hndl;
hndl = new (zCList@);
// var zCList l; l = _^(getPtr(hndl));
var zCList l; l = get(hndl);
l.data = data;
l.next = 0;
return hndl;
};
func void Notify_Init() // init_global
{
if (!(getPtr(NMsg_List)))
{
NMsg_List = List_CreateH(0);
};
};
func void NMsg_Create(var string text1,var string text2,var int Ntf_type,var string snd)
{
if (!(getPtr(NMsg_List)))
{
NMsg_List = List_CreateH(0);
};
PrintDebug("Notify: List_Add");
var int hndl; hndl = new(NMsg@);
var NMsg msg; msg = get(hndl);
msg.text1 = text1;
msg.text2 = text2;
msg.type = Ntf_type;
msg.sound = snd;
List_Add(getPtr(NMsg_List),hndl);
};
func void NMsg_Remove(var int hndl) // msg handle
{
if (!Hlp_IsValidHandle(hndl))
{
return;
};
PrintDebug("Notify: List_Remove");
List_Delete(getPtr(NMsg_List), List_Contains(getPtr(NMsg_List), hndl)); // remove from list
if (Hlp_IsValidHandle(hndl))
{
delete(hndl); // delete handle
};
};
func void NMsg_Show(var string txt1,var string font1,var string txt2,var string font2,var string sound)
{
NMsg_Active = true;
// stuff
NMsg_Active = false; // after short delay
};
func void Notify_func() // looped by ff fucntion
{
if(!Hlp_IsValidNpc(hero)) { return; };
if ((MEM_Game.pause_screen)) /*|| (!InfoManager_HasFinished()))*/ { return; };
if (!NMsg_List) { return; };
if (!getPtr(NMsg_List)) { return; };
if (NMsg_Active) { return; };
var zCList l; l = get(NMsg_List);
var NMsg msg;
if (l.next)
{
var int hndl;
hndl = List_Get(getPtr(NMsg_List),2);
msg = get(hndl);
NMsg_Show(msg.text1,NMsg_FontSmall,msg.text2,NMsg_FontSmall,msg.sound);
NMsg_Remove(h);
};
};
-
Uh, that looks correct. Everything created with new() should automatically land in the savefile - are you sure there's nothing in there?
If it crashes upon saving, that will most likely be the cause, although I don't see any reason why that would happen. What error messages are you getting?
-
Kurze Frage:
Ich starte Gothic.
Ich starte ein neues Spiel und hooke eine Funktion.
Ich speichere das Spiel.
Ich beende Gothic.
Ich starte Gothic.
Ich lade den Spielstand (hooke die Funktion aber nicht wieder neu).
Kann der Hook noch irgendwie aktiv sein?
-
Nein. Beim Starten von Gothic wird die Gothic2.exe von der Festplatte in den Speicher geladen, ohne die Änderungen von HookEngine (die nie gespeichert werden).
-
Hello, I am thinking about using your button packet and I have one question.
Code:
if (Cursor_Left==KEY_PRESSED) {
MEM_PushIntParam(MEM_ReadStatArr(_Buttons, i));
MEM_CallByID(btn.on_click);
};
This is from function Buttons_Do in packet source. Does that PushIntParam mean that I can make function like bellow, and the button hadle is actually passed as parameter ?
Code:
func void Button_clickevent(var int hndl) {
// do stuff
};
-
COLOR OF LOG MENU
hi, here is the script to change color of text in missions menu. It looks great till I skipped to another kind of log . (for example from missions running to missions failed)
Code:
Func void _ChangeFontColorLogItem()
{
ChangeFontColorMenuItem("MENU_ITEM_SEL_MISSIONS_OLD", RGBA(0,255,255,255));
ChangeFontColorMenuItem("MENU_ITEM_SEL_MISSIONS_ACT", RGBA(210,255,128,255));
func void ChangeFontColorMenuItem(var string menuItemName, var int color) {
var int menuIptr; menuIptr = MEM_GetMenuItemByString(menuItemName);
var int col; col = color;
if (menuIptr) {
var zCMenuItem menuI; menuI = _^(menuIptr);
if (menuI.m_pInnerWindow) {
var zCView viewI; viewI = _^(menuI.m_pInnerWindow);
if (viewI.textLines_next) {
var zCList listI; listI = _^(viewI.textLines_next);
if (listI.data) {
var zCViewText viewTI; viewTI = _^(listI.data);
MEM_WriteInt(_@(viewTI.color), col);
viewTI.colored = 1;
};
};
};
};
};
-
Zitat von Mark56
Hello, I am thinking about using your button packet and I have one question.
Code:
if (Cursor_Left==KEY_PRESSED) {
MEM_PushIntParam(MEM_ReadStatArr(_Buttons, i));
MEM_CallByID(btn.on_click);
};
This is from function Buttons_Do in packet source. Does that PushIntParam mean that I can make function like bellow, and the button hadle is actually passed as parameter ?
Code:
func void Button_clickevent(var int hndl) {
// do stuff
};
Yes exactly, I should've mentioned it in the wiki.
-
ich möchte mit einem Hook das Dropevent abfangen und dabei wissen, welches Item gedroppt wird.
Um auf ein spezielles Item reagieren zu können.
Hook funktioniert auch soweit an der Funktion
Code:
virtual int __thiscall oCNpc::DoDropVob(zCVob *)
Code:
func void HOOK_AI_Drop(){
PrintDebugg("HERO AI_Drop happened");
AMBVAR_DROPWP = Npc_GetNearestWP(hero);
Mdl_ApplyOverlayMdsTimed (Npc, "HUMANS_SPRINT.MDS", SPL_Duration_SPEED);
NewRout(Npc, "pickup");
};
HookEngineF ( 7622096, 6, HOOK_AI_Drop); // Hook AIDrop (/*0x00744DD0*/)
Kann mir einer helfen, wie ich da an das zCVob komme und das gegen etwas anderes vergleichen kann?
zB gegen ItMi_OldCoin oder ItMi_OldCoin.3ds
-
Schau mal hier:
http://forum.worldofplayers.de/forum...1#post16744409
Ich könnte mir vorstellen, dass NPC und Item an gleicher (relativer) Stelle zu finden sind.
Und dann gibt es aus der Externals.d
Code:
FUNC INT Hlp_IsItem (VAR C_Item item, VAR INT instanceName)
// Prüft, ob der Gegenstand 'item' den Instanznamen 'instanceName' trägt. Will man z.B. testen,
// ob die globale Variable item Pfeile sind (ItMuArrow) ruft man Hlp_IsItem(item,ItMuArrow) auf.
// Gribt bei Gleichheit TRUE, sonst FALSE zurück.
Geändert von Milky-Way (12.09.2015 um 17:15 Uhr)
-
Jo, danke Milky-Way. Konnte es damit lösen.
-
Bug report (not sure if it is a bug or not, to be honest):
FF_ApplyOnceExt(func, 1, -1); drops FPS. In Khorinis I had 22 - 25 FPS without any function, with two with the second parameter set to 1, I have 9 - 11 FPS.
Greetings!
-
Try to give more information about the problem, so that lehona or someone else could find a solution for a possible bug, or can just tell you what's going on.
Does it happen with different time steps too? Post here the called function, it will help.
-
Those are all informations. FPS' just drop when setting it to apply 1000 times a second, only.
-
LeGo (tries to) guarantee that it will be called 1000x per second, even if that means calling it multiple times per frame. If you average around 25 FPS, that means 40ms/frame. So LeGo will call the function 40x per frame.
Never use small ms values unless you have a very specific reason to do so (I can't think of any). 0 will guarantee it's called exactly once per frame.
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
|
|