Aller au contenu

Photo

Noob modder question "Variable defined without type"


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

#1
Spartan200

Spartan200
  • Members
  • 20 messages
Hi.  I am working on a tiny stand-alone campaign to teach myself modding.  I have it all created, and all my errors seem to be solved save one.  When I try to export the module, I get the following line:

E: 15:19:30 - chicken_eater_slain.nss - chicken_eater_slain.nss(15): Variable defined without type (while compiling var_constants_h.nss)

I don't know scripting at all so I do not know what this means.  Here is the script resource that the error refers to:

#include "events_h"
#include "plt_kill_wolf"
#include "wrappers_h"
void main ()
{   event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    switch(nEventType)
        {
            case EVENT_TYPE_TEAM_DESTROYED:
            {
                if(GetEventInteger(ev,0) == 1)
                {
                    WR_SetPlotFlag(PLT_WOLF_SLAIN, WOLF_SLAIN, TRUE);
                }
                break;
            }
    }
    HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
}

Thanks for any help. Posted Image

#2
Mengtzu

Mengtzu
  • Members
  • 258 messages
You're using the wrong constant for your plot.



If you're plot is called kill_wolf (you have #include "plt_kill_wolf") then the constant will be PLT_KILL_WOLF, not PLT_WOLF_SLAIN.



You can actually check this - after you've #included your plot, go to the scripting pane on the right, hit the green C for constants, and type PLT_KILL or whatever and you should see your constant on the list.

#3
Axe_Murderer

Axe_Murderer
  • Members
  • 279 messages
Try changing PLT_WOLF_SLAIN to PLT_KILL_WOLF

#4
Spartan200

Spartan200
  • Members
  • 20 messages
Doh! That was rather obvious. Thanks though. That fixed it and my mini-mod worked! =)

#5
killerrabbit47

killerrabbit47
  • Members
  • 6 messages
i have the same error but i checked and the plt was right





#include "events_h"

#include "plt_plot"

#include "wrappers_h"



void main()

{

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev);



switch(nEventType)

{

case EVENT_TYPE_TEAM_DESTROYED:

{

if(GetEventInteger(ev,0) == 2)

{

WR_SetPlotFlag(PLT_plot, SLAIN, TRUE);

}

break;

}

}

HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);

}

#6
Magic

Magic
  • Members
  • 187 messages
PLT_PLOT instead of PLT_plot probably? It's case sensitive.

#7
Craig Graff

Craig Graff
  • Members
  • 608 messages
A further tip: when you have an error like this, try auto-completing the various constants (CTRL+Spacebar), then double check that they are defined within the current scope.

#8
killerrabbit47

killerrabbit47
  • Members
  • 6 messages
i tryed both of those and its still not working


#9
Craig Graff

Craig Graff
  • Members
  • 608 messages
Still not working, or still not compiling?

#10
Magic

Magic
  • Members
  • 187 messages
Just to be sure, the compiling error points to line

WR_SetPlotFlag(PLT_plot, SLAIN, TRUE);

and SLAIN is actually a main flag in plot plt_plot, right?

#11
killerrabbit47

killerrabbit47
  • Members
  • 6 messages
hmm... i didnt change anything and now its working but now i just cant get the reward to be given

do i just need to "set" the reward flag at the end of the conversation with a reward on the reward flag in the plot?

#12
Craig Graff

Craig Graff
  • Members
  • 608 messages
Yup. If you set the flag in script (rather than directly from the conversation) you will need to make sure you have the nCallScript parameter set to TRUE, otherwise it doesn't call the script which hands out the reward. Also, the script associated with the plot needs to #include "plot_h" and have the line:
plot_GlobalPlotHandler(eParms);

Which it will if you are using the custom plot events template.

Modifié par Craig Graff, 24 janvier 2010 - 09:37 .


#13
killerrabbit47

killerrabbit47
  • Members
  • 6 messages
sorry i havn't done much script before this so this is what i have
#include "events_h"
#include "plt_plot"
#include "wrappers_h"
#include "plot_h"

void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
int nCallScript = TRUE;

switch(nEventType)
{
case EVENT_TYPE_TEAM_DESTROYED:
{
if(GetEventInteger(ev,0) == 1)
{
WR_SetPlotFlag(PLT_PLOT,SLAIN,TRUE);
}
break;
}
}
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
}
where do you put in the "plot_GlobalPlotHandler(eParms);" ?

im doing it all wrong aren't I?

Modifié par killerrabbit47, 24 janvier 2010 - 10:50 .