Aller au contenu

Photo

Help required on a few scripts for Arcane Archer.


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

#26
BloodRiot

BloodRiot
  • Members
  • 26 messages

When I mentioned the quickspell i meant aesthetically similar. I noticed the same as you that it seems to have alot of hardcoding behind it. Not wanting to dig into that can of worms I decided as you correctly guessed, to work my own XML which in truth is pretty much an expanded version of this example here: http://gameofthrones...tbox-guide.html

Except I made it to work with several lists and with buttons instead of texts.

My Arcane Archer is being worked in a similar fashion to Kaedrin in that it's a bunch of stuff in the override folder. Could that be it? It has no link to any specific module whatsoever.

 

EDIT: Your sugested change didn't help i'm afraid.

I have to work now so I can onl take another look at this later on. Thanks for the help and attention so far. Hopefully we can tackle this annoying problem.

Cheers.



#27
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi Again,

EDIT: OK. I replaced the code I originally had here with something that works more along the lines the sort of thing you were after. :)
 
NB: It's cut down a bit, as I was simply working in one area to make sure at least that bit worked.

EDIT 2: This now brings up the "TARGET" prompt, but does not appear to fire both scripts. It may be that using the TARGET XML this way prevents further scripts from running. I left both lines in the XML below anyway. The gui_testmessage script fails to fire while the gui_zapcreature works!

EDIT 3: With reference to the lines below, it appears you *cannot* have the UIObject_Misc_ExecuteServerScript work at this point here, alongside UIObject_Input_ActionTargetScript. I have not tested to see if the UIObject_Misc_ExtractData can be used to send the relevant data back to the executing script by changing the line of its location of execution. Ideally we would want to be able to send the data of the spell selected along with the target selected. I guess there may be a way to do this by playing around with the various lines (even adjusting at which point they send back their data), but this would take some more messing around.

IF you find that magic combination of getting both the targeting to work alongside the data extracted back to the script, I would like to know what you do. It may be that you can simply add another parameter to the UIObject_Input_ActionTargetScript line that is obtained from the UIObject_Misc_ExtractData line.

 

I also do NOT know if after rebuilding your XML code if the other spells interfere with this. Just be careful when you reconstruct your code. Do a bit at a time.

Give me some feedback when you try this. Cheers!
 

OnLeftClick0=UIObject_Misc_ExtractData(self:,string,5,local:1)  
			OnLeftClick1=UIObject_Misc_ExecuteServerScript("gui_testmessage",local:1,"GIVEDATA") 
			OnLeftClick2=UIObject_Input_ActionTargetScript("creature",29,31,0,"TRUE","gui_zapcreature","target:object")

OK, this takes me back a bit, but it has helped remind of a few things that may be of help to you.

First, copy and play with the XML code below.

Note, the following:-

1) I have added temporary screen background so we can see the limits of the GUI we are working with.
2) I remembered you have to make sure the UIPANE is big enough to contain the button you are defining the "zapp" button for.
3) Point 2 is why I have problems mixing lists with targeting buttons. However, that may be because I have not needed to play and experiment with them as such.
4) Maybe you can design lists that contain panes, which in turn contain the defined buttons, but I don't see how you do it. :(

Test this XML though, and see what I have done to enable the button to give you a targeting cursor.


Cheers,
Lance.

 

<?xml version="1.0" encoding="NWN2UI">


