Aller au contenu

Photo

Default X2 tag based scripting ... ???


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

#1
Xardex

Xardex
  • Members
  • 217 messages
So, I have used tag based scripts for quite a while but now im doing a tag based 'On Hit: Unique Power' script...
Lets get to the point:

Stripped down x2_mod_def_act (OnActivate script)

#include "x2_inc_switches"
void main()
{
     object oItem = GetItemActivated();
     object oPC   = GetItemActivator();

    [b]SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ACTIVATE);[/b]
    int nRet =   ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
    if (nRet == X2_EXECUTE_SCRIPT_END)
    {
        return;
    }
}

Just an example. You see that the user defined event -whatever, is set here, in the module scripts.


This is the 'On Hit: UP' part of the default X2 tag based script template.

    if (nEvent ==[b]X2_ITEM_EVENT_ONHITCAST[/b])
    {
        oItem  =  GetSpellCastItem();
        oPC = OBJECT_SELF;
        object oTarget = GetSpellTargetObject();
    }

What the hell?
There is no module event for On Hit! There is no module script that will set the user event to this!
How will this bit of the script ever fire??

Modifié par Xardex, 28 juillet 2010 - 08:05 .


#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
When you get a successful hit this script is fired: "x2_s3_onhitcast"



I think that's what you were looking for?

#3
Shadooow

Shadooow
  • Members
  • 4 468 messages
x2_s3_onhitcast

bah GhostOfGod was first :o

Modifié par ShaDoOoW, 28 juillet 2010 - 08:31 .


#4
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Funny thing with the way it works. Is about the same way as the OnActivate works. OnAcitavate runs script. NW_S3_ActItem01 this script just runs the module event, the module event then runs the tagbased script.



With On Hit they just just skiped the step of running a module event.




#5
Xardex

Xardex
  • Members
  • 217 messages
Hidden module event?

Thats just evil...

#6
Shadooow

Shadooow
  • Members
  • 4 468 messages
yea, spellhook is second hidden one

#7
Xardex

Xardex
  • Members
  • 217 messages
So... Is the hidden On Hit script ran on the PC?
Since the item script has this line...:
oPC = OBJECT_SELF;

Modifié par Xardex, 29 juillet 2010 - 07:28 .


#8
Shadooow

Shadooow
  • Members
  • 4 468 messages
Yes, it is spell actually. OBJECT_SELF is always caster, actually not necessary PC if you allow onhit items to your npcs, but not recommended. GetSpellTargetObject then returns either target you just hit, in case of onhit is on the weapon, or npc that hits you, in case of onhit is on shield/armor. Also GetLastDamager works if its armor.

#9
Xardex

Xardex
  • Members
  • 217 messages
Alright, thanks.