Mobiles flourishing and other NPC movement

drdax

Member
Joined
Jun 11, 2015
Messages
133
Does anyone know if you can have screenplays with NPCs flourishing for entertainer NPCs and moving like idlewait ? Are there other movement options?

I know some  mood strings but cant find where in the TREs they are, need some help there too please.

Would someone be kind enough to show me where to find the above or provide an example(s)?

I have NPC patrolling working.

Thanks in advance !
 

Pake

Member
Joined
Dec 8, 2011
Messages
147
Nice on the patrolling, I was trying to get that working before and didn't seem to get it quite there.

As far as I know I believe you cannot use an entertainer NPC to flourish/buff. I'm going to be "officially" learning about objects/classes/object oriented next semester but from what I remember from when I was playing around with the server last was the NPCs are an AIagent object (or class???) where a player is a playercreature.

I believe it would be possible but it would take some work. I also suspect you would have to write new AI logic to do the flourishing/buffing etc.

I could be completely wrong here though. Just kinda taking my best stab at it to stimulate some discussion.
 

drdax

Member
Joined
Jun 11, 2015
Messages
133
Pake: Patrolling -right now Point to Point ( Back and Forth

-------------------First : create NPCs who patrol------------------------

--template for patroling NPCs : "mobile name", respawn timer, X, Z, Y, facing, cellid #, "display name", "ID"

guards = {

--Imperial Base
{"pandorum_imperial_st_06", 360, 4294, 6.5, 150, 180, 0, "", "guard1"},
{"pandorum_imperial_st_06", 360, 4294, 6.5, 77, 0, 0, "", "guard2"},
{"pandorum_imperial_st_06", 360, 4920, 6.5, 172, 45, 0, "", "guard3"},
{"pandorum_imperial_st_06", 360, 4298, 6.5, 172, 45, 0, "", "guard4"},
--{"pandorum_imperial_st_06", 360, -45, 28, -4715, 0, 0, "", "guard5"}
},

-- droids
droids = {
{"imperial_sentinel", 360, 4300, 6.5, 0, 0, 0, "", "droid1"},
{"imperial_sentinel", 360, 4370, 6.5, 100, 0, 0, "", "droid2"},
{"imperial_sentinel", 360, 4370, 6.5, 163, 0, 0, "", "droid3"},

---------------------Second : Spawn Mobiles with Patrol Logic -------------------------

function skaradoshimperialbase01ScreenPlay:spawnMobiles()

--spawnMobile((self.planet), "le_repair_droid", 0, -29, 28, -4717, -15, 0)

for i,v in ipairs(self.guards) do
local pMobile = spawnMobile(self.planet, v[1], v[2], v[3], v[4], v[5], v[6], v[7])
if (pMobile ~= nil) then
writeData(SceneObject(pMobile):getObjectID() .. ":currentLoc", 1)
writeStringData(SceneObject(pMobile):getObjectID() .. ":name", v[9])
CreatureObject(pMobile):setCustomObjectName(v[8])
createEvent(getRandomNumber(350,450) * 100, "skaradoshimperialbase01ScreenPlay", "TestPatrol", pMobile, "")
createObserver(DESTINATIONREACHED, "skaradoshimperialbase01ScreenPlay", "testPatrolDestReached", pMobile)
AiAgent(pMobile):setAiTemplate("manualescortwalk")
AiAgent(pMobile):setFollowState(4)
end
end

for i,v in ipairs(self.droids) do
local pMobile = spawnMobile(self.planet, v[1], v[2], v[3], v[4], v[5], v[6], v[7])
if (pMobile ~= nil) then
writeData(SceneObject(pMobile):getObjectID() .. ":currentLoc", 1)
writeStringData(SceneObject(pMobile):getObjectID() .. ":name", v[9])
CreatureObject(pMobile):setCustomObjectName(v[8])
createEvent(getRandomNumber(450,550) * 100, "skaradoshimperialbase01ScreenPlay", "TestPatrol", pMobile, "")
createObserver(DESTINATIONREACHED, "skaradoshimperialbase01ScreenPlay", "testPatrolDestReached", pMobile)
AiAgent(pMobile):setAiTemplate("manualescortwalk")
AiAgent(pMobile):setFollowState(4)
end
end
end
----------------------------Third : Add patrol parameters --------------------------------------------
unction skaradoshimperialbase01ScreenPlay:TestPatrol(pMobile)
if (pMobile == nil) then
return
end
local name = readStringData(SceneObject(pMobile):getObjectID() .. ":name")
local curLoc = readData(SceneObject(pMobile):getObjectID() .. ":currentLoc")
local nextLoc

if (name == "guard1") then
if (curLoc == 1) then
nextLoc = { 4294, 6.5, 150, 0 }
else
nextLoc = { 4294, 6.5, 77, 0 }
end
end

if (name == "guard2") then
if (curLoc == 1) then
nextLoc = { 4294, 6.5, 77, 0 }
else
nextLoc = { 4294, 6.5, 150, 0 }
end
end

if (name == "guard3") then
if (curLoc == 1) then
nextLoc = { 4290, 6.5, 235, 0 }
else
nextLoc = { 4290, 6.5, 172, 0 }
end
end

if (name == "guard4") then
if (curLoc == 1) then
nextLoc = { 4298, 6.5, 235, 0 }
else
nextLoc = { 4298, 6.5, 172, 0 }
end
end

if (name == "droid1") then
if (curLoc == 1) then
nextLoc = { 4150, 6.5, 0, 0 }
else
nextLoc = { 4300, 6.5, 0, 0 }
end
end

if (name == "droid2") then
if (curLoc == 1) then
nextLoc = { 4370, 6.5, 214, 0 }
else
nextLoc = { 4370, 6.5, 100, 0 }
end
end

if (name == "droid3") then
if (curLoc == 1) then
nextLoc = { 4294, 6.5, 214, 0 }
else
nextLoc = { 4370, 6.5, 163, 0 }
end
end

AiAgent(pMobile):stopWaiting()
AiAgent(pMobile):setWait(0)
AiAgent(pMobile):setNextPosition(nextLoc[1], nextLoc[2], nextLoc[3], nextLoc[4])
AiAgent(pMobile):executeBehavior()
end
---------------------------Fourth -determinewhat happens when deistination is reached -----------------------

function skaradoshimperialbase01ScreenPlay:testPatrolDestReached(pMobile)
if (pMobile == nil) then
return 0
end

local curLoc = readData(SceneObject(pMobile):getObjectID() .. ":currentLoc")

if (curLoc == 1) then
writeData(SceneObject(pMobile):getObjectID() .. ":currentLoc", 2)
else
writeData(SceneObject(pMobile):getObjectID() .. ":currentLoc", 1)
end

createEvent(getRandomNumber(350,450) * 100, "skaradoshimperialbase01ScreenPlay", "TestPatrol", pMobile, "")

return 0
end
 
Top Bottom