Aller au contenu

Photo

Ultra Simply Script Query


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

#1
yeerkkiller1

yeerkkiller1
  • Members
  • 3 messages
Super simple question, does anyone have any idea why this does not work: 

// All module events
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "log_h"void main()
{    
    event ev   = GetCurrentEvent();    
    int nEvent = GetEventType(ev);    
    Log_Events("", ev);    
    switch (nEvent)    
    {        
        case EVENT_TYPE_ATTACKED:        
        {            
            UT_AddItemToInventory(R"bec100im_duncan_crossbow.uti",3);            
            break;        
        }        
        default:        
        {            
            break;        
        }    
    }
    HandleEvent(ev);
}

It must be a scripting problem as when I made it catch EVENT_TYPE_MODULE_LOAD it worked fine, but for some reason I can't get any other event to do anything. When I made a change to the original event I got working it was mirrored in the game, so that is not the problem. I really need help. :( Thanks in advance. (Oh and this is likely not in the right thread).

EDIT: Forum messed up the line breaks so I re-added them.

Modifié par yeerkkiller1, 04 septembre 2010 - 02:47 .


#2
Proleric

Proleric
  • Members
  • 2 361 messages
I'm guessing this is a module script. EVENT_TYPE_ATTACKED is passed to the creature or placeable script, so you need to change that instead.

#3
0x30A88

0x30A88
  • Members
  • 1 081 messages
#include "utility_h" seems to be in the comment line (//), is that just a forum typo? I think that one is important to have included.

#4
yeerkkiller1

yeerkkiller1
  • Members
  • 3 messages
Oh... well that makes a lot of sense, is there anyway to intercept all events sent to a creature. I heard it was something to do with the 2da files but I haven't seen any script doing it. Yeah the utility_h was just a forum thing, I will fix it now. Thanks for replying though, I was completely lost.

#5
Proleric

Proleric
  • Members
  • 2 361 messages

yeerkkiller1 wrote...

Oh... well that makes a lot of sense, is there anyway to intercept all events sent to a creature. .

Yes - open the creature resource - one of the creature properties in object inspector is the script - put a custom script in there instead, and have it pass any events you haven't handled to the default creature script.

#6
yeerkkiller1

yeerkkiller1
  • Members
  • 3 messages
Oh... yeah that makes a lot of sense too. Wow there is a lot I can do with this, thanks a million :D .