Aller au contenu

Photo

Any way to intercept/modify player commands?


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

#1
SuperD-710

SuperD-710
  • Members
  • 130 messages
As title, is there any way to intercept commads added by player? I'm specifically interested in commands like attack and use ability.

Problem is, the COMMAND_PENDING event is only fired when the character get up close/in range and before attacking, not when the player right click on the eneny (or when clicking on ability icon). When the command is given, only event 94(or 90, doesn't seem like 90 always fire) are fired. I could do things in those events (like add a new command) but I could not figure out how to stop the original command from executing.

Any ideas?

#2
Craig Graff

Craig Graff
  • Members
  • 608 messages
Have you played with EVENT_TYPE_ON_ORDER_RECEIVED  or EVENT_TYPE_PLAYER_COMMAND_ADDED yet?

Modifié par Craig Graff, 06 février 2010 - 01:07 .


#3
anakin5

anakin5
  • Members
  • 258 messages
They are only listed in the toolset / script.ldf, so it may be hard to find these events.

I mean they are not in engineevents table nor in events_h. For those interested in "hidden" events :

int EVENT_TYPE_BEGIN_TRAVEL                    = 91;
int EVENT_TYPE_WORLDMAP_PRETRANSITION          = 92;
int EVENT_TYPE_ABILITY_PROJECTILE_LAUNCHED     = 93;
int EVENT_TYPE_PLAYER_COMMAND_ADDED            = 94;
int EVENT_TYPE_CHAR_RECORD_OPENED              = 95;
int EVENT_TYPE_OPTIONS_CHANGED                 = 96;
int EVENT_TYPE_ROAM_DIST_EXCEEDED               = 97;
int EVENT_TYPE_PLOT_COMPLETED                  = 98;
int EVENT_TYPE_PARTY_MONEY_CHANGED             = 99;
int EVENT_TYPE_CODEX_CHANGED                   = 100;
int EVENT_TYPE_CRAFT_ITEM                      = 102;
int EVENT_TYPE_WORLDMAP_POSTTRANSITION         = 103;
int EVENT_TYPE_PARTYPICKER_INIT                   = 104;

int EVENT_TYPE_TRAINING_BEGIN                  = 1059; 
int EVENT_TYPE_TRAINING_FOLLOWER_SELECTED      = 1060;
int EVENT_TYPE_TRAINING_GUI_TACTICS_OPENED     = 1061;
int EVENT_TYPE_TRAINING_GUI_LEVLUP_OPENED      = 1062;
int EVENT_TYPE_TRAINING_GUI_INVENTORY_OPENED   = 1063;
int EVENT_TYPE_TRAINING_QBAR_ITEM_EQUIPPED     = 1064;
int EVENT_TYPE_TRAINING_MAXIMUM_ZOOM_IN        = 1065;
            //Event 1066 IS USED
int EVENT_TYPE_TRAINING_WEAPON_EQUIPPED        = 1067;
int EVENT_TYPE_TRAINING_DELAYED_NOACTION       = 1068;
int EVENT_TYPE_TRAINING_UNPAUSE                   = 1069;
int EVENT_TYPE_TRAINING_ITEM_EQUIPPED           = 1071;
int EVENT_TYPE_TRAINING_TACTIC_PRESET_SELECTED = 1072;
int EVENT_TYPE_TRAINING_MOVEMENT_COMMAND_ISSUED= 1073;

Modifié par anakin5, 06 février 2010 - 05:55 .


#4
SuperD-710

SuperD-710
  • Members
  • 130 messages
I've looked through script.ldf before posting. Eventually I used a debug script to see which events are fired when I issue a command. Those are 90(EVENT_TYPE_ON_ORDER_RECEIVED) and 94(EVENT_TYPE_PLAYER_COMMAND_ADDED) like mentioned in the top post. Like I said I can add new commands in there, but I don't know how to stop the current command from executing as the two events doesn't seem to accept a return value.

Thus me asking for help :)

EDIT: Also I've tried ClearCurrentCommand in those two events, but seems like commands were not added until after the event, so I was either clearing nothing or the command before. I guess I will try a delayed custom event :|

Modifié par SuperD-710, 06 février 2010 - 07:31 .


#5
anakin5

anakin5
  • Members
  • 258 messages
Or you were clearing the "current command" but the command is maybe only in the command pool.

Did you try a ClearAllCommands ?



Second option, I remember reading somewhere that Sending the same command 2 times make the 2 command beeing cleared. So maybe something like AddCommant(GetCurrentCommand(... can do something.