Scripts / Am I going in the right direction with this script idea?

Author
Message
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 30th Jul 2015 20:35 Edited at: 1st Aug 2015 01:09
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!)



then it does distance to player checks



(then partial Psuedo-Code here)


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.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st Jul 2015 19:20 Edited at: 31st Jul 2015 19:20
for the reward part you would use
AddPlayerWeapon(612)

sounds are set in the properties of the character then use
PlaySound(e,1)

you have the basic idea right but you will need to use states to contain each part of the script otherwise he wont stop following the player and such.
that's basically just a main 'if - end' statement
such as


etc
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 1st Aug 2015 00:40
Oh hey thanks for the reply smallg, was kinda hoping to see you since this is like a special adjustment to your own script
ok so its
reward = reward +1
AddPlayerWeapon(107) (was the real number thanks to your promte.lua lol)
Gotcha
Understanding == 1

Your snippet has the POW guy on at spawn i guess but waiting so he is "hide/invis".......I need a triggerzone to activate him, which case he does run at me and stops at a certain distance and "starts" the quest. I guess I understand the states thingy.

I was playing with this:



Thats probably terribly wrong because im missing basic code knowledge but have been working with programmers for years.
the calling 2 _init(e) is probably a major no go that will crash it completely.
Implementing your way seems to make more sense.......but its above my basic understanding and therefore nearly impossible for me to immplement along with the following problem that is an absolute must have: (I will/want to be doing a lot of voicing like this in this game)

My problem with the sound is that theres 3 times he will speak.
one telling what the quest is..................replaces: Prompt("Hey you, Kill " .. killedmax .. " Trrrists! *Press E to accept*")
one telling him to keep going.................replaces: Prompt("Kill " .. killsremaining .. " more Trrrists!")
one telling him here is your reward.......replaces: Prompt("Good job!! *Press E ta git some cool shiznitz*")

and this will be obsolete in the code: Prompt("Here is your Reward " .. reward)

so sound1 slot in the entity properties is way too limited for this and other nice1 ideas down the road.........
would somehow using the soundset work? like as pictures are displayed in note.lua..........001.wav, 002.wav in "stories" folder in scriptbank?

In the end I an wishing for full blown conversation going on......you have to rescue someone....and have to do things for various people etc......I want to avoid text as much as possible.


Also what I dont get in your killquest code is the difference between (e) and (a)
The only stupid questions are those that were never asked.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st Aug 2015 16:23
'a' is being used to cycle through the for loop - basically just a placeholder for the numbers being checked (it can be any letter or word)
in my script on the ai guys (that will be killed for the quest) i have defined the variables enemyEN and enemyendEN (enemyEN being the 'e' of the first guy and enemyendEN being the 'e' of the last guy - this makes it quicker to check but you can simply check 1,99999 etc)

your code wont work as you have 2 scripts in 1, you need to separate them, there's no reason you can't still Spawn him from a trigger zone if that is your intention or simply remove the spawnwhenclose functions completely and add it's code to the main script but use a state as i said before to make sure it's triggered at the current time only.... adding states is a really good idea, it just helps code make much more sense in your head, improves flow and also means stuff can be limited to a '1 time thing' much more easily - this is the first thing you should do.

it's possible to add sounds with a sound set yes but i think you are bound to the current sub folder names already in the character audiobank so to use multiple sounds you need to have 1 in onAggro, 1 in onAlert etc (otherwise they are random order i believe if all placed in 1 folder?)
personally i dont use them as i find it's way too fussy about which sounds will actually work - even some stock sounds don't work for some reason and there's no information on why.
but anyway to use them you just set the soundset with
SetCharacterSound(e,"folder name")
and then call the sounds using the desired sub folder name
PlayCharacterSound(e,"onAggro")
etc

finally you will need to check the commands you are using are real
i.e. Stop(e) -- < doesnt exist
FreezePlayer(e) -- < is actually FreezePlayer()
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 1st Aug 2015 22:12
Oh hehe I made it clear in each that I was psuedo coding that to convey what I was aiming for.
Nice that i was taking a guess and got the freezeplayer e thing almost right

I am forced to be honest here. I don't know enough about manipulating code to be able to do this. I looked at your states and thought....hmmm looks cool........then looked at my stuff and saw yours looked cleaner but still dont know whats its actually doing because i have 0 background in scripting.

2 scripts in one.
you mean the 2 init calls? if so.....this was logical to me that it wasnt going to work like that so I thought of a seperate script and calling an "include" of that script to your main one.


After talking with many people I have come to realize that with the present state of the game, I will not be able to play more than 1 sound. Judging by what is coming in the near future, I will be able to. Using omega core to achieve this would work right now.....but will not work once the performance update appears.
The only stupid questions are those that were never asked.
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 2nd Aug 2015 16:21
Sent you a PM.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Login to post a reply

Server time is: 2024-12-22 01:19:47
Your offset time is: 2024-12-22 01:19:47