Aller au contenu

creating a module script


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

#1
Guest_templarioseco_*

Guest_templarioseco_*
  • Guests
Guys im in need of help for scripting. i have done this script myself and i dont know if it is correct but the flag part is not working.
what it does is :add a flag if it is not added at the start of the module
change the party picker and the char stage to mine's
add a flag if indicated followers (kenneth & douglas) are in party:

#include "wrappers_h"
#include "plt_douglas"
#include "plt_kennethisinparty"
#include "plt_main_korcari_plot"
#include "utility_h"
void main
{
    if (WR_GetPlotFlag(plt_main_korcari_plot, FIRST) == FALSE)
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    switch(nEventType)
    {
        case EVENT_TYPE_PARTYMEMBER_ADDED:
        {
            object oFollower = GetEventObject(ev, 0);
            SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);  //Allows the follower to gain XP
            AddCommand(oFollower, CommandJumpToLocation(GetLocation(GetHero())));   //Ensures follower appears at PC's location.
            SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE);  //Adds follower to the active party
            break;
        }
    }
 {
        object oDouglas (GetNearestObjectByTag ("douglas"));
        int IsFollower (object oDouglas);
        WR_SetPlotFlag(plt_douglas, DOUGLASISINPARTY, TRUE);
 }
   {
        object oKenneth (GetNearestObjectByTag ("kenneth"));
        int IsFollower (object oKenneth);
        WR_SetPlotFlag(plt_kennethisinparty, IN_PARTY, TRUE);
    }
        case EVENT_TYPE_MODULE_GETCHARSTAGE:
        {
        SetPartyPickerStage("my_char_stage", "partypicker");
        break;
        }
     WR_SetPlotFlag(plt_main_korcari_plot, FIRST, TRUE);
}

thanks,

#2
Proleric

Proleric
  • Members
  • 2 363 messages
The section starting "object oDouglas" is not inside a module event case, so it will be triggered by almost every module event (there are a lot of them). Also, it won't quite work as intended. Have a look at the scripts in the wiki Follower tutorial.

The first "if" statement says "don't initialise ev if this flag is set". If the flag ever gets set, all the cases in your script will fail, because the event type will be invalid. I think you meant to say something like "if this flag isn't set, set it". I guess that's not quite the whole story - clearly, there's no point in having a flag that's always set. Again, this should be within an event case, e.g. set this flag when the player acquires the magic bean.

Modifié par Proleric1, 16 mars 2010 - 08:25 .


#3
Guest_templarioseco_*

Guest_templarioseco_*
  • Guests
Hey! thanks for taking the time to check the script up, but, could you post it fixed, i mean i think im understanding what you say but not in a complete way



thanks,

#4
Proleric

Proleric
  • Members
  • 2 363 messages
No need - the wiki has sample scripts which address both of your issues.


#5
Guest_templarioseco_*

Guest_templarioseco_*
  • Guests
ok, thanks for everything man. still looking for more help :D