<UIScene name="SCREEN_IMBUEARROW_SPELLS" x=0 y=0 width=335 height=480 fadeout="0.2" fadein="0.2" backoutkey=true capturemouseclicks=false capturemouseevents=true
    priority="SCENE_SCRIPT" scriptloadable=true draggable=true dragregion_x=0 dragregion_y=0 dragregion_width=264 dragregion_height=24 />

    <!-- GUI HEADER -->
    <UIPane name="IMBUE_TITLE_PANE" x=15 y=0 width=320 height=24 capturemouseclicks=false >    
        <UIText x=0 y=2 text="    Imbue Arrow" width=320 height=20 align=left valign=middle fontfamily="Title_Font" style="1" multiline=false />
        <UIFrame x=0 y=0 width=320 height=24 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
        bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
        left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
        border=5 />
    </UIPane>
    
    <!-- SPELL LEVELS HEADER -->
    <UIPane name="IMBUE_SPELL_LEVELS" x=15 y=24 width=320 height=16 capturemouseclicks=false >    
        <UIPane name="LISTBOX_HEADER_LVL_0" x=0 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="0" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
        <UIPane name="LISTBOX_HEADER_LVL_1" x=32 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="1" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
        <UIPane name="LISTBOX_HEADER_LVL_2" x=64 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="2" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
        <UIPane name="LISTBOX_HEADER_LVL_3" x=96 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="3" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
        <UIPane name="LISTBOX_HEADER_LVL_4" x=128 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="4" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
        <UIPane name="LISTBOX_HEADER_LVL_5" x=160 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="5" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
        <UIPane name="LISTBOX_HEADER_LVL_6" x=192 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="6" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
        <UIPane name="LISTBOX_HEADER_LVL_7" x=224 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="7" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
        <UIPane name="LISTBOX_HEADER_LVL_8" x=256 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="8" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
        <UIPane name="LISTBOX_HEADER_LVL_9" x=288 y=0 height=16 width=32 yPadding=0 xPadding=0
        expandhorizontal=true capturemouseclicks="false" >
            <UIText text="9" x=0 y=0 width=32 height=16 align=center valign=middle fontfamily="Title_Font" style="1" multiline=false />
            <UIFrame x=0 y=0 width=32 height=16 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" bottomleft="tp_frame_bl.tga"
                bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga"
                left="tp_frame_l.tga" right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga"
                border=5 />
        </UIPane>
    </UIPane>
    
    <!-- LISTS -->
    <UIPane  name="LISTBOX_MAIN" x=0 y=40 width=335 height=440 capturemouseclicks=false scrollsegmentsize=24 hidescrollbarwhennotneeded=true scrollbaronright=false >
        

        <!-- LEVEL 2 SPELL LIST -->
        <UIListBox name="LISTBOX_2" x=79 y=0 yPadding=0 xPadding=0 showpartialchild=true width=32 height=440 unequalcontrols=true capturemouseclicks="false" update=true >

	<UIPane name="LISTBOX_LVL2_ITEM" x=0 y=0 height=32 width=32 yPadding=0 xPadding=0 tupple=true draggable=false prototype=true 
			OnLeftClick0=UIObject_Misc_ExtractData(self:,string,5,local:1)  
			OnLeftClick1=UIObject_Misc_ExecuteServerScript("gui_testmessage",local:1,"GIVEDATA") 
			OnLeftClick2=UIObject_Input_ActionTargetScript("creature",29,31,0,"TRUE","gui_zapcreature","target:object")
			OnLeftClick3=UIButton_Input_ScreenClose()
			OnToolTip='UIObject_Tooltip_DisplayTooltipString("TARGET A CREATURE","OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")'>


				<UIButton name="LISTBOX_LVL2_ITEM_1" x=0 y=0 height=32 width=32 prototype=true draggable=false >

					<UIText align=right valign=bottom fontfamily="Special_Font" style="1" />
                    <UIFrame state=base        fill="b_emptyframe.tga" />
                    <UIFrame state=up        fill="b_empty.tga" />
                    <UIFrame state=down        fill="b_overlay_active.tga" />
                    <UIFrame state=focused    fill="b_overlay_active.tga" />
                    <UIFrame state=hilited    fill="b_overlay.tga" />
                    <UIFrame state=hifocus    fill="b_overlay_active.tga" />
                    <UIFrame state=disabled fill="b_emptyframe.tga" />

				</UIButton>

			</UIPane>


        </UIListBox>

	</UIPane>


#28
BloodRiot

BloodRiot
  • Members
  • 26 messages

Hi again Lance.

 

Sorry to say but I got nothing nice to say about my progress in the sense that there was none at all. I've tried what you posted above and it didn't work for me. Nothing did, not even a simple GUI with a single button. Can't seem to execute anything from gui on my end. It's 4am and my brain is now toast.

 

I'll try again tomorrow when I can, though i'm leaning towards the cause of the problem being outside the xml.

There's only so much you can screw up there, and after looking at what both you and others did in GUIs, I don't seem to be doing anything different. It simply doesn't work for some reason that is still unknown to me.

 

