Aller au contenu

Photo

Using feats while wildshaped - possibly custom GUI required


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

#1
Loki_999

Loki_999
  • Members
  • 430 messages

One perhaps for Lance or other GUI gurus.

 

I'm looking at giving some races ability to change shapes and keep the ability to use feats. Additionally to this, it would be nice to allow things like druids with knockdown to be able to use such feats while wildshaped.

 

Now when EffectPolymorph is called it disables all hotbar icons and feat usage (and spell usage if don't have Natural Spell), and as far as i can tell this is all hardcoded.

 

At first i thought i could re-enable the hotbar after polymorph, but then realized the bar isn't disabled, just the buttons, and not sure i can affect them via script. (correct me if im wrong - they seem to be controlled by hardcoded functions)

 

So, i see two ways forward.

 

1) Instead of polymorph, use SetAppearance() - this can be made to work, with some checks to fix problems like logging off while shifted and being stuck in the wrong shape, but also then need to consider how to restrict things like inventory/item usage where appropriate, which is going to be trickier.

 

2) Custom GUI that comes up when the polymorph kicks in. This would have a list of feats that would populate it - i guess a dynamic listbox - so some common feats, like knockdown, sacred fist abilities, etc, and then the special shapes special abilities, eg Mindflayer psionic blast, vampire gaze, etc.

 

What would be ideal is if the 3 spell effects that are listed in polymorph.2da and worked in NWN1 could somehow be reactivated - but i guess for reasons unknown Obsidian disabled all that with no way of reactivating.

 

Any thoughts?



#2
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi Loki_999,

The problem you face is that you are directly contradicting the "hard rules". i.e. A polymorphed creature, is, due to the very nature of the polymorph, debilitated in other ways, like ability to use certain spells and feats.

That said, if you call the effect an "illusion" rather than a true "polymporph", and the true build of the creature is only hidden by an illusion effect (and not actually transformed), then using the SetAppearance might work. The point being, you would have to call the effect an "illusion" rather than a "polymorph" as the latter should, by design, prevent those other abilities from taking effect.

Now, the next thing to check would be if SetAppearance actually changes a creatures stats in any way (like the polymorph effect) .. or is it its own unique effect that does exactly that ... purely set the creatures appearance and nothing else.

If using SetAppearance only changes the appearance and NOT any stats, then it may well be that non of these feats or spells will be affected by using the SetAppearance function anyway. In which case, you simply make a potion/spell/device that says "Postion of Illussory Creature ... XXX" and have it run a SetAppearance script instead of a polymorph effect.

Noting the nature of the effect (i.e. illusion and not a real polymorph) also means access t the inventory should NOT be restricted anyway, which means the inventory problem you mention is not actually a problem. :)

I'll do a quick test and see what happens ... back in a bit.


Lance.


EDIT:

NB: This is very basic test script only ... and does not cater for quick taking potions one after another. To ensure the original state can be retrieved, one should make the original appearance attach as a variable to the PC from the moment of their spawning, so it can be recalled later.

Yes, a potion using tagged based scripting works just fine, as it does not affect the creature stats at all and changes the appearance. Although, there was an oddity in the new appearance in my testing ... the ogre's head had parts missing by the looks of it. (A hint that it was an illusion maybe. ;) ) Anyway, here is the code that changes the PC into an OGRE for 20 seconds before changing them back:-
 

#include "x2_inc_switches"

void main()
{

	if (GetUserDefinedItemEventNumber() !=  X2_ITEM_EVENT_ACTIVATE){return;}
	
	object oPlayer = GetItemActivator();	
	
        // STORE ORIGINAL APPEARANCE (THIS SHOULD HAVE BEEN DONE ON SPAWN IDEALLY)
	int iORGAPP = GetAppearanceType(oPlayer);
	
	SetCreatureAppearanceType(oPlayer, APPEARANCE_TYPE_OGRE);
	
	DelayCommand(20.0, SetCreatureAppearanceType(oPlayer, iORGAPP));
	

}

Tagged based scripting .... Give the above script a name, like, "alb_poly_ogre" and then make sure you have the potion bottle (or whatever you are using) have a tag with the same name. Assign the potion the Cast Spell: Unique Power Self Only and make it identified ... drop in area and drink test ... cause mayhem ... back to norm.

EDIT 2: You said, "What would be ideal is if the 3 spell effects that are listed in polymorph.2da and worked in NWN1 could somehow be reactivated - but i guess for reasons unknown Obsidian disabled all that with no way of reactivating."

