This time around I'm trying to make certain NPCs hostile towards players, however I'm getting that it isn't setting the relationship properly.
[code]
function getNPCs(town)
for _,v in pairs(ents.FindByClass("npc_citizen")) do
theTown=v:GetVar("Town")
if(theTown==town) then
return v
end
end
end
[/code]
that's my function for getting NPCs, so I do getNPCs with town A, stored as var x, and getNPCs with town B, stored as town y, so how would I make all NPCs as town A, hate town B?
well there is no argument for town B... so you would need to make it.
Anyway. heres a whole Diplomacy system script for you. Should handle liking and hating!
Man you better put me in your Credits. I've written what... 4 or 5 scripts for you? :P
Just messing.
[code]
function SetDisposition(TownA, TownB, Relationship)
for _,FirstCivi in pairs(ents.FindByClass("npc_citizen")) do
FirstTown=v:GetVar("Town")
if (FirstTown == TownA) then
for _,SecondCivi in pairs(ents.FindByClass("npc_citizen")) do
SecondTown=v:GetVar("Town")
if(SecondTown== TownB) then
if (Relationship == "hate") then
//Make the feelings Mutual
FirstCivi:AddEntityRelationship(SecondCivi, D_HT, 99 )
SecondCivi:AddEntityRelationship(FirstCivi, D_HT, 99 )
elseif (Relationship == "like") then
//Make the feelings Mutual
FirstCivi:AddEntityRelationship(SecondCivi, D_FR, 99 )
SecondCivi:AddEntityRelationship(FirstCivi, D_FR, 99 )
else
print("You fucked up jackass...")
end
end
end
end
end
end
[/code]
Sorry, you need to Log In to post a reply to this thread.