Again I DO appreciate all the help man. Hopefully we will still see this beast tamed.

 

Disregard all the above. So just because I'm a stubborn SOB who hates going to bed in a failure driven grumpy mood, I decided to give it one last push. It paid off. In this thread I found salvation: http://forum.bioware...i#entry15949978

 

Apparently in order for the scripts to run, the gui needs BOTH .ncs and .nss of the script. I knew it had to be something silly outside the XML... all pointed towards it. No onto the real fun stuff... let me see if I can manage to work the variables to deliver the right spellIds to the script that will fire the spell loaded arrow.

 

*dances a jig*

 

Thanks for the help Lance.

 

Cheers.



#29
BloodRiot

BloodRiot
  • Members
  • 26 messages

I'm no longer just dancing a jig... I'm doing a one man riverdance show :D

 

This is what I got and it works wonders:

 

I enclose jsut the important snippets of code:

From the script that calls the GUI, I pass 2 variables to the script 0=Spell ID and 1=Spell name from the StrRef.

            string sSpellLvl = Get2DAString("spells", "Wiz_Sorc", n);
            string sSpellIcon = Get2DAString("spells", "IconResRef", n);
            sTexts = GetStringByStrRef(StringToInt(Get2DAString("spells", "Name", n)));
            sIcons = "LISTBOX_LVL"+sSpellLvl+"_ITEM_1="+sSpellIcon+".tga";
            AddListBoxRow(oArcher, "SCREEN_IMBUEARROW_SPELLS", "LISTBOX_"+sSpellLvl, "ROW_"+IntToString(n), "", sIcons, "0="+IntToString(n)+";1="+sTexts, "");

Then I use the method you showed me to retrieve those variables and pass them in two different ways.

local:0 forwards the spell id to the script that will eventually deliver the arcane payload via pointy arrow to it's intended target.

local:1 gets used on the OnTooltip event so I get the spell name when I hover the mouse over the spell icon on my gui.

Both are tested and are working. :)

        <!-- LEVEL 1 SPELL LIST -->
        <UIListBox name="LISTBOX_1" x=47 y=0 yPadding=0 xPadding=0 showpartialchild=true width=32 height=440 unequalcontrols=true capturemouseclicks="false" update=true >

            <UIPane name="LISTBOX_LVL1_ITEM" x=32 y=0 height=32 width=32 yPadding=0 xPadding=0 tupple=true draggable=false prototype=true
            OnLeftClick=UIObject_Misc_ExtractData(self:,string,0,local:0)
            OnLeftClick0=UIObject_Misc_ExecuteServerScript("gui_testmessage",local:0,"GIVEDATA")
            OnLeftClick1=UIButton_Input_ScreenClose()
            OnMouseEnter=UIObject_Misc_ExtractData(self:,string,1,local:1)
            OnToolTip='UIObject_Tooltip_DisplayTooltipString(local:1,"OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")'>

                <UIButton name="LISTBOX_LVL1_ITEM_1" x=0 y=0 height=32 width=32 prototype=true draggable=false >
                    <UIText align=right valign=bottom fontfamily="Special_Font" style="1" />
                    <UIFrame state=base        fill="b_emptyframe.tga" />
                    <UIFrame state=up        fill="b_empty.tga" />
                    <UIFrame state=down        fill="b_overlay_active.tga" />
                    <UIFrame state=focused    fill="b_overlay_active.tga" />
                    <UIFrame state=hilited    fill="b_overlay.tga" />
                    <UIFrame state=hifocus    fill="b_overlay_active.tga" />
                    <UIFrame state=disabled fill="b_emptyframe.tga" />
                </UIButton>

            </UIPane>

        </UIListBox>

gui_testmessage correctly receives GIVEDATA and shows the correct spellID on the chatbox:)

void main (string GIVEDATA)
{
    SendMessageToPC(OBJECT_SELF, GIVEDATA);
}

Thanks for the help Lance. This might have taken a hell of a lot longer had you not helped out :)

Now I'm off to some well deserved sleep. I still have a lot to do but I got a feeling from now on it's mostly the easy but tedious work. But at least I know all I want to do now seems perfectly possible :)

 

