Aller au contenu

Photo

movement speed change via scripting


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

#1
gordonbrown82

gordonbrown82
  • Members
  • 544 messages
I'm unsure about the numbers here. is there a 2da with speed for different creature appearances and how much is a speed increase of 1 for example?

#2
FollowTheGourd

FollowTheGourd
  • Members
  • 572 messages
Think APR_ is the one you're looking for. I remember some discussion about it in this thread a while back: http://social.biowar...index/2103794/1



Also, you might look at EffectModifyMovementSpeed and how it's used in creature_core for one thing.

#3
mutantspicy

mutantspicy
  • Members
  • 467 messages
delete double post

Modifié par mutantspicy, 10 octobre 2010 - 11:24 .


#4
mutantspicy

mutantspicy
  • Members
  • 467 messages
I'm doing just that with a Mod that can be found at the Dragon Age Nexus Called Oracle. Essentially what it does is use event_type equip/unequip to change the APR base to a m2da APR that double movement speed, and back to base Apr when unequipped.

It works great but has a major problem. When you uninstall the MOD, the event handlers I have created cause major game breaking bugs. The MOD works fine when it is installed and operates exactly as described. However, when the mod is uninstalled alot strange event type issues start popping up. I know its these event scripts. Because if I uninstall the Mod, then copy these into the override all bugs go away.



Event_Handler (Module Script)
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"

void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    string sDebug;
    object [] oPartyList = GetPartyPoolList();
    int nEventHandled = FALSE;
    object oPc = GetHero();
    string sTag = "boots_spd";
    object oBoots = GetObjectByTag(sTag);
    {
    PrintToLog("my module handler :event "+IntToString(nEventType)+" from "+GetName(GetEventCreator(ev)));
    switch(nEventType)
        {
        case EVENT_TYPE_MODULE_START:
        case EVENT_TYPE_MODULE_LOAD:
        case EVENT_TYPE_PARTYMEMBER_ADDED:
        case EVENT_TYPE_PARTYMEMBER_DROPPED:

            {
            PrintToLog("event mod party drop");
             //assign custom event handler to each member of the party
            int i;
            for (i = 0; i < GetArraySize(oPartyList); i++)
                {
                PrintToLog("assign event handler to " + GetName(oPartyList[i]));
                EnablevEvent(oPartyList[i],TRUE,EVENT_TYPE_EQUIP);
                EnablevEvent(oPartyList[i],TRUE,EVENT_TYPE_UNEQUIP);
                SetEventScript(oPartyList[i],R"oracle_speed_event_handler.ncs");
                }
            nEventHandled = TRUE; //set this if no further action is required for this event
            break;
            }


        }
        if (!nEventHandled)
            {
            HandleEvent(ev, RESOURCE_SCRIPT_PLAYER_CORE);
            }
    }
}


The actual event script is :
//speed event handler

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"

void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    string sDebug;
    object oUser = OBJECT_SELF;

    switch(nEventType)
    {
        case EVENT_TYPE_EQUIP:
        {
            object oItem = GetEventObject(ev,0);
PrintToLog("event equip: "+GetName(oUser)+" - "+GetName(oItem));

            object oEquipper = GetEventCreator(ev);
            int nRace = GetCreatureRacialType(oEquipper);
            string sTag = "boots_spd";
            object oBoots = GetObjectByTag(sTag);
            {
            if(oItem == oBoots)
                {
                    if(nRace == 2)
                    {
                    SetAppearanceType(oEquipper,65010,TRUE);
                    }
                    else if(nRace == 3)
                    {
                    SetAppearanceType(oEquipper,65011,TRUE);
                    }
                 }
            }
            break;
        }

        case EVENT_TYPE_UNEQUIP:
        {
            object oItem = GetEventObject(ev,0);
PrintToLog("event unequip: "+GetName(oUser)+" - "+GetName(oItem));
            object oEquipper = GetEventCreator(ev);
            int nRace = GetCreatureRacialType(oEquipper);
            string sTag = "boots_spd";
            object oBoots = GetObjectByTag(sTag);
            {
            if(oItem == oBoots)
                {
                if(nRace == 2)
                    {
                    SetAppearanceType(oEquipper,2,TRUE);
                    }
                else if(nRace == 3)
                    {
                    SetAppearanceType(oEquipper,15,TRUE);
                    }
                }
            }
            break;
        }


    }
    //always let the default event handlers process the rest of the event otherwise things will break
     HandleEvent(ev, RESOURCE_SCRIPT_PLAYER_CORE);


}




Now this works great. Essentially what it does is change the appearance of the object equipper so that the movement rate is doubled.

The problem is. When you uninstall the MOD. it corrupts the game engine. The only way to fix it is then to copy these two scripts into the override. So I think somehow the SetEventScript is setting the default event handler to my event handler. And then when my mod is removed the game is still looking for my event handler. When its not there wierd things begin to happen. Have any you, who seem to be doing something similar to my mod had similar problems and if so what did you do to fix it. Is there a way to reset the default Event handler back to Core Resources.


Examples of corruption :

-Once you enter combat mode. combat mode will not exit when enemies are all dead.
-Can't use certain skills like herbalism (hero only, followers unaffected)
-mage staff won't do damage (hero only, followers unaffected)
-hero recieves major health regeneration.

Modifié par mutantspicy, 10 octobre 2010 - 11:21 .


#5
mutantspicy

mutantspicy
  • Members
  • 467 messages
Also of note. I tried creating itemproperties gda files and using script to use the effectmodifymovementrate command. But it actually paralyzes the characters. For some reason that effect when applied to an item or PC with either scripting or thru itemprps completely stops all movement period. It doesn't matter how you set the float values, you go nowhere.