Scripts / Kill quests script

Author
Message
Overground Games
7
Years of Service
User Offline
Joined: 10th Nov 2017
Location:
Posted: 24th May 2020 17:09
Hi everyone I know how to use the script, but I have added some of the quest givers as entities that don't spawn at the start. So you have to complete certain quests first. BUT........ if the quest giver hasn't spawned yet and you walk exactly where the spawning entity will appear, it still says press 'e' to talk..... which can ruin the order in which my quests work if the player wanders about a bit. Is there anything I can do to make the press 'e' appear only when the entity has spawned? Thanks in advance,
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th May 2020 09:52
Yes use an if statement at the top inside your main function

if g_Entity[e]['activated'] == 0 then
return
end
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Overground Games
7
Years of Service
User Offline
Joined: 10th Nov 2017
Location:
Posted: 25th May 2020 13:37
Thanks ill try it and see
PM
Overground Games
7
Years of Service
User Offline
Joined: 10th Nov 2017
Location:
Posted: 30th May 2020 16:14
Hi ive tried it but not 100% sure ive done it right. do i change the 0 for entity number? i have a few quests on the script so do i put the return end on each one? sorry im a newbie
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th May 2020 19:12 Edited at: 30th May 2020 19:14
each script will need the code as long as you don't want them to spawn at start, yes.
and no, no changes are needed to the code, just place it inside the main(e) function of the quest givers

p.s. i believe this only happens if you set the entity to spawnatstart = no and alwaysactive = yes
if you can set alwaysactive = no the problem should also go away
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Overground Games
7
Years of Service
User Offline
Joined: 10th Nov 2017
Location:
Posted: 30th May 2020 19:54
im sorry i cant work it out, i am greatful for trying to help. is there another way by using a quest counter or numbering each quest in the killscript.lua ? so one wont start before the one before is complete? sorry for my incompetance
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 31st May 2020 18:07
Hey ya. That's good if you have spawning only after quests working.
So it sounds like you should get this. Did you put that part smallg showed;
if g_Entity[e]['activated'] == 0 then
return
end

Needs to be just inside the main body or --b e l o w--;

function mykillquests_main(e) ----------- like this;
if g_Entity[e]['activated'] == 0 then
return
end
-------- rest of main body script.
-------- rest of main body script.
-------- rest of main body script.

Maybe show us what you have in the beginning of the script...

Sometimes even easier to use your own flag variable, something like
local isspawned = {} ----- before init
isspawned[e] = 0 ----- inside init

if a_task == 1 then isspawned[e] = 1 end --- a_task would be a global var you can
assign like the example above. Leave out the 'local', and make it zero '= 0' as well.
if isspawned[e] == 1 then
prompt (e, "press 'e' to talk") ------- etc
end

You can advance the tasks by; a_task = a_task + 1
((I'm sure it's all in smallg 's script anyhow.))

Step 1;
Learn to (call up) / assign variables in Lua.
Step 2;
The if/ then statement is a comprehensive call that carries 99% of scripting.
Learn to use it, and you'll be surprised at how far you can go with just that!
PM
Overground Games
7
Years of Service
User Offline
Joined: 10th Nov 2017
Location:
Posted: 31st May 2020 18:27
Hey thanks for reply. probably easier if i show you and explain

Heres part of the killquest.lua script where my quests and entities are set out



function killquests_main(e)

if haveBuiltQuests == 0 then
questBuildDelay = questBuildDelay + 1
if questBuildDelay > 1 then
haveBuiltQuests = 1

quest = newQuest(69,"We made it to the Brumisia Cove." , "You will need some purple potion to keep your staff working." , "Grab some potion and a Ruhn stone from the crates." , "Nice job, you will need a couple more bottles." , "Meet me at the front of Dafore Village and we can get more.", "Leave the boat between barrels. Press 'M' key for the map.")
addQuestTarget(1,109)
addQuestTarget(1,81)

quest = newQuest(97,"You managed to find me, head towards Dafore Village." , "I saw a guarded cart with some potions on." , "Sneak up on the cart, you only need two bottles." , "Well done! You should have plenty now." , "Head into Dafore Village and explore.", "I'm sure you'll meet a few people on you're way!")
addQuestTarget(2,79)
addQuestTarget(2,80)


quest = newQuest(76,"I've not seen you here before, welcome to Dafore Village." , "Have you seen my friend, Hutdrith? He's got a weapons stall here." , "He has a magic dagger for me, could you please get it for me?" , "Thank you so much for getting me my new dagger." , "Have a walk round here and meet some new people.", "Thank you again, friend.")
addQuestTarget(3,116)


quest = newQuest(423,"Hi there friend, can you please help me?" , "I have just been robbed, a hooded character attacked me." , "Can you find them, take them out and get my potion back?" , "Oh thank you kind sir, I can't thank you enough." , "Meet Thirdoul, he mines and sells Ruhn Stones.", "I'm sure you could help him out too.")
addQuestTarget(quest,654)
addQuestTarget(quest,657)


quest = newQuest(658,"I'm Thirdour, I mine and sell Ruhn Stones here in Dafore Village." , "Would you head to Dragons Cave and find me some more Ruhn Stones?." , "Last time i went there, another gang from Rhexia Woods was there. So be careful" , "Amazing! Thank you. I hope you didn't have much trouble." , "Here, have some Yellow Ruhn Stones as a thank you.", "You may find they'll come in useful if you go to Fort Naxiths.")
addQuestTarget(quest,663)
addQuestTarget(quest,664)
addQuestTarget(quest,665)
addQuestTarget(quest,666)

quest = newQuest(678,"Hey, I've heard you've been helping a few of us dwarf's in Dafore Village." , "There's a Barbarian in Fort Naxiths, he's threatened to burn our village down." , "Can you stop the threat before it's too late? He's been seen by the well." , "You have saved our village, I can't thank you enough." , "Dafore Village and Fort Naxiths are safer places now.", "You should explore that place out, full of all kinds of great people.")
addQuestTarget(quest,679)

----END----

The first quest, entity '69' is the questgiver and ive set it so once you collect the two items, '109' & '81' the second questgiver will appear.
But, if i was to walk past the first quest giver and carry on around my world, when i walk to where the second quest giver is (and hasnt spawned yet) then the 'press e to talk' still appears.

Sorry if im not being clear or understanding. It says something about a questcount, i just need to seperate all the quests so wont show until one before is complete
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 1st Jun 2020 03:35

maybe 'haveBuiltQuests' could be a global array looking like
haveBuiltQuests[q] where q = quest number.

then when a quest is complete, just trigger/ check that haveBuiltQuests[q] = 1
before allowing the Text() that is giving you trouble.

Example you walk up to Quester #4:::::::

if haveBuiltQuests[3] = 1 then Prompt( 'press e to talk')
if PressE then haveBuiltQuests[4] = 1--
------------------------------------------------------------------
------------------------------------------------------------------

PM
Overground Games
7
Years of Service
User Offline
Joined: 10th Nov 2017
Location:
Posted: 1st Jun 2020 09:07
Thank you I'll try it. It's the only thing stopping me finishing my game.
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 1st Jun 2020 15:05
Just take into account than for sake of the comparison you have to use "==", and for pass a value you use "=", ie:

If a == b then
c = a
end

Here we are checking if a is equal to b, if so then we pass the a value to c.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 1st Jun 2020 17:27
@3com -- you're right that is true-- but
IMHO that's the worst thing LUA has ever done!!!
Been 20+ ago years since writing in Basic, but still ...
it lingers on, gets me every time. LOL
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Jun 2020 22:04
Exactly the same as C and C++ btw.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 2nd Jun 2020 16:36
Not a big fan of old traditions that aren't efficient. Hindsight is 20/20
Looks like a bizarre tradition of old when Morse code and Unix was
on everyone's mind-- and followed to show homage to the tradition?
In the spirit of that why didn't they require
if a >> b or c ~~== d or e <<== f
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 2nd Jun 2020 23:05
But you do require = and == to differentiate between an assignment and a comparison.

The author of the language could have come up with something new or even copied any one of half a dozen other languages (Ada := and = for example) but the decision he took was to use the one everyone was already familiar with and which was pretty much the most used in the industry at the time, i.e. he copied the C method.

Btw > and >> are different things in C as well!
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Jun 2020 11:33
but == makes sense when you use <= to look for anything less than or equal to, >= to look for anything greater than or equal to, ~= to find not equal to and == to find anything exactly equal to.
though if it supported both = and == it would be fine too i'm sure
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 3rd Jun 2020 13:08
I feel comfortable with = and ==, what I hate to use is :

{
your code here
}
in c++. But I love the pointer address of. *pointer
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-12-22 02:54:20
Your offset time is: 2024-12-22 02:54:20