Aller au contenu

Photo

Need some advice!


  • Veuillez vous connecter pour répondre
13 réponses à ce sujet

#1
K Kin

K Kin
  • Members
  • 109 messages

I need some advice on my module, which involves the spells and magic in general.

 

 

So my melee and ranger combat styles work perfectly, but I'm having trouble with magic.

 

The creatures of my module are neutral, but once attacked, they become hostile. This helps players the ability to level up without 10+ monsters crowding them. So it's a simple, right-click < attack.

 

This doesn't work with magic, since you would have to physically attack them first to change faction, and you can't cast a spell on a neutral.

 

I see the factions only favor one way, example;

 

Hostile is hostile to Player, which of course means the Player is hostile to Hostile.

 

Is it possible to make this: Player is hostile to Hostile. Hostile is neutral to Player.

 



#2
kevL

kevL
  • Members
  • 4 061 messages

of course there is no entries in the FactionTable for how player feels about 'faction'

The problem as you point out is that hostile spells can't target non-hostiles. The issue was hashed over in a thread some months ago; iirc Lance brought it up, and i think suggested a GUI hotbtn that turns a faction temporarily hostile, allowing a hostile spell to be targeted.


i implemented it, after a fashion, and can say it's not trivial,

/cofee.

ps. If someone, or i, come up with a better idea, love to hear it!



#3
rjshae

rjshae
  • Members
  • 4 491 messages

Does setting 'PvP Allowed?' on an area have any effect on whether the PC can target a neutral? I haven't tried it myself.



#4
K Kin

K Kin
  • Members
  • 109 messages

Does setting 'PvP Allowed?' on an area have any effect on whether the PC can target a neutral? I haven't tried it myself.

 

Nah, that doesn't work :P



#5
K Kin

K Kin
  • Members
  • 109 messages

of course there is no entries in the FactionTable for how player feels about 'faction'

The problem as you point out is that hostile spells can't target non-hostiles. The issue was hashed over in a thread some months ago; iirc Lance brought it up, and i think suggested a GUI hotbtn that turns a faction temporarily hostile, allowing a hostile spell to be targeted.


i implemented it, after a fashion, and can say it's not trivial,

/cofee.

ps. If someone, or i, come up with a better idea, love to hear it!

 

Is the thread still accessable?



#6
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi,

Yes, as KevL said, I did manage to implement this idea into my module. You have to be very careful when implementing this, as it can be tricky to ensure the player does not make enemies in the wrong way.

I will try to dig out the thread.
 
Sadly, my web info does not go back far enough to cover this thread and I cannot recall it's topic title to search for it. Instead, I have included some extracts of my code, which you can pick through if you like. One of the key factors is creating an ANTIPARTY faction, which is only hostile to PCs.

(When my mod is released, you can check out how I implemented it in full.)

Hope that gives some helpful pointers ... Bear in mind that the code below covers *many* other aspects of my own module that you can probably ignore.

Regards,
Lance.
 
EDIT:
 
XML EXTRACT:

<!-- Make HOSTILE & Close Button -->
<UIButton name="HostileCloseButton" x=349 y=8 width=25 height=25
OnLeftClick0=UIButton_Input_ScreenClose() OnLeftClick1=UIObject_Misc_ExecuteServerScript("gui_examine","HostileToggle")
OnToolTip='UIObject_Tooltip_DisplayTooltipString("Toggle target HOSTILE/NEUTRAL setting to allow spell targeting","OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")'>
<UIFrame state=up fill="ife_attack.tga" />
<UIFrame state=down fill="ife_attack.tga" />
<UIFrame state=focused fill="ife_attack.tga" />
<UIFrame state=hilited fill="ife_attack.tga" />
<UIFrame state=hifocus fill="ife_attack.tga" />
<UIFrame state=disabled fill="ife_attack.tga" />
</UIButton>



SCRIPT EXTRACT:

/////////////////////////////////////////////////////////////////////////////////////////
// EXAMINE GUI (HOSTILE BUTTON) - TOGGLE TARGET HOSTILITY BUTTON (ALLOWS SPELL TARGETING)
/////////////////////////////////////////////////////////////////////////////////////////

if(sOption == "HostileToggle")
{
// PROTECT PLOT CREATURES
SetLocalObject(oMainPC, "NPCTarget", oTarget);

if(GetGlobalInt("TESTMODE") > 0){SendMessageToAllPCs("TARGET TAG: " + sTag);}

// SEND AN INT TO ENSURE NO NEGATIVE REACTION FROM GENERIC TARGET (BUT FIRES QH INFO STILL IF AVAILABLE i.e. IF RETURNS 1)
int IGNORE = 0; if(NPCStateCheck(oMainPC, sTag, 1) == 1){IGNORE = 1;}

if(GetGlobalInt("TESTMODE") > 0){SendMessageToAllPCs("IGNORE VAL: " + IntToString(IGNORE));}

if(IGNORE == 0)
{
string sReport = CRED + "Target made: HOSTILE (Party AI Disabled)";

if(GetLocalInt(oTarget, "CoolDown") != -1)
{
SetLocalInt(oTarget, "CoolDown", -1);

// TURN ANTI-PARTY BY DEFAULT
object oAnti = GetObjectByTag("SETFACTION_ANTIPARTY");

// UNLESS KNOWN FOR EVIL, IN WHICH CASE TURN HOSTILE (TO PREVENT ALLIES COMING TO AID)
// NB: THIS DOES NOT CHANGE THE DEFAULT FACTION YET - SO PC CAN "UNHOSTILE" THE NPC IF NOT ATTACKED
//if(GetAlignmentGoodEvil(oTarget) == ALIGNMENT_EVIL){oAnti = GetObjectByTag("SETFACTION_HOSTILE");}

// NB: COULD NOT DO ABOVE LINE, AS IT WOULD MAKE THE CREATURE ATTACK OTHERS NEARBY
// CHANGE TO HOSTILE IN THE ACTUAL ATTACK USING CHECKAGGRO FUNCTION !!!!!!!!!!!!!!

ChangeFaction(oTarget, oAnti);

// DISABLE PARTY AI REGARDLESS TO PREVENT AUTO ATTACK (TURN ALL PCS PUPPET MODE)
object oFM = GetFirstFactionMember(oPC, FALSE);

while(oFM != OBJECT_INVALID)
{
int BYPASS = 0;

// NOT FOR HENCHMEN, SUMMONED OR FAMILIARS
if(GetAssociateType(oFM) == ASSOCIATE_TYPE_HENCHMAN
|| GetAssociateType(oFM) == ASSOCIATE_TYPE_ANIMALCOMPANION
|| GetAssociateType(oFM) == ASSOCIATE_TYPE_FAMILIAR
|| GetAssociateType(oFM) == ASSOCIATE_TYPE_SUMMONED){BYPASS = 1;}
if(BYPASS == 0){AssignCommand(oFM,SetAssociateState(NW_ASC_MODE_PUPPET,TRUE));} // PLAYER MUST ORDER

oFM = GetNextFactionMember(oPC, FALSE);
}
}

// ONLY ALLOW TOGGLE OF PREVIOUSLY TOGGLED (i.e. Not a substitute for "Sorry")
else if(GetLocalInt(oTarget, "CoolDown") == -1)
{
AssignCommand(oTarget, ClearAllActions(TRUE));
AssignCommand(OBJECT_SELF, ClearAllActions(TRUE));
DeleteLocalInt(oTarget, "CoolDown");
ChangeFaction(oTarget, DEFAULTFACTION);
sReport = CGREEN + "Target made: NON HOSTILE";

// REQUIRES RESTART WHEN GOING BACK TO NON HOSTILE
DeleteLocalInt(oTarget, "WP_SETUP");
}

// INFORM PLAYER
SetNoticeText(oPC, sReport);

// KEEP WALKERS WALKING
//DeleteLocalInt(oTarget, "WP_SETUP");
SetLocalInt(oTarget, "STOPANIMS", 1);
SetLocalInt(oTarget, "FORCEWALK", 1);
} // END IGNORE
} // END HOSTILE TOGGLE

#7
kevL

kevL
  • Members
  • 4 061 messages

i think this is it

What script does the spell casting GUI call?


ps. change 'months' in my last post to 'years' ...



#8
K Kin

K Kin
  • Members
  • 109 messages

Thanks so much Lance!

 

My last question is,

 

Anyone know the 2da id/line for cast spell unique power self?

I just edited my spells 2da, forgetting that one (it happened to me ages ago), I wasn't able to use any items with it, since I deleted the line in my 2da by mistake, but I can't find the line at all :s



#9
Dann-J

Dann-J
  • Members
  • 3 161 messages

Activate_Item_Self is line 413 in spells.2da.


  • GCoyote aime ceci

#10
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

i think this is it

What script does the spell casting GUI call?


ps. change 'months' in my last post to 'years' ...


Hi KevL,

Of course, I forgot you could change the time reference. Well done! EDIT: Mind you, I cannot see where I can change it from "My Content" anymore. Can you still do that change in there too? 
 

Thanks so much Lance!
 
My last question is,
 
Anyone know the 2da id/line for cast spell unique power self?

I just edited my spells 2da, forgetting that one (it happened to me ages ago), I wasn't able to use any items with it, since I deleted the line in my 2da by mistake, but I can't find the line at all :s


Hi K Kin,

You're welcome. :)

The default install directory showing the spells.2da (assuming you have both expansions) is C:\Program Files (x86)\Atari\Neverwinter Nights 2\Data\2DA_X2.zip\2DA_X2. That folder contains copies of the latest 2da updates. Look in nearby folders if this latest ever does not show the 2da you are looking for. (The latest Spells.2da is in that one though.)

*** WARNING: BE CAREFUL NOT TO EDIT THIS ORIGINAL COPY - USE FOR REFERENCE ONLY ***

ACTIVATE_ITEM_SELF IS 413
ACTIVATE_ITEM_SELF2 is 428

However, there are also a few others that refer to ACTIVATING ITEMS that may be something you need.

ALSO, if you move YOUR edited spells.2da out of the way and reload the toolset, it should reload the default one for you to look at again.

EDIT: I also have this blog post with some images: http://worldofalthea...n-neutrals.html (Undergone some design changes since this blog post.)

Cheers,
Lance.

#11
kevL

kevL
  • Members
  • 4 061 messages

Of course, I forgot you could change the time reference. Well done! EDIT: Mind you, I cannot see where I can change it from "My Content" anymore. Can you still do that change in there too?


[edit] hey Lance,
i keep a link on my desktop that points here:

https://www.google.c...f&aqi=&aql=&oq=

The field at Goog's comes up with:
site:forum.bioware.com nwn2

then i just type in a space + what I'm looking for, in this case I think it was " Lance gui hostile"

the first return got it. /cheers

#12
K Kin

K Kin
  • Members
  • 109 messages

Sigh, one problem door closes, another opens.

 

I had all activated related spells with my spells.2da (in override), and yet it still didn't work.

 

I took the file out of my override and then tested again, and the unique power's there.

 

What could be causing this?

 

 2334588c84.jpg



#13
kamal_

kamal_
  • Members
  • 5 250 messages

You only get one spells.2da. Between your module, your campaign, your module's haks, and the override, there's apparently more than one.



#14
K Kin

K Kin
  • Members
  • 109 messages

You only get one spells.2da. Between your module, your campaign, your module's haks, and the override, there's apparently more than one.

 

Yeah, I learnt from this mistake before lol

 

I've 200% checked everywhere, even searched my entire pc for anything related to spells.

 

When I remove the override, I get every spell back, so that must mean that there isn't 2 spell.2das

I've only touched spells, and that involves removing every spell but 10, so it would be obvious if I had like 2 spells available at level 1.