Cheers :)



#30
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi BR,

Re the earlier email .... Yes, I know that the XML code definitely worked. And yes, as you eventually discovered, always make sure you have all your scripts .ncs and .nss in place. ;)

I have a couple of comments/questions regarding this post ...

QUOTE: "local:0 forwards the spell id to the script that will eventually deliver the arcane payload via pointy arrow to it's intended target."

1) Do you *not* need the target XML line of code then? i.e. Does just linking to the spell via local variables bring up some sort of targeting pointer? (As I said in a previous post, I have not tried this yet, and so wondered if you got a "target" cursor or not.)

2) AddListBoxRow is the command I was trying to think of as the way to send the variables to the XML. That is the one I use in my bestiary system I referred to earlier. (I had used "5" in my code.)

 

My "concern" is (and the part I have never tested yet) .... When clicking on the "spell icon", don't you need to have it offer a "target" cursor before actually "firing" the spell script? Or is that not the way this "Imbue Arrow" is supposed to work? (Searching just speaks about the ability to fire an arrow that explodes like a fireball.)

 

EIDT: Ah .. actually, I think I may be starting to understand this whole "imbue arrow" thing now (never played it before) .... Is it a case that when you select the "spell", you are "imbuing the arrow", which then becomes the object with the spell attached that does the targeting. In which case, you do not need to worry about the XML targeting line at all! I reckon that's what you are aiming for then! :) Or not .... ?

 

I'm still a little vague on these final steps from how it is finally "used" after one has selected the "spell" from the GUI. Can you give me a step by step of what the player does in the game while using this ability?

 

E.g.

 

1) Player clicks on spell within the GUI ....

2) Player then ???

3) Player then ???

Cheers,
Lance.

 

I'm no longer just dancing a jig... I'm doing a one man riverdance show :D
 
This is what I got and it works wonders:
 
I enclose jsut the important snippets of code:
From the script that calls the GUI, I pass 2 variables to the script 0=Spell ID and 1=Spell name from the StrRef.



            string sSpellLvl = Get2DAString("spells", "Wiz_Sorc", n);
            string sSpellIcon = Get2DAString("spells", "IconResRef", n);
            sTexts = GetStringByStrRef(StringToInt(Get2DAString("spells", "Name", n)));
            sIcons = "LISTBOX_LVL"+sSpellLvl+"_ITEM_1="+sSpellIcon+".tga";
            AddListBoxRow(oArcher, "SCREEN_IMBUEARROW_SPELLS", "LISTBOX_"+sSpellLvl, "ROW_"+IntToString(n), "", sIcons, "0="+IntToString(n)+";1="+sTexts, "");
Then I use the method you showed me to retrieve those variables and pass them in two different ways.
local:0 forwards the spell id to the script that will eventually deliver the arcane payload via pointy arrow to it's intended target.
local:1 gets used on the OnTooltip event so I get the spell name when I hover the mouse over the spell icon on my gui.
Both are tested and are working. :)
        <!-- LEVEL 1 SPELL LIST -->
        <UIListBox name="LISTBOX_1" x=47 y=0 yPadding=0 xPadding=0 showpartialchild=true width=32 height=440 unequalcontrols=true capturemouseclicks="false" update=true >

            <UIPane name="LISTBOX_LVL1_ITEM" x=32 y=0 height=32 width=32 yPadding=0 xPadding=0 tupple=true draggable=false prototype=true
            OnLeftClick=UIObject_Misc_ExtractData(self:,string,0,local:0)
            OnLeftClick0=UIObject_Misc_ExecuteServerScript("gui_testmessage",local:0,"GIVEDATA")
            OnLeftClick1=UIButton_Input_ScreenClose()
            OnMouseEnter=UIObject_Misc_ExtractData(self:,string,1,local:1)
            OnToolTip='UIObject_Tooltip_DisplayTooltipString(local:1,"OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")'>

                <UIButton name="LISTBOX_LVL1_ITEM_1" x=0 y=0 height=32 width=32 prototype=true draggable=false >
                    <UIText align=right valign=bottom fontfamily="Special_Font" style="1" />
                    <UIFrame state=base        fill="b_emptyframe.tga" />
                    <UIFrame state=up        fill="b_empty.tga" />
                    <UIFrame state=down        fill="b_overlay_active.tga" />
                    <UIFrame state=focused    fill="b_overlay_active.tga" />
                    <UIFrame state=hilited    fill="b_overlay.tga" />
                    <UIFrame state=hifocus    fill="b_overlay_active.tga" />
                    <UIFrame state=disabled fill="b_emptyframe.tga" />
                </UIButton>

            </UIPane>

        </UIListBox>
