logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
SetEffectCreator?

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development
View previous topic :: View next topic  
Author Message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Mar 29, 2016 17:56    Post subject: SetEffectCreator? Reply with quote

Does SetEffectCreator from nwnx_structs work?

I am calling it in this context.

Code:

eEffect = GetEffectFromID(theGene.EffectType, theGene.EffectNumber1, theGene.EffectNumber2);
SetEffectCreator (eEffect, oEffectCreator);         ApplyEffectToObject(DURATION_TYPE_PERMANENT,eEffect,oPC);


The idea is that I will have an NPC in the module, set as the designated creator of effects from within a subrace engine.
However, when I have the SetEffectCreator in - the effects don't seem to be applied. (When I do a While loop on the creatures effects, its doesn't enter the loop because there are no valid effects.

NWNX structs logs return the following:

Quote:

StrReq: "SETCREATOR"
Params: "f"
Return: "f"


There only is one creature in the module, so I guess that might be valid?
Am I using the right plugin for this?
nwnx_effects doesn't seem to offer setcreator capabilities.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Mar 29, 2016 21:38    Post subject: Reply with quote

It looks like I need nwnx_effects installed as well.
I am having trouble compiling however.

Quote:

CMake Error at CMakeLists.txt:6 (add_module):
Unknown CMake command "add_module".


CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.Cool

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!



I tried to compile on ubuntu via

Quote:

sudo cmake .


Can someone walk me through how to compile nwnx_effects - The other plugins compile fine, but when I try to build via

Quote:

./configure --with-extraplugins="serverlist effects jvm odmbc"
make ODMBC_MYSQL=1


It complains that there is no MakeFile.in
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Wed Mar 30, 2016 13:46    Post subject: Reply with quote

Where did you grab the effects plugin from, and how exactly are you compiling it?

Some prelim notes:

- You should never use the configure script (we even deleted it!). It's all cmake now. Run cmake in the toplevel dir, then type "make pluginname".
- NEVER EVER run cmake or make as root. EVER. Seriously.
_________________
silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Mar 30, 2016 14:03    Post subject: Reply with quote

I think my nwnx is a fork/branch of this
https://github.com/jd28/nwnx2-linux

I am close to getting it to compile, however after installing cmake 3.5.1 (my old cmake was 2.Cool - I now get errors saying that the

h_CExoArrayList_CGameEffect_Insert.cpp file requires compiling with a special compiler option in order to make it ISO compliant.

Quote:

gcc -mtune=i386 -pipe -mno-accumulate-outgoing-args -Wall -Werror -D_REENTRANT -D_THREAD_SAFE -I. -I.. -I../.. -I ../../include -I/usr/local/include -c -o hooks/h_CExoArrayList_CGameEffect_Insert.o hooks/h_CExoArrayList_CGameEffect_Insert.cpp
In file included from /usr/include/c++/4.6/tuple:35:0,
from hooks/h_CExoArrayList_CGameEffect_Insert.cpp:20:
/usr/include/c++/4.6/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
hooks/h_CExoArrayList_CGameEffect_Insert.cpp: In function ‘bool compare(int32_t, CGameEffect*, CGameEffect*)’:
hooks/h_CExoArrayList_CGameEffect_Insert.cpp:30:16: error: ‘tie’ is not a member of ‘std’
hooks/h_CExoArrayList_CGameEffect_Insert.cpp:31:16: error: ‘tie’ is not a member of ‘std’
hooks/h_CExoArrayList_CGameEffect_Insert.cpp:58:12: error: ‘tie’ is not a member of ‘std’
hooks/h_CExoArrayList_CGameEffect_Insert.cpp:59:12: error: ‘tie’ is not a member of ‘std’
hooks/h_CExoArrayList_CGameEffect_Insert.cpp:61:1: error: control reaches end of non-void function [-Werror=return-type]
cc1plus: all warnings being treated as errors
make[1]: *** [hooks/h_CExoArrayList_CGameEffect_Insert.o] Error 1
make[1]: Leaving directory `/var/lib/jenkins/jobs/nwnx_linux/workspace/plugins/effects'
make: *** [plugins/effects] Error 2


If I add the compiler option, it then stops everything else from compiling

Quote:

gcc -std=gnu++0x -mtune=i386 -pipe -mno-accumulate-outgoing-args -Wall -Werror -D_REENTRANT -D_THREAD_SAFE -I. -I.. -I../.. -I ../../include -I/usr/local/include -c -o funcs/f_GetACByType.o funcs/f_GetACByType.c
cc1: error: command line option ‘-std=gnu++0x’ is valid for C++/ObjC++ but not for C [-Werror]


Am I missing a dependency or something?
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Wed Mar 30, 2016 14:10    Post subject: Reply with quote

Baaleos wrote:
I think my nwnx is a fork/branch of this
https://github.com/jd28/nwnx2-linux


That's jmd's branch. NO idea what's going on in there! I can only speak for the upstream one.

But to compile nwnx_structs and use SetEffectCreator, you don't need nwnx_effects. It should work just fine out of the box like you're using it. All it does it set the effectCreator field, as you can see here: https://github.com/NWNX/nwnx2-linux/blob/master/plugins/structs/funcs/f_SetCreator.c
_________________
silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Mar 30, 2016 14:21    Post subject: Reply with quote

Thats strange -
Let me try structs on its own again - to see if it works.
I have a unit-test nss setup on my test box that sets effects on an npc.

(Question : Does the structs call have to be done before applying, or after?)
Or does it matter?
Back to top
View user's profile Send private message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Wed Mar 30, 2016 14:22    Post subject: Reply with quote

Baaleos wrote:
Thats strange -
Let me try structs on its own again - to see if it works.
I have a unit-test nss setup on my test box that sets effects on an npc.

(Question : Does the structs call have to be done before applying, or after?)
Or does it matter?


Works for me doing it before.
_________________
silm.pw, a player-driven Forgotten Realms NWN1 persistent world for tinkerers.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Mar 30, 2016 14:47    Post subject: Reply with quote

Seems to be working now.
Odd - Wonder why it didn't work before.

Im using this for my new Subrace/Genetics system im building.






Code:


void TimeDelayedCheck(object oPC){
   
   int FoundRegen = 0;
   int FoundImmunity = 0;
   
   effect e = GetFirstEffect(oPC);
   while(GetIsEffectValid(e)){
      
      int iType = GetEffectType(e);
      object o = GetEffectCreator(e);
      WriteTimestampedLogEntry("Found Effect made by "+GetName(o));
      
         switch(iType)
         {
            case EFFECT_TYPE_REGENERATE:
               FoundRegen = 1;
            break;
            case EFFECT_TYPE_DAMAGE_IMMUNITY_INCREASE:
               FoundImmunity = 1;
            break;
            
         }
      e = GetNextEffect(oPC);
   }
   
   WriteTimestampedLogEntry("Regen Found = "+IntToString(FoundRegen));
   WriteTimestampedLogEntry("Immunity Found = "+IntToString(FoundImmunity));
}

void main(){


    struct InhumanGenome ElectricalGenome;
    ElectricalGenome.GenomeID = "Electrical Manipulation";
    ElectricalGenome.Description = "Bearers of this genome are resistent to electrical discharges and can create electrical currents with their bodies.";

    struct Gene Power1;
    Power1.GeneName = "Regeneration 2HP every 10 Seconds";
    Power1.FeatID = -1;
    Power1.IsPassive = TRUE;
    Power1.EffectType = EFFECT_TYPE_REGENERATE;
    Power1.TimeOfDayActive = TIME_BOTH;
    Power1.EffectNumber1 = 2;   //2 hp
    Power1.EffectNumber2 = 10;  //every 10 seconds
    Power1.LevelOfPower = 1;
   Power1.AlwaysActive = 1;
    Power1.VisualEffect = VFX_DUR_AURA_BLUE_LIGHT;
    int RegenID = CreateGenomePower(Power1);

    struct Gene Power2;
    Power2.GeneName = "Immune to 50% Electrical";
    Power2.FeatID = -1;
    Power2.IsPassive = TRUE;
    Power2.EffectType = EFFECT_TYPE_DAMAGE_IMMUNITY_INCREASE;
    Power2.TimeOfDayActive = TIME_BOTH;
    Power2.EffectNumber1 = DAMAGE_TYPE_ELECTRICAL;  //2 hp
    Power2.EffectNumber2 = 50;  //every 10 seconds
    Power2.LevelOfPower = 1;
   Power2.AlwaysActive = 1;
    Power2.VisualEffect = VFX_DUR_AURA_BLUE_LIGHT;
    int ElectricalResist = CreateGenomePower(Power2);


    CreateInhumanGenome(ElectricalGenome);
    AddGeneToGenomeStruct(ElectricalGenome,RegenID);
    AddGeneToGenomeStruct(ElectricalGenome,ElectricalResist);




    object oTester = GetObjectByTag("genetic_unit_test");
    AddGenomeToCreature(oTester, "Electrical Manipulation", TRUE);
    DelayCommand(10.00,TimeDelayedCheck(oTester));
}



The effect creator is going to be how I determine if effects on the creature are genetic granted effects or not.


This unit test is a little old though.
The new struct for my Gene/Genome looks like this:

Code:

struct Gene
{
    string GeneName;
    int FeatID; //-1 for no feat
    int IsPassive; //1 for yes, 0 for no: Determines if the Heartbeat will apply effect or not: 0 will save processing power for feat granting genes
    int EffectType; // Used for Passives - Effects are always created by the GENE_CREATOR object (so we can distinguish between gene effects and other effects)
    int TimeOfDayActive; //Used to determine when ability is active or usable (TIME_BOTH for always);
   int EnvironmentNatural; // Is this active in natural areas only
   int EnvironmentInterior; // Is this active in Outdoors areas only
   int EnvironmentAboveGround; // Is this active underground areas only
   int EnvironmentTilesetType; //Used to activate the gene when on a specific tile type (Water etc);
   int AlwaysActive;
   int LightSensitive;
   int ApplyDamageAmount; // Amount of damage to apply on heartbeat when conditions are met (0 for no damage)
   int DamageType; //Used when there is a damage Amount to apply
    int EffectNumber1;
    int EffectNumber2;
    int LevelOfPower;
    int VisualEffect;   //If there is an associated visual (auras etc)
};
struct InhumanGenome
{
    string GenomeID;
    string Description;
};




So my hope is that my heartbeat script will be able to turn genes on and off depending on the conditions programmed into them individually.

Eg: Receive regeneration while standing in a puddle of water - for a water race.

(Uses nwnx_funcsext - for the GetSurface method - to determine if standing in water)

Using this logic, its not so much about building subraces that have set attributes, its about developing genetic traits that would then imply a subrace.

Eg: Its not being a vampire that makes you take sunlight damage.
But taking sunlight damage could imply that you are a vampire.
Because you have a gene that tells you to take damage in the sun.

After I get this system up and running, I plan on making a hereditary system. (Eg: Inherit traits genetically : using realistic dominant and recessive genes)
Eg: two characters with recessive sunlight damage gene can bear a sunlight damage child etc
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group