Difference between revisions of "LUA:AddPrimaryEntityCommand"

(Created page with "= LUA Functions: AddPrimaryEntityCommand() = Returns the current '''current hit points''' of ''param''. The parameter can be either a player or the NPC currently being interacted...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
= LUA Functions: AddPrimaryEntityCommand() =
+
{{LUAFunction
Returns the current '''current hit points''' of ''param''. The parameter can be either a player or the NPC currently being interacted with.
+
|Name = AddQuestPrereqItem
 
+
|Description = Adds an item prerequisite to the given quest.
 
+
|Param1 = Spawn
==== Syntax ====
+
|Param1Desc = is the player who will see this new command on the given spawn, must be a player
AddPrimaryEntityCommand(param1, param2, param3, [param4], [param5], [param6], [param7], [param8])
+
|Param2 = Spawn
 
+
|Param2Desc = is the spawn that will get the new command
==== Parameters ====
+
|Param3= string
; Required - ''param1'' (spawn), ''param2'' (spawn), ''param3'' (string)
+
|Param3Desc = is the name of the command
: ''param1'' is the player who will see this new command on the given spawn, must be a player
+
|OptionalParam1 = float
: ''param2'' is the spawn that will get the new command
+
|OptionalParam1Desc = is the max distance from the spawn to be able to use the command, defaults to 10 if left out
: ''param3'' is the name of the command
+
|OptionalParam2 = string
 
+
|OptionalParam2Desc = is the command, defaults to the same value as param3 if left out
; Optional -  ''param4'' (float), ''param5'' (string), ''param6'' (string), ''param7''(int16), ''param8'' (int32)
+
|OptionalParam3 = string
: ''param4'' is the max distance from the spawn to be able to use the command
+
|OptionalParam3Desc = is the error text for when the command fails
: ''param5'' is the command
+
|OptionalParam4 = int16
: ''param6'' is the error text for when the command fails
+
|OptionalParam4Desc = is the time it takes to cast the command
: ''param7'' is the time it takes to cast the command
+
|OptionalParam5 = int32
: ''param8'' is the spell visual for this command
+
|OptionalParam5Desc = is the spell visual for this command
 
+
|Example =
 
 
==== Usage ====
 
 
<pre>
 
<pre>
 
function hailed(NPC, Spawn)
 
function hailed(NPC, Spawn)
Line 26: Line 24:
 
end
 
end
 
</pre>
 
</pre>
 +
|ExampleDesc = Add the poke command to the spawn for the player after they have hailed the spawn.
 +
|Notes = OptionalParam2 needs to be in the Commands table in the DB
  
Add the poke command to the spawn for the player after they have hailed the spawn.
+
<pre>
 +
--AddPrimaryEntityCommand(Spawn,NPC,"",0,"") -- removes all the primary entity commands (including hail)
  
 +
--AddPrimaryEntityCommand(Spawn,NPC,"hail",10000,"hail") -- adds the hail command back to the npc
  
== Notes ==
+
--SendUpdateDefaultCommand(NPC,10000,"hail") -- returns the bubble option when you hover over the spawn/npc
If left out ''param4'' defaults to 10.
 
  
If left out ''param5'' defaults to the same value as ''param3''
+
--AddPrimaryEntityCommand(Spawn,NPC,"hail2",10000,"hail2","",0,0,1) -- 1 at the end sets this as a default DENY list.
 +
  If Spawn is supplied and not null/not player then that player gets default allow access.
 +
  Any other players must be added (either by calling the AddPrimaryEntityCommand or subsequently SetAccessToEntityCommand)
  
''param5'' needs to be in the Commands table in the DB.
+
--SetAccessToEntityCommand(Spawn,NPC,"hail2",0) -- removes access to the just created hail2 for that player
 +
 
 +
--SetAccessToEntityCommand(Spawn,NPC,"hail2",1) -- adds access to hail2 for that Spawn (player)
 +
 
 +
--RemovePrimaryEntityCommand(NPC,"hail2") -- removes hail2 command for all players
 +
</pre>
 +
}}

Latest revision as of 14:44, 30 January 2021


LUA:AllFunctions - AddQuestPrereqItem

Return to: LUA:AllFunctions | Tutorials | Portal | Forum | Project Manager | Bug Tracker


Adds an item prerequisite to the given quest.

Syntax

AddQuestPrereqItem(param1, param2, param3, [opt param1], [opt param2], [opt param3], [opt param4], [opt param5])

Parameters

Required - param1 (Spawn), param2 (Spawn), param3 (string)
param1 is the player who will see this new command on the given spawn, must be a player
param2 is the spawn that will get the new command
param3 is the name of the command
Optional - opt param1 (float), opt param2 (string), opt param3 (string), opt param4 (int16), opt param5 (int32)
opt param1 is the max distance from the spawn to be able to use the command, defaults to 10 if left out
opt param2 is the command, defaults to the same value as param3 if left out
opt param3 is the error text for when the command fails
opt param4 is the time it takes to cast the command
opt param5 is the spell visual for this command

Example

function hailed(NPC, Spawn)
    AddPrimaryEntityCommand(Spawn, NPC, "poke")
end

Add the poke command to the spawn for the player after they have hailed the spawn.

Notes

OptionalParam2 needs to be in the Commands table in the DB

--AddPrimaryEntityCommand(Spawn,NPC,"",0,"") -- removes all the primary entity commands (including hail)

--AddPrimaryEntityCommand(Spawn,NPC,"hail",10000,"hail") -- adds the hail command back to the npc

--SendUpdateDefaultCommand(NPC,10000,"hail") -- returns the bubble option when you hover over the spawn/npc

--AddPrimaryEntityCommand(Spawn,NPC,"hail2",10000,"hail2","",0,0,1) -- 1 at the end sets this as a default DENY list.
   If Spawn is supplied and not null/not player then that player gets default allow access. 
   Any other players must be added (either by calling the AddPrimaryEntityCommand or subsequently SetAccessToEntityCommand)

--SetAccessToEntityCommand(Spawn,NPC,"hail2",0) -- removes access to the just created hail2 for that player

--SetAccessToEntityCommand(Spawn,NPC,"hail2",1) -- adds access to hail2 for that Spawn (player)

--RemovePrimaryEntityCommand(NPC,"hail2") -- removes hail2 command for all players