gui_testmessage correctly receives GIVEDATA and shows the correct spellID on the chatbox:)
void main (string GIVEDATA)
{
    SendMessageToPC(OBJECT_SELF, GIVEDATA);
}
Thanks for the help Lance. This might have taken a hell of a lot longer had you not helped out :)
Now I'm off to some well deserved sleep. I still have a lot to do but I got a feeling from now on it's mostly the easy but tedious work. But at least I know all I want to do now seems perfectly possible :)
 
Cheers :)

 



#31
BloodRiot

BloodRiot
  • Members
  • 26 messages

Hi Lance.

 

First I will explain how I want to make it work.

 

1- Arcane Archer clicks on Imbue Arrow and the GUI displays the valid spells available.

2- Arcane Archer selects the spell from the GUI.

3- Arcane Archer selects the target.

4- Arcane Archer fires the spell loaded arrow at enemy or area.

5- PROFIT.

 

I used the execute script for now, but I'm still unsure if I will end up using that or the action target instead. Depends on how things go during my next testing phase when I try to actually use the ability. It will all boil down to whichever works best and simplest. Working to see how it works or not with the Execute Script and Action Target as I'm writing/editing this. Will report back the results.

 

At this point I am also seeing a weird unintended behavior in that every time I fire the bow, it pops up the my gui even after I close it repeatedly. It actually executes the Call Gui script every time the character attacks as I can see the debug messages pop up in the chat log. This is probably something outside of the xml and script as well. Maybe in the feat.2da or something. Gonna need fixing soon.

 

Cheers.



#32
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi BR,

Thanks for the info ... Maybe I need to see what actually happens in action as I still do not understand what happens between steps 2 and 3. :( (Really sorry to sound so dim here.) For when you say you "select the spell from the GUI" (point 2), what actually happens to give you a target cursor, which you use to target in step 3?

How do you get a target cursor? That is the greatest mystery to me, as I cannot see how you get a cursor at step 2 to use in step 3.

Thanks for bearing with me as you explain this, but it is something I would like to comprehend as it may be useful in other ways.

Cheers,
Lance.

 

Hi Lance.
 
First I will explain how I want to make it work.
 
1- Arcane Archer clicks on Imbue Arrow and the GUI displays the valid spells available.
2- Arcane Archer selects the spell from the GUI.
3- Arcane Archer selects the target.
4- Arcane Archer fires the spell loaded arrow at enemy or area.
5- PROFIT.
 
I used the execute script for now, but I'm still unsure if I will end up using that or the action target instead. Depends on how things go during my next testing phase when I try to actually use the ability. It will all boil down to whichever works best and simplest. I will likely end up using the target action though.
 
At this point I am seeing a weird unintended behavior in that every time I fire the bow, it pops up the my gui even after I close it repeatedly. It actually executes the Call Gui script every time the character attacks as I can see the debug messages pop up in the chat log. This is probably something outside of the xml and script as well. Maybe in the feat.2da or something. Gonna need fixing soon.
 
Cheers.



#33
BloodRiot

BloodRiot
  • Members
  • 26 messages

Not a problem Lance. I'm as happy to help as you were. You are right to be confused as I was the dimwitted one here.

 

I was mistakenly interpreting Execute server script to be the similar to cast spell, in the sense that it would somehow consider the script a spell and access it's spells.2da information for targeting and etc. If it is possible this way, it's probably more complex than just using the Action target as you correctly suggested.

 

So I managed to pass the spell ID info to the spell with Action Target all the same. So it's all good.

What I will do with the spell (since it's meant to be able to cast it on the ground as well as at a target enemy) is when I fire the spell i will detect if the target is an object or a location. The script will then create a temporary empty object at the selected location to act as the caster of the spell and it will either target itself as the spell target if it's placed on the ground, or the enemy if it's placed directly on an enemy. Further testing required, but so far it's looking good.

 

This worked so far for a specific target. Need to test what to add at the end "target:?" to make it viable for both enemy target and ground lcoation. Maybe I can pass 5 paramenters: "local:0;target:object;target:x;target:y;target:z" and decide which to use in the script itself.

OnLeftClick0=UIObject_Input_ActionTargetScript("ground;creature",51,53,17,"true","gui_testmessage","local:0;target:object")

Cheers.



#34
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi BR,

Thanks for explaining that a bit more ... This can certainly be a bit confusing .. for both of us then. ;)

OK, what you are trying to do still sounds rather involved .... BUT, I am still very much interested to hear how you do continue to manage it. Therefore, do keep posting with your efforts so that I can try to keep up with it. :)