What do you mean? Can you explain this more precisely. Thanks!

Lance.



#3
4760

4760
  • Members
  • 1 212 messages

Now, the next thing to check would be if SetAppearance actually changes a creatures stats in any way (like the polymorph effect) .. or is it its own unique effect that does exactly that ... purely set the creatures appearance and nothing else.

If using SetAppearance only changes the appearance and NOT any stats, then it may well be that non of these feats or spells will be affected by using the SetAppearance function anyway. In which case, you simply make a potion/spell/device that says "Postion of Illussory Creature ... XXX" and have it run a SetAppearance script instead of a polymorph effect.

According to my tests (I need to have the player look like a child):

- SetAppearance does keep everything, except the way the creature looks like,

- which in my case eventually led to a crash as the original skeleton is not necessarily compatible with the new appearance.

- It seems it doesn't work for multi-parts creatures (like Lance, I got the body but no head, when I tried to keep appearances based on the same model).

 

To put it in a nutshell: as of today, I couldn't get it to work as I want.

I briefly looked at the polymorph.2da to see if I could add a line for the new appearance, but didn't try as EffectPolymorph also prevents access to the inventory or spells.



#4
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

According to my tests (I need to have the player look like a child):
- SetAppearance does keep everything, except the way the creature looks like,
- which in my case eventually led to a crash as the original skeleton is not necessarily compatible with the new appearance.
- It seems it doesn't work for multi-parts creatures (like Lance, I got the body but no head, when I tried to keep appearances based on the same model).
 
To put it in a nutshell: as of today, I couldn't get it to work as I want.
I briefly looked at the polymorph.2da to see if I could add a line for the new appearance, but didn't try as EffectPolymorph also prevents access to the inventory or spells.


Eventually "leading to a crash" does not sound good. :( Although I did not experience any crashing, I would not want to endorse something that ran the risk of it. Was the risk only relevant to multi-part (NULL_???) creatures? e.g. NULL_Human. Are all player characters multi-part ... or can they be selected as "single part" from creation? (I have no idea about this sort of thing.)

Alternatively, are we saying that some appearances work OK (without crashing) and so would be "permitted" as potions? i.e. Limit the use of appearance changes to those that work reliably?

Cheers,
Lance.

#5
4760

4760
  • Members
  • 1 212 messages

No, as far as I can tell being multi-parts or one mesh only is not the cause for the game crashing. It will only show the body, not the head or wings.

 

The crash I experienced was when I set the appearance of a child to a dwarf. True, I assumed it was a problem between the skeletons that caused it, but didn't really look for the reason.



#6
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

No, as far as I can tell being multi-parts or one mesh only is not the cause for the game crashing. It will only show the body, not the head or wings.
 
The crash I experienced was when I set the appearance of a child to a dwarf. True, I assumed it was a problem between the skeletons that caused it, but didn't really look for the reason.


I will try this same change and observe what happens (from the crash perspective) as well the, Just to be in the know. :)

Cheers,
Lance.

#7
4760

4760
  • Members
  • 1 212 messages

Thanks, I may have broken something in the appearances.2da...



#8
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Thanks, I may have broken something in the appearances.2da...


Hi 4760,

While I did not experience a crash, I did end up invisible. :D

I used:- SetCreatureAppearanceType(oPlayer, 553); and was playing a drow (Adaur) at the time. Playing a different race may well have crashed me.

