Custom Scripts Ignored

Helo everybody,

I have a problem with custom scripts, I follow all instructions for http://collab.kpsn.org/display/tc/How-to_CustomScript (I read the "This information is deprecated, all scripts should be added to the proper cmakelists file as shown in the Linux instructions below.") and I follow all steps to make a custom script for a creature, I added correctly the name of the script in the database so when I enter to the game the NPC ignores the script.

What I’m doing wrong? Sorry my English is so bad.

This looks more like a custom section, but anyway. Afaik you need to add it to script loader and make sure you set correct script_name in creature_template DB.

Thanks for your reply Polkik, this is my script http://pastebin.com/NpXT9QDk and my script loader http://pastebin.com/baN3EkYX.

This is my cmakelist in custom folder http://pastebin.com/1zCrWD2V and last an image about the script name in the creature http://imageshack.us/photo/my-images/29/6a8a.jpg

I was recompile the code 3 times and the creature don’t do anything :S

Thanks in advance.

"#ifdef SCRIPTS

/* This is where custom scripts’ loading functions should be declared. */

void AddSC_boss_zar_jira();

#endif

void AddCustomScripts()

{

#ifdef SCRIPTS

/* This is where custom scripts should be added. */

AddSC_boss_zar_jira();

#endif

}"

wut.

I fail to see what you are getting at here.

Two entries for the same script ? Why ? oO One single entry for example into one of the upper scripts, e.g. under instance scripts as void AddSC_boss_zar_jira(); would be sufficient.

Thanks for your reply, I’m trying to put just [COLOR=rgb(40,40,40)]void AddSC_boss_zar_jira(); under instance scripts and my creature does nothing :S

[COLOR=rgb(40,40,40)]I’m trying to do this one:

[COLOR=rgb(51,51,51)]We will assume that your linked your script using ‘AddSC_my_script’, if you don’t know what that means, check other scripts to see how they are linked. You first need to add under ’ /* This is where custom scripts’ loading functions should be declared. / ’ and under '/[COLOR=rgb(51,51,51)] This is where custom scripts should be added. */’ at the bottom of the file the lines:

			void AddSC_my_script();

AddSC_my_script();

Example

			#ifdef SCRIPTS

/* This is where custom scripts’ loading functions should be declared. */
void AddSC_my_script();
#endif

and

			void AddCustomScripts(){

#ifdef SCRIPTS
/* This is where custom scripts should be added. */
AddSC_my_script();
#endif
}

Don’t listen to Ascathor, he obviously has no clue about the difference between a declaration, a definition. and an implementation.

Thanks Paradox, do you see something wrong in the code? I’m trying a lot of things but I can’t find anything… :S

— Canned message start —

This thread is not related to the official Trinity codebase and was moved to the Custom Code section.

Please read the stickies next time.

— Canned message end —

Thank you Aokromes.

Does this NPC have an SAI script or something that might be interfering?

I think that no, http://imageshack.us…ges/29/6a8a.jpg in the image just appear the script_name and in the db too.

I couldn’t actually get your script to compile… rewrote it so you have a base to work with and tested it in-game:

Script:

[CODE]

/*
For Ruffo91
*/

#include “ScriptPCH.h”
#include “ScriptedCreature.h”
#include “ScriptedGossip.h”
#include “Player.h”
#include “SpellInfo.h”
#include “Unit.h”

enum SpellIds
{
SPELL_ARMADURA_DE_ESCARCHA = 12544, // Frost Armor http://wotlk.openwow.com/spell=12544
SPELL_GRITO_DEL_ORDEN = 469, // Commanding Shout http://wotlk.openwow.com/spell=469
};

class boss_zar_jira : public CreatureScript
{
public:
boss_zar_jira() : CreatureScript(“boss_zar_jira”){}

CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
    return new boss_zar_jiraAI(creature);
}

struct boss_zar_jiraAI : public ScriptedAI
{

    boss_zar_jiraAI(Creature* creature) : ScriptedAI(creature){ }
        
        uint32 armaduratimer;
        
        void Reset()
        {
        armaduratimer = 0; // immediate on comabt
        }
        
        void EnterCombat(Unit* /*who*/) OVERRIDE
        {
            me->MonsterSay("Muere putilla! Muahaha!", LANG_SPANISH, me->GetGUID());
        }

        void KilledUnit(Unit* victim) OVERRIDE
        {
            DoCast(me, SPELL_GRITO_DEL_ORDEN);
        }

        void JustDied(Unit* /*killer*/) OVERRIDE
        {
            me->MonsterSay("Volvere...", LANG_SPANISH, me->GetGUID());
        }
        
        void UpdateAI(uint32 diff) OVERRIDE
        {
            if (!UpdateVictim())
            return;
            
            if(armaduratimer <= diff)
            {
                DoCast(me, SPELL_ARMADURA_DE_ESCARCHA, true);
                armaduratimer = 1800000; // 30 min
            }
            else armaduratimer -= diff;
        DoMeleeAttackIfReady();    
    }
};

};

void AddSC_boss_zar_jira()
{
new boss_zar_jira;
}[/CODE]

Oh! It’s working! Thanks JoshCarter you are the best!!! /emoticons/default_biggrin.png