And usage of that XML function (Targeting) will certainly be an interesting education for me. i.e. If it does allow the passing of multiple variables back to (in the above example) gui_testmessage.

As I say, it's not something I played around with much (since that demo I made) and so anything else done with it now will be new to me too. However, I can see a *lot* of potential if I can get to grips with it myself, and was something I wanted to look at more in modules 2 and 3 .... Your interest has just brought my own forward a bit. ;)

Cheers,
Lance.


Not a problem Lance. I'm as happy to help as you were. You are right to be confused as I was the dimwitted one here.
 
I was mistakenly interpreting Execute server script to be the similar to cast spell, in the sense that it would somehow consider the script a spell and access it's spells.2da information for targeting and etc. If it is possible this way, it's probably more complex than just using the Action target as you correctly suggested.
 
So I managed to pass the spell ID info to the spell with Action Target all the same. So it's all good.
What I will do with the spell (since it's meant to be able to cast it on the ground as well as at a target enemy) is when I fire the spell i will detect if the target is an object or a location. The script will then create a temporary empty object at the selected location to act as the caster of the spell and it will either target itself as the spell target if it's placed on the ground, or the enemy if it's placed directly on an enemy. Further testing required, but so far it's looking good.
 
This worked so far for a specific target. Need to test what to add at the end "target:?" to make it viable for both enemy target and ground lcoation. Maybe I can pass 5 paramenters: "local:0;target:object;target:x;target:y;target:z" and decide which to use in the script itself.


OnLeftClick0=UIObject_Input_ActionTargetScript("ground;creature",51,53,17,"true","gui_testmessage","local:0;target:object")
Cheers.



#35
BloodRiot

BloodRiot
  • Members
  • 26 messages

Seems the general idea does work, although I've hit a snag on a few details. Casting a spell from an Ipoint is easy enough. I place an Ipoint on the taret location and cast a spell at itself or it's location. it works but the casterlevel/dc/etc are obviously wrong as it asumes some sort of default value instead of the Archer's values. Is there any way to make a spell remotely fire in such a way with specified caster values? either by feeding it to the spell somehow (spellhooking?) or by specifying or copying the archer's values onto the Ipoint or using another object type altogether?

 

As it is, i can get some decent results. though the damage, duration and DC values are pretty wonky.



#36
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Seems the general idea does work, although I've hit a snag on a few details. Casting a spell from an Ipoint is easy enough. I place an Ipoint on the taret location and cast a spell at itself or it's location. it works but the casterlevel/dc/etc are obviously wrong as it asumes some sort of default value instead of the Archer's values. Is there any way to make a spell remotely fire in such a way with specified caster values? either by feeding it to the spell somehow (spellhooking?) or by specifying or copying the archer's values onto the Ipoint or using another object type altogether?
 
As it is, i can get some decent results. though the damage, duration and DC values are pretty wonky.


Hi BR,

I have a system where items cast at the level of the user. I simply store the caster level on the item and then have the script call back the variable from that instead of the caster. It does require editing every spell that needs it though. Therefore, it's up to you how much work you want to apply.

I use spell hooking in a number of ways. but if I recall correctly, I could not avoid editing every spell for instances where the level had to be altered due to the needing it vary from the users:

 

EDIT: However, this may be different in your case, as you are still using the PC to cast and so it may just be a simple case of storing their level on the Ipoint and working form that somehow.

Example from my bless spell:
 

// ALTHEA SCROLLS WORK WITH HIGHEST CASTER LEVEL *************************************		
	int nCastHigher = GetLocalInt(OBJECT_SELF, "CASTERLEVEL");
	DeleteLocalInt(OBJECT_SELF, "CASTERLEVEL");
	if(nCastHigher > nDuration){nDuration = nCastHigher;}
	SendMessageToPC(OBJECT_SELF, "CAST LEVEL> " + IntToString(nDuration));
	// ***********************************************************************************	

I would be interested in seeing the final system in operation with respect to that cursor system, as I *still* do not get it. That is, can you still explain this bit to me from a previous post:-

How do you get a target cursor? That is the greatest mystery to me, as I cannot see how you get a cursor at step 2 to use in step 3.

Cheers,
Lance.



#37
BloodRiot

BloodRiot
  • Members
  • 26 messages

Hi again Lance.

 

My idea is working seemingly great. I'm terrible at explaining things, the best I can say is that I'm writing a sort of spell generator script. From the vanilla game, there are about 65 valid spells for imbue arrow. Of those, some of them seem to be quite simple to break down into a template, meaning that by just changing a few variables, like what effect it uses and the duration calculation, you can pretty much use variables to make the exact same bit of code emulate several spells by just changing the vars.

 

So I got a complex piece of work that will probably take some time. And I got a very simple piece of work that still takes time because it's laborious.

The complex is getting to know all the valid spells, see if they can be made to fit a template or make a new template for them hoping more can use it. The vars for each template are stored in a custom 2da file that tells me all the values I need to fill the vars so that I can emulate any of the valid spells. This is the easy part. Just filling the 2da, boring though. The 2da serves another purpose also: it tells the GUI what spells are valid, what spell level they are, the stref, icon, radius for the pointer of the target, etc.

 

The initial feat script gathers some of the fields in the 2da, gets the known and memorized spells currently available, filters them to show only the valid ones and feeds all this info to the spell selection GUI we were discussing previously. Then the GUI uses UIObject_Input_ActionTargetScript to both run the real spell script and give it a location via the pointer action that command has. It passes along for the final spell script, the spell ID, the info it already collected so I don't have to query it again, the object or location I clicked on and gathers all the remaining info from the 2da so it can run the "spell generator" and emulate the desired spell.

 

Its a butt load of work but I'm making this happen. It's confirmed so far that it works reasonably well (I'm not saying it works great because there's a bunch of stuff I still need to test for kinks of course) but it seemingly emulates the few spells I managed to get into the script.

 

so in short:

2da passes info to a chain of scripts and xml/gui. They share and pass along information and it finally reaches the "spell generator" script that emualtes the spell I wanted to imbue. The part about the targeting that you were asking about is done with UIObject_Input_ActionTargetScript that passes target info(object or location of click) along for the next script. After that it's jsut tedious work :P



#38
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi again Lance.
 
My idea is working seemingly great. I'm terrible at explaining things, the best I can say is that I'm writing a sort of spell generator script. From the vanilla game, there are about 65 valid spells for imbue arrow. Of those, some of them seem to be quite simple to break down into a template, meaning that by just changing a few variables, like what effect it uses and the duration calculation, you can pretty much use variables to make the exact same bit of code emulate several spells by just changing the vars.
 
So I got a complex piece of work that will probably take some time. And I got a very simple piece of work that still takes time because it's laborious.
The complex is getting to know all the valid spells, see if they can be made to fit a template or make a new template for them hoping more can use it. The vars for each template are stored in a custom 2da file that tells me all the values I need to fill the vars so that I can emulate any of the valid spells. This is the easy part. Just filling the 2da, boring though. The 2da serves another purpose also: it tells the GUI what spells are valid, what spell level they are, the stref, icon, radius for the pointer of the target, etc.
 
The initial feat script gathers some of the fields in the 2da, gets the known and memorized spells currently available, filters them to show only the valid ones and feeds all this info to the spell selection GUI we were discussing previously. Then the GUI uses UIObject_Input_ActionTargetScript to both run the real spell script and give it a location via the pointer action that command has. It passes along for the final spell script, the spell ID, the info it already collected so I don't have to query it again, the object or location I clicked on and gathers all the remaining info from the 2da so it can run the "spell generator" and emulate the desired spell.
 
Its a butt load of work but I'm making this happen. It's confirmed so far that it works reasonably well (I'm not saying it works great because there's a bunch of stuff I still need to test for kinks of course) but it seemingly emulates the few spells I managed to get into the script.
 
so in short:
2da passes info to a chain of scripts and xml/gui. They share and pass along information and it finally reaches the "spell generator" script that emualtes the spell I wanted to imbue. The part about the targeting that you were asking about is done with UIObject_Input_ActionTargetScript that passes target info(object or location of click) along for the next script. After that it's jsut tedious work :P


Hi BR,

So it was using that ActionTargetScript ... OK. :)

