Hello to everybody!
I've tested the smallg's script "kill x of y quest" : https://forum.game-guru.com/thread/207801?page=3#msg2490852 and it works well, but I would like that the "reward" is to jump to a specific level. I've tried with a winzone but it doesn't work.
The script is this:
--change this to however many enemies you want the player to kill to complete the quest
local killedmax = 10
-----------
local enemyEN = 1
local enemyendEN = 1999
local pressed = 0
local queststarted = 0
local reward = 0
local killed = 0
local killsremaining = killedmax
local checked = {}
for a = enemyEN, enemyendEN do
checked[a] = 0
end
------------
function killquest_init(e)
end
function killquest_main(e)
if queststarted == 1 then
Prompt("killed = " .. killed .. " / " .. killedmax .. " baddies!")
for a = enemyEN , enemyendEN do
if g_Entity[a] ~= nil then
if g_Entity[a]['health'] > 26 then
if checked[a] == 0 then
checked[a] = 1
end
end
if g_Entity[a]['health'] < 1 and checked[a] == 1 then
checked[a] = 2
if killed < killedmax then
killed = killed + 1
end
end --end HP below 1 check
end --end (e) exists check
end --end for loop
end
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
if PlayerDist < 100 then
if queststarted == 2 then
Prompt("Rewards given " .. reward)
else
if killed < killedmax then
killsremaining = killedmax - killed
Prompt("Please Kill " .. killsremaining .. " more baddies for me!")
end
if killed == 0 and queststarted == 0 then
Prompt("Please Kill " .. killedmax .. " baddies for me! *press E to accept*")
if g_KeyPressE == 1 and pressed == 0 then
queststarted = 1
pressed = 1
end
end
if killed == killedmax then
if g_KeyPressE == 1 and pressed == 0 then
reward = reward + 1 --change this to desired reward
queststarted = 2 --quest finished
pressed = 1
else
Prompt("Thanks!! *press E to accept reward*")
end
end
end
end
if g_KeyPressE == 0 then
pressed = 0
end
end --end of function
About you, which is the best way to implement this win condition?
Moreover, I've also tested the script "kill x enemies to open door" : https://forum.game-guru.com/outbound?url=https%3A%2F%2Fforum.game-guru.com%2Fthread%2F207801%3Fpage%3D10%23msg2532248 but it doesn't work properly. After the first kill, the counter not works. Please, can anybody test it?
Please, for me it's important to create a game in which the player kills a specific number of enemies to go to another level (possibly with a written similar to "well done, go to level..." before that), or to kill a number of enemies in order to open a door (that leads to a win zone).
I think that these win conditions are good for many people.
Thank you in advance.