Bottom line is, though, I jus got lucky with my ogre test I guess, and even then it was not perfect. :(

Cheers,
Lance.

#9
Loki_999

Loki_999
  • Members
  • 430 messages

Thanks for the responses and investigations guys.

 

Especially useful to  know i may need to do some thorough testing if i go the SetAppearance route.

 

There is a very good reason for not using SetAppearance in a PW environment though, and that is if a player logs off or crashes with their appearance set to something other than their own, the BIC saves with that appearance - ie, they get stuck in that appearance (which can be solved by giving a feat that turns them back to their base form).

 

EDIT 2: You said, "What would be ideal is if the 3 spell effects that are listed in polymorph.2da and worked in NWN1 could somehow be reactivated - but i guess for reasons unknown Obsidian disabled all that with no way of reactivating."

 

 

 

What do you mean? Can you explain this more precisely. Thanks!

 

 

In polymorph.2da there are 3 columns for 3 spell like abilities that could be used while polymorphed. This worked in NWN1 and was used for the Mindflayer form as i recall.

 

I think i will be best served by using polymorph over SetAppearance considering the risks.... so need to think how badly do i want to implement a custom gui to handle feat usage while polymorphed.



#10
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Thanks for the responses and investigations guys.
 
Especially useful to  know i may need to do some thorough testing if i go the SetAppearance route.
 
There is a very good reason for not using SetAppearance in a PW environment though, and that is if a player logs off or crashes with their appearance set to something other than their own, the BIC saves with that appearance - ie, they get stuck in that appearance (which can be solved by giving a feat that turns them back to their base form).


I commented on this in my previous post. :) I would not have thought it to be an issue if the PW server simply records the original appearance of the PC on the PC itself at time of creation and then simply forced a APPEARANCE RESET every time the player re-joined with that PC. Furthermore, another variable could be set in place to do a second check to see if the player did crash and offer a GUI asking if they wanted the remaining time of different appearance set on their PC. At the very worst, it would mean the PC would have to re-join the server to reset their appearance correctly before going anywhere else. Perhaps a PW agreement that original appearances should be recorded in something like "ORGAPPEAR" (for original appearance) on the entering character, so that in the event of a crash, it did not matter which PW the player joined with that PC, as the same code code be used to reset the original appearance on all PWs. And, of course, I would have thought a simple bit of coding would reset the appearance of a "broken" PC if need be. So, unless the game engine somehow corrupts every thing about the way appearance work, then I don't think this is an issue.
 

In polymorph.2da there are 3 columns for 3 spell like abilities that could be used while polymorphed. This worked in NWN1 and was used for the Mindflayer form as i recall.
 
I think i will be best served by using polymorph over SetAppearance considering the risks.... so need to think how badly do i want to implement a custom gui to handle feat usage while polymorphed.


I don't recall that ... but it has been a while since I looked at the NWN toolset and such. :) In theory, I don't see why you could not add a GUI to allow "certain" feats to work. After all, if you code it as separate scripts, then I don't think the game engine can stop it ... although I have never tried ... and is not an area of the game I have delved into too much.

Why not try taking a copy of an OC XML, renaming it, and trying to access it from in game, and then slowly alter it to what you need. My tutorial comes with example XML code and demo module to get you started as well. I will try and answer any questions you may have.

All the best,
Lance.

#11
Loki_999

Loki_999
  • Members
  • 430 messages

Yeah, i've done plenty of XML now... just considering the effect required for this feature.

 

But yeah, we can store original appearance on our "Essence" object which all pcs have.  Its a consideration.



#12
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Yeah, i've done plenty of XML now... just considering the effect required for this feature.
 
But yeah, we can store original appearance on our "Essence" object which all pcs have.  Its a consideration.


Hi,

Storing on the PC itself is even more personal, and possibly more reliable ... if you see what I mean?

Interesting, "Essences" play a big part in my campaign too ... ;)

Cheers,
Lance.

#13
Loki_999

Loki_999
  • Members
  • 430 messages

Nope, in a PW environment any variables stored on the PC object itself are lost on server reset... no idea why. They stay fine when you logoff/logon, just once the server resets, so do any vars on your PC. We use this to our advantage for some things, but for everything that needs to be persistent, we have the essence object.



#14
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Nope, in a PW environment any variables stored on the PC object itself are lost on server reset... no idea why. They stay fine when you logoff/logon, just once the server resets, so do any vars on your PC. We use this to our advantage for some things, but for everything that needs to be persistent, we have the essence object.


Woh! I never knew that! Then again, I use the "SetCampaignXXX" functions for anything I want persistent, using the PC name as a unique identifier. e.g. SetCampaignInt("MrBlogs_ORGAPPEARANCE", 6); when "MrBlogs" logs in .... kind of thing. Then I read the data back on a reload ... but then again, you probably use a different database system ... I forget what they call it ...

It does make you wonder how the engine remembers appearances then? There must be a setting somewhere stored on the BIC perhaps?

Anyway, I hear what you say. :)

All the best,
Lance

#15
Loki_999

Loki_999
  • Members
  • 430 messages

Yeah, behaviour of the game engine at times is plain bizarre.



#16
4760

4760
  • Members
  • 1 212 messages

Nope, in a PW environment any variables stored on the PC object itself are lost on server reset... no idea why. They stay fine when you logoff/logon, just once the server resets, so do any vars on your PC.

It is true for campaigns in solo mode too: if you switch from one module to another, the variables stored on the PC will still exist in the next module. If on the other hand you save the PC while waiting for the next module of the campaign to be released, then all variables stored on the PC will be deleted. What I do now is give a "gem of tracking" which stores all variables that need to be kept (reputation, romance, achievements, things like that).