Quick Modding Questions Thread

Hi team, something I think someone here helped me figure out but am not sure how to do anymore, it's a C++ language question :


How do you refer in a function to "the ID of yourself" ?

Here for example, I just want to pass in my logic the ID of the LeaderHeadInfo (I've put 12 as a placeholder but it's not good enough of course, I need to pass the real ID as first attribute)
This is from CvInfo.cpp :
Code:
void CvLeaderHeadInfo::setHasTrait(int i, bool bNewValue)
{
    if (hasTrait(i) != bNewValue)
    {
        m_pbTraits = bNewValue;
    }
    //2.42n We need to store this, because some leaders will now have new traits and not be played
    GC.getGameINLINE().storeLeaderTrait(12,i,bNewValue);
}
 
How do you refer in a function to "the ID of yourself" ?
You need to store that as an int or better yet LeaderHeadTypes in CvLeaderHeadInfo. Perhaps the easiest way is to add readPass2 and loop leaderheads until getLeaderHead(i).getType() == getType(), in which case you know you have the same. Be aware that the getType() approach naturally won't work for xml files without the Type tag.
 
There's something I'm trying to achieve.
There is this nice electric railroad nif to which I'd like to add wires.
This is what I tried so far:
1755772552369.png

I duplicated the tracks, moved them on the Z axis and changed the texture:
1755772918856.png

But the tracks texture has changed along with it. So is there an easy way to avoid that?
 
You need to store that as an int or better yet LeaderHeadTypes in CvLeaderHeadInfo. Perhaps the easiest way is to add readPass2 and loop leaderheads until getLeaderHead(i).getType() == getType(), in which case you know you have the same. Be aware that the getType() approach naturally won't work for xml files without the Type tag.
Thank you so much for quick reply.
Spent the evening on it, had to attack the problem differently but resolved my issue(s) and got my new feature working ! Pfiou ! I think it removes all the bugs I know of from my mod :king:
 
Back
Top Bottom