|
-
Neuer Dialogmobsi - Dialog wird bei allen Mobsis angezeigt
Hallo zusammen,
Ich habe vor nicht allzulanger Zeit einen neuen Dialogmobsi geschrieben, der zum Kleiderwaschen an einem Bottich gehören soll. Die Weinstampfer aus G2 funktionieren da meiner Meinung nach ganz gut. Also hab ich im Spacer so einen Weinstampfer-Mobsi eingebaut, und dem auch eine onstateFunc zugewiesen.
Daraufhin habe ich folgendes Script verfasst:
WashClothes.d
Code:
FUNC VOID WashClothes_S1 ()
{
var C_NPC her; her = Hlp_GetNpc(PC_Hero);
if (Hlp_GetInstanceID(self)==Hlp_GetInstanceID(her))
{
self.aivar[AIV_INVINCIBLE]=TRUE;
Ai_ProcessInfos (her);
};
};
//*******************************************************
// Dialog abbrechen
//*******************************************************
INSTANCE PC_WashClothes_End (C_Info)
{
npc = PC_Hero;
nr = 999;
condition = PC_WashClothes_End_Condition;
information = PC_WashClothes_End_Info;
permanent = TRUE;
description = DIALOG_ENDE;
};
FUNC INT PC_WashClothes_End_Condition ()
{
return TRUE;
};
FUNC VOID PC_WashClothes_End_Info()
{
B_ENDPRODUCTIONDIALOG ();
};
INSTANCE PC_Wash_BEL (C_INFO)
{
nr = 2;
npc = PC_Hero;
condition = PC_Wash_BEL_Condition;
information = PC_Wash_BEL_Info;
permanent = TRUE;
description = "Schwarzmagierrobe waschen";
};
FUNC INT PC_Wash_BEL_Condition()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesBel))
{
return TRUE;
};
};
FUNC VOID PC_Wash_BEL_Info ()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesBel))
{
Npc_RemoveInvItems (hero,ItMi_DirtyClothesBel,1);
CreateInvItems (hero,ItMi_CleanClothesBel,1);
};
};
INSTANCE PC_Wash_Ad (C_INFO)
{
nr = 3;
npc = PC_Hero;
condition = PC_Wash_Ad_Condition;
information = PC_Wash_Ad_Info;
permanent = TRUE;
description = "Wassermagierrobe waschen";
};
FUNC INT PC_Wash_Ad_Condition()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesAd))
{
return TRUE;
};
};
FUNC VOID PC_Wash_Ad_Info ()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesAd))
{
Npc_RemoveInvItems (hero,ItMi_DirtyClothesAd,1);
CreateInvItems (hero,ItMi_CleanClothesAd,1);
};
};
INSTANCE PC_Wash_In (C_INFO)
{
nr = 4;
npc = PC_Hero;
condition = PC_Wash_In_Condition;
information = PC_Wash_In_Info;
permanent = TRUE;
description = "Feuermagierrobe waschen";
};
FUNC INT PC_Wash_In_Condition()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesIn))
{
return TRUE;
};
};
FUNC VOID PC_Wash_In_Info ()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesIn))
{
Npc_RemoveInvItems (hero,ItMi_DirtyClothesIn,1);
CreateInvItems (hero,ItMi_CleanClothesIn,1);
};
};
Funktioniert soweit alles ganz fein, ich kann an meinem Bottich die dreckigen Klamotten sauber waschen.
Allerdings habe ich zufällig herausgefunden, dass das auch an jedem anderen Mobsi funktioniert. An Schreinen, an Ambössen und sogar im Bett - solange man die entsprechenden Items dabei hat.
Ich gehe mal stark davon aus, dass ich den AnfangsTeil des Scripts um etwas im Stile von
Code:
FUNC VOID WashClothes_S1 ()
{
var C_NPC her; her = Hlp_GetNpc(PC_Hero);
if (Hlp_GetInstanceID(self)==Hlp_GetInstanceID(her))
{
self.aivar[AIV_INVINCIBLE]=TRUE;
PLAYER_MOBSI_PRODUCTION = MOBSI_WashClothes_S1;
Ai_ProcessInfos (her);
};
};
erweitern muss.
Nur ist die Frage - wo werden diese Teile festgelegt?
Bzw, vllt ist mein Ansatz ja auch falsch?
Also ganz grob - Wie schaffe ich es, dass dieser Dialog nur bei meinem einen speziellen Weinstampfer/Kleiderwaschzuber vorkommt?
"Es ist nicht schwer, von jedem ethischen Prinzip zu beweisen, dass es in der Praxis scheitern muss, wenn man zugleich voraussetzt, dass allgemeiner Schwachsinn herrscht."
- John Stuart Mill
-
Dein Ansatz ist richtig.
MOBSI_NONE, MOBSI_SmithWeapon, MOBSI_SleepAbit und so weiter sind einfach Ganzzahl Konstante welche in der AI_Constants.d definiert werden. Für deinen mobdialog kannst du dir genau so eine Konstante definieren und in der onStateFunc WashClothes_S1() verwenden.
Hintergrund warum das notwendig ist:
Für deine C_Infos ist zurzeit angegeben das sie angezeigt werden wenn AI_ProcessInfos für den hero aufgerufen wird
Code:
INSTANCE PC_WashClothes_End (C_Info)
{
npc = PC_Hero;
[...]
}
FUNC INT PC_WashClothes_End_Condition ()
{
return TRUE;
};
Was du willst ist ja das diese Dialogoptionen nur angezeigt werden wenn der hero ein bestimmtes mob nutzt. Du musst also PC_WashClothes_End_Condition() so überarbeiten das nur true zurück gegeben wird wenn das entsprechende mob verwendet wird.
In dieser Funktion lässt sich allerdings nur schwer feststellen welches mob der hero zurzeit verwendet. Daher der Umweg über die Variable PLAYER_MOBSI_PRODUCTION.
In der onStateFunc WashClothes_S1() weisst du welches mob der hero zurzeit verwendet. Wenn du diese Information in PLAYER_MOBSI_PRODUCTION abspeicherst kannst du dann später [in der Funktion PC_WashClothes_End_Condition()] noch leicht erkennen welche Art mob der hero verwendet(beziehungsweise: zuletzt verwendet hat).
Geändert von Cryp18Struct (01.10.2018 um 19:57 Uhr)
-
Okay, ich hab versucht in der AI_constants.d was anzulegen, mein neuer Name wird allerdings nicht rot angezeigt und obwohl der Eintrag nun auch im Script WashClothes.d vorhanden ist, funktioniert es weiterhin bei allen Mobsis
"Es ist nicht schwer, von jedem ethischen Prinzip zu beweisen, dass es in der Praxis scheitern muss, wenn man zugleich voraussetzt, dass allgemeiner Schwachsinn herrscht."
- John Stuart Mill
-
Whenewer you call AI_ProcessInfos - all dialogs assigned to PC_Hero are evaluated -
Code:
FUNC VOID WashClothes_S1 ()
{
var C_NPC her; her = Hlp_GetNpc(PC_Hero);
if (Hlp_GetInstanceID(self) == Hlp_GetInstanceID(her))
{
self.aivar[AIV_INVINCIBLE] = TRUE;
PLAYER_MOBSI_PRODUCTION = MOBSI_WashClothes_S1;
AI_ProcessInfos (her);
};
};
- and those which return in their Condition function value TRUE will be visible:
Code:
FUNC INT PC_WashClothes_End_Condition ()
{
return TRUE;
};
if you want to have this dialog option available only on for MOBSI_WashClothes_S1 - you should change condition function like this:
Code:
FUNC INT PC_WashClothes_End_Condition ()
{
if (PLAYER_MOBSI_PRODUCTION == MOBSI_WashClothes_S1)
{
return TRUE;
};
return FALSE;
};
-
Still works on every mobsi...? Maybe I've done the AI_Constants wrong?
Code:
//****************************************************
// Produktions-Mobsis
//****************************************************
//werden benötigt um eine Unterscheidung der Mobsi beim PC_Hero Dialog vorzunehmen.
const int MOBSI_NONE = 0;
const int MOBSI_SmithWeapon = 1;
const int MOBSI_SleepAbit = 2;
const int MOBSI_MakeRune = 3;
const int MOBSI_PotionAlchemy = 4;
const int MOBSI_PRAYSHRINE = 5;
const int MOBSI_GOLDHACKEN = 6;
const int MOBSI_PRAYIDOL = 7;
const int MOBSI_WASHCLOTHES_S1 = 8;
var int PLAYER_MOBSI_PRODUCTION;
My credit: MOBSI_WASHCLOTHES_S1 doesn't appear in Red in the Stampfer, so I'm not sure if I have done it correctly...
"Es ist nicht schwer, von jedem ethischen Prinzip zu beweisen, dass es in der Praxis scheitern muss, wenn man zugleich voraussetzt, dass allgemeiner Schwachsinn herrscht."
- John Stuart Mill
-
You have to add same condition to each dialog option
Code:
FUNC INT PC_Wash_BEL_Condition ()
{...};
FUNC INT PC_Wash_Ad_Condition ()
{...};
FUNC INT PC_Wash_In_Condition ()
{...};
-
Okay, I've done that, and now I cant wash my clothes in the bed anymore
Another problem appeared - maybe by messing around with the scripts...
Script is now this:
Code:
FUNC VOID WashClothes_S1 ()
{
var C_NPC her; her = Hlp_GetNpc(PC_Hero);
if (Hlp_GetInstanceID(self)==Hlp_GetInstanceID(her))
{
self.aivar[AIV_INVINCIBLE]=TRUE;
Ai_ProcessInfos (her);
};
};
//*******************************************************
// Dialog abbrechen
//*******************************************************
INSTANCE PC_WashClothes_End (C_Info)
{
npc = PC_Hero;
nr = 999;
condition = PC_WashClothes_End_Condition;
information = PC_WashClothes_End_Info;
permanent = TRUE;
description = DIALOG_ENDE;
};
FUNC INT PC_WashClothes_End_Condition ()
{
if (PLAYER_MOBSI_PRODUCTION == MOBSI_WASHCLOTHES_S1)
{
return TRUE;
};
return FALSE;
};
FUNC VOID PC_WashClothes_End_Info()
{
B_ENDPRODUCTIONDIALOG ();
};
INSTANCE PC_Wash_BEL (C_INFO)
{
nr = 2;
npc = PC_Hero;
condition = PC_Wash_BEL_Condition;
information = PC_Wash_BEL_Info;
permanent = TRUE;
description = "Schwarzmagierrobe waschen";
};
FUNC INT PC_Wash_BEL_Condition()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesBel))
{
if (PLAYER_MOBSI_PRODUCTION == MOBSI_WashClothes_S1)
{
return TRUE;
};
return FALSE;
};
};
FUNC VOID PC_Wash_BEL_Info ()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesBel))
{
Npc_RemoveInvItems (hero,ItMi_DirtyClothesBel,1);
CreateInvItems (hero,ItMi_CleanClothesBel,1);
};
};
INSTANCE PC_Wash_Ad (C_INFO)
{
nr = 3;
npc = PC_Hero;
condition = PC_Wash_Ad_Condition;
information = PC_Wash_Ad_Info;
permanent = TRUE;
description = "Wassermagierrobe waschen";
};
FUNC INT PC_Wash_Ad_Condition()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesAd))
{
if (PLAYER_MOBSI_PRODUCTION == MOBSI_WashClothes_S1)
{
return TRUE;
};
return FALSE;
};
};
FUNC VOID PC_Wash_Ad_Info ()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesAd))
{
Npc_RemoveInvItems (hero,ItMi_DirtyClothesAd,1);
CreateInvItems (hero,ItMi_CleanClothesAd,1);
};
};
INSTANCE PC_Wash_In (C_INFO)
{
nr = 4;
npc = PC_Hero;
condition = PC_Wash_In_Condition;
information = PC_Wash_In_Info;
permanent = TRUE;
description = "Feuermagierrobe waschen";
};
FUNC INT PC_Wash_In_Condition()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesIn))
{
if (PLAYER_MOBSI_PRODUCTION == MOBSI_WashClothes_S1)
{
return TRUE;
};
return FALSE;
};
};
FUNC VOID PC_Wash_In_Info ()
{
if (Npc_HasItems (hero, ItMi_DirtyClothesIn))
{
Npc_RemoveInvItems (hero,ItMi_DirtyClothesIn,1);
CreateInvItems (hero,ItMi_CleanClothesIn,1);
};
};
But it doesn't work on the place it should either.
There is now no dialogue at all - the box doesn't even open...
The Script is named WashClothes.d
The onStateFunc on the oCMobinter is "WashClothes" - do i have to change it to "WashClothes_s1" now?
"Es ist nicht schwer, von jedem ethischen Prinzip zu beweisen, dass es in der Praxis scheitern muss, wenn man zugleich voraussetzt, dass allgemeiner Schwachsinn herrscht."
- John Stuart Mill
-
Nein, der _S1 suffix wird automatisch hinzugefügt, der muss/darf nicht enthalten sein. Hast du mal versucht, den Eintrag im Spacer nur in GROSSBUCHSTABEN zu schreiben? Spacer/Mobs sind nicht so ganz meine Sparte, aber daran könnte es hängen.
No, the _S1 suffix is added automatically, it needn't/mustn't be added by yourself. Did you try using only CAPITAL letters in the Spacer? That may be important due to some technicalities.
Edit: See what Fawkes wrote, I missed that.
Geändert von Lehona (02.10.2018 um 16:12 Uhr)
-
Below version from your first post was correct (I assumed you used this one), where game as soon as you use washing mob triggers script WashClothes (_S1 means it is triggered on State 1)
Code:
FUNC VOID WashClothes_S1 ()
{
var C_NPC her; her = Hlp_GetNpc(PC_Hero);
if (Hlp_GetInstanceID(self)==Hlp_GetInstanceID(her))
{
self.aivar[AIV_INVINCIBLE]=TRUE;
PLAYER_MOBSI_PRODUCTION = MOBSI_WashClothes_S1; //This piece is important - here you are defining what dialogs should be visible ;)
Ai_ProcessInfos (her);
};
};
-
Okay, funktioniert jetzt alles, wie ich es will! Vielen Dank
"Es ist nicht schwer, von jedem ethischen Prinzip zu beweisen, dass es in der Praxis scheitern muss, wenn man zugleich voraussetzt, dass allgemeiner Schwachsinn herrscht."
- John Stuart Mill
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
|
|