No categories assigned

LUA:AddPrimaryEntityCommand


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