Jump to content
  • 0

Use atcommand in Skill SRC


OscarScorp

Question


  • Group:  Members
  • Topic Count:  62
  • Topics Per Day:  0.02
  • Content Count:  217
  • Reputation:   16
  • Joined:  01/28/15
  • Last Seen:  

Hello,
How can a skill run a command?
I know atcommand "@command"; and useatcmd "@command"; in an NPC script but these won't work in SRC.

I would like to run a special command when using a specific skill.

Thank you in advance!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  220
  • Reputation:   251
  • Joined:  04/08/13
  • Last Seen:  

is_atcommand(fd, sd, "@command", 1);

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  233
  • Reputation:   50
  • Joined:  12/20/18
  • Last Seen:  

*unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>};

*unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>};

*unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>;

*unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>;

This is the replacement of the older commands, these use the same values for

GID as the other unit* commands (See 'GID').

Skill ID is the ID of the skill, skill level is the level of the skill.

For the position, the x and y are given in the unitSkillUsePos.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  62
  • Topics Per Day:  0.02
  • Content Count:  217
  • Reputation:   16
  • Joined:  01/28/15
  • Last Seen:  

6 minutes ago, Disabled LOOLP said:

*unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>};

*unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>};

*unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>;

*unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>;

This is the replacement of the older commands, these use the same values for

GID as the other unit* commands (See 'GID').

Skill ID is the ID of the skill, skill level is the level of the skill.

For the position, the x and y are given in the unitSkillUsePos.

So there is no way to use a command through the SRC? Like in skill.cpp, when using Bash skill for example, run a command from @command.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  416
  • Reputation:   73
  • Joined:  05/16/19
  • Last Seen:  

yeah i mean you cant just do this? 

atcommand_whatever ( 0 , 0 , 0 , 0 ) + all your stuff in the skill stuff?

 

not sure besides gutting it completely 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  62
  • Topics Per Day:  0.02
  • Content Count:  217
  • Reputation:   16
  • Joined:  01/28/15
  • Last Seen:  

On 11/6/2019 at 8:17 AM, Naruto said:

yeah i mean you cant just do this? 

atcommand_whatever ( 0 , 0 , 0 , 0 ) + all your stuff in the skill stuff?

 

not sure besides gutting it completely 

Yeah I'm trying adding lines such as:

In skill.cpp:

atcommand "@mycommand";
useatcmd "@mycommand";
atcommand_mycommand();

But these won't work. I only get errors in console when trying to recompile.

And yes, @mycommand works by itself, but I want users to get acces to it through a Skill, not by typing the command ?

 

Or is there a way to make a clif_displaymessage type of clif to not display a message but to make the user type a string automatically? Therefore, auto-typing a command.

On 11/6/2019 at 10:36 AM, Easycore said:

is_atcommand(fd, sd, "@command", 1);

It works!! Thank you so much!

I just had to add at the beginning:

#include "script.hpp"
#include "status.hpp"
#include "unit.hpp"
++ #include "atcommand.hpp"

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...