I am trying to learn from multiple scripts as references to achieve the following: (and am so far failing miserably)
Scenario:
A guy at the beginning of the level appears from behind a rock and runs towards the player. Once that "NPC" gets within the set distance to the player a sound file is played of his voice asking for help, text is displayed asking to accept the spoken quest by pressing e. After you did the quest come back with him still there, he notices you did it, and speaks to you once in proper set range etc.....and simply gives you your promised reward when his voicefile is done talking. Yay......
He is invisble at the start.
He is made visible by a triggerzone
Once visible he runs towards player
When in range of the player, the player is WASD frozen, he stops himself too still looking at player and he plays his .wav sound which is him asking you to kill the set number of enemies. He has a special weapon if I decide to help.
Once the LengthofSound in seconds is over, a text prompt appears (not before!) asking the player to accept by pressing E.
The script should initially hide this NPC with: (all still basically psuedo code!)
an array above the functions is for checking if he is activated
local activated = 0
if activated == 0 then
Hide(e)
if activated == 1
Show(e)
MoveForward(e,speed)
RotateToPlayer(e) (to get him to move to the player)
end etc.......
then it does distance to player checks
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
(then partial Psuedo-Code here)
if queststarted == 2 then --(quest is done)
FreezePlayer(a)
SetSpeed(e,0) -- (stops himself?)
LookAtPlayer(e)
PlaySound(*path*\Game Guru\Files\audiobank\stories\mygamefolder\questvoice02reward.wav)
Prompt("Accept his reward *Press E* or just walk away")
UnfreezePlayer(a)
else
if killed < killedmax then
killsremaining = killedmax - killed
Prompt("Please Kill " .. killsremaining .. " more nerds for me!")
end
if killed == 0 and queststarted == 0 then
FreezePlayer(a)
SetSpeed(e,0) -- (stops himself?)
LookAtPlayer(e)
PlaySound(*path*\Game Guru\Files\audiobank\stories\mygamefolder\questvoice01offer.wav)
StartTimer(e) --(not 100 sure how to do this correctly)
if timer > 34 seconds then -- (not sure how to run seconds yet)
Prompt("Accept his offer *Press E* or just walk away")
if g_KeyPressE == 1 and pressed == 0 then
UnfreezePlayer
queststarted = 1
pressed = 1
end etc......
I basically want to add all of that to smallg's killquest script to customize it for this situation. It does the rest of the quest just fine and checks health etc if quest is started or not and all that jazz. Mainly.....I want to replace what the NPC says with wav files of his voice rather than just display some text.
The question is: is this possible and am i on the right track on how to do this?
I don't want anyone to write the script but see if im getting the logic sort of right.
Also unclear...
In his killquest script it gives a reward and my final question is:
A quest with a weapon reward where the script is setting "reward+1" (which gives the reward)
The script says
reward = reward + 1 --change this to desired reward, which is the item to reward
Does this reward have to be in the level somewhere hidden and I have to write the NAME of it inside this script like
reward = Reward + pistol01 Tested((((((((((nothing happens))))))))))
or the E Value of it????
reward = reward + 612 Tested((((((((this makes it say here is your reward 612))))))))))
In advanced I thank any of you wizards for assistance
The only stupid questions are those that were never asked.