I will be interested in seeing the final product then, so do keep me posted. :)

Cheers,
Lance.

#39
BloodRiot

BloodRiot
  • Members
  • 26 messages

I think I've hit the jackpot on how Imbue works. I found a little workaround that allows me to use the archer himself as the caster so all calculations are done properly, thus using the system and not acting against it or trying to override it.

 

I need to refine a lot of stuff in the code, but the core functions are now in place. I gotta refine the way the code builds the gui list so it is both more efficient and takes into account some special cases like spells that have multiple choices via radial menu like shadow conjuration. Also need to cap the distance it can shoot the spell imbued arrow. Right now I could place an imbued arrow on the moon if wanted :D

 

Expect a beta release soon.

Cheers.

 

PS: What is the exact max range for ranged attacks in NWN2?

Is it 60 or 120 feet?

 

...

And why don't they simply used metric? :P



#40
Tchos

Tchos
  • Members
  • 5 030 messages

And why don't they simply used metric? :P

 

There were attempts, but the people of Faerun proved too stubborn to make the transition, much like this Roman who refused to switch to the decimal system.



#41
BloodRiot

BloodRiot
  • Members
  • 26 messages

Hah! thanks Tchos. That sketch is awesome :D



#42
BloodRiot

BloodRiot
  • Members
  • 26 messages

New question: Is there a way to get the spell's caster class before the spell is cast?

 

Currently the script that populates the GUI list of spells for Imbue Arrow can't tell if the spell comes from a wizard spellbook, sorc, bard or even divine. Some of the valid spells overlap between many classes such as the dispel series of spells. The sorcerer and wizard list is exactly the same too. Ideally, it should only be able to imbue from the chosen spell caster class, but that seems hard to do with the tools given and in a manner that wont make this incompatible with everything else. Now I'm prepared to allow the archer to imbue from any class so long as it's arcane spell casting. Meaning that even though your chosen class is a wizard for instance, the archer could also imbue from bard or sorcerer, but it needs to tell the difference between an arcane and divine at the very least. Anyway to do just by looking at spells known/memorized or any other way to get the effect intended in what I just described??

 

Thanks.

 

EDIT: Alternatively, is there a way to somehow intercept the info to/from the quickcast gui and get that information? Perhaps having the pressed spell tested if it's valid or not. If it isn't valid (not a hostile area spell, or not being cast from the chosen class) it's the cast is canceled, but if it's valid, perhaps hook into the spell and have it cast at the arrow for no effect so the spell is spent and then go onto the normal imbue arrow code.



#43
BloodRiot

BloodRiot
  • Members
  • 26 messages

BETA v0.8 Released.

http://www.nexusmods...er2/mods/1017/?

 

Cheers.


  • rjshae aime ceci

#44
BloodRiot

BloodRiot
  • Members
  • 26 messages

Hello again guys.

 

Considering finishing what i started by fully integrating Kaedrin's Assassin/Avenger/Hexblade as Arcane progression possibilities. The custom spellbooks for those are basically spell like ability feats with subradial options. Getting the spells to work with Imbue is not an issue, however spell progression is proving to be a bit tricky sicne it's not real progression.

 

Might have to end up scripting feat replacement based on the added progression class and archer levels. Perhaps ill have to bypass automatic feat granting with a script that checks on game loads and level ups. Not really sure have to investigate this further unless someone has a better idea they'd liek to share.

 

Thanks.

Cheers.