Scripts / Strange problem. Only one NPC on the map works properly.

Author
Message
Olfa
7
Years of Service
User Offline
Joined: 12th Feb 2017
Location:
Posted: 17th Mar 2017 22:17
I'm making the RPG and I have several quest givers and several bla-bla-bla persons. Now I've made two quest giver (the second give its quest only if the player has done the first), and one chatterer. But only one of them works.
Each of them works properly if I delete others.
What am I doing wrong?
I suppose the problem is in the global vars. But I don't have more ideas. Can I ask your advice?
Maybe somebody had the same problem?
How should I work with global var "mainquest"? It is a storyline var (0 at start, 1 when the first quest completed etc).
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 17th Mar 2017 23:17
Which quest script are you using?

Are you supposed to attach the script to a dynamic object that is always active?
This is normally how most of these work.
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, Screen resolution 1680 x 1050.

Olfa
7
Years of Service
User Offline
Joined: 12th Feb 2017
Location:
Posted: 18th Mar 2017 14:07
I'm using my own scripts.
I tryed all options - static, dynamic, always active and no. Didn't help

Here my quest givers, Sool (village elder) and Eevnee (his daughter).

Sool:


Eevnee:


When both persons on the map, only Eevnee works. But if I delete her, Sool starts to work properly.
Maybe its something in .fpe?
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Mar 2017 15:35
Quote: "mainquest = {}
replica = {}"

{} is used to define an array, you are not using them as arrays (or lists, tables)
i.e. replica[1] = 0
replica[2] = 5
etc
in your case it's fine just to declare them as normal variables as you dont seem to have any overlap (as you're using replica and then replica_3)

i believe the problem is likely because you are using the old image system which can only handle 1 image at a time, perhaps changing up the lines that read
if PlayerDist > 150 then
to something like
if PlayerDist > 150 and PlayerDist < 200 then
will be a quick solution? (not 100% sure).
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Olfa
7
Years of Service
User Offline
Joined: 12th Feb 2017
Location:
Posted: 18th Mar 2017 16:44
OMG! Wow! I cannot believe!

[quote=]if PlayerDist > 150 and PlayerDist < 200 then

It works! Thank you! thank you!
But one strange bug remains. SwitchScript command works for Eevnee scripts, but doesn't work for Sool's. Could you please help me one more time?
Maybe I have to show other scripts to you?

I already replace Sool's "if replica == 3 then" to the "if replica == 3 and PlayerDist < 150 then", but it doesn't help.

___
And how can I get an info about new image system? In the global.lua I see the same text.

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Mar 2017 17:02
the new system is at the bottom in the comments, basically you load an image and convert it to a sprite, this gives you much more control over it.
Quote: "LoadImage: myImage = LoadImage ( "myFolder\\myImage.png" ) -- Anywhere inside GG Files folder (however it is best to put into scriptbank images folder for making standalones)
GetImageWidth: myWidth = GetImageWidth ( 1 ) -- get percentage width of image
GetImageHeight: myHeight = GetImageHeight ( 1 ) -- get percentage height of image
CreateSprite: mySprite = CreateSprite ( myImage )
PasteSprite: PasteSprite ( mySprite ) -- pastes the sprite at its current location (good for pasting sprite BEHIND text)
PasteSpritePosition: PasteSpritePosition ( mySprite , x , y ) -- as above but pasted at a specified XY coordinate
DeleteSprite: DeleteSprite ( mySprite )
SetSpritePosition: SetSpritePosition ( mySprite , x , y )
SetSpriteSize: SetSpriteSize ( mySprite , sizeX , sizeZ ) -- passing -1 as one of the params ensure the sprite retains its aspect ratio
SetSpriteDepth: SetSpriteDepth ( mySprite , 10 ) (0 is front, 100 is back)
SetSpriteColor: SetSpriteColor ( mySprite , red , green, blue, alpha )
SetSpriteAngle: SetSpriteAngle ( mySprite , 180 )
SetSpriteOffset: SetSpriteOffset ( mySprite , 5 , -1 ) -- would be the centre for a 10% width image assigned to a sprite, passing -1 as one of the params ensure the sprite retains its aspect ratio
SetSpriteImage: SetSpriteImage ( mySprite , myImage )"


not sure about the switchscript, it looks fine in your above scripts so maybe a mistake in the mantis_quest.lua?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Olfa
7
Years of Service
User Offline
Joined: 12th Feb 2017
Location:
Posted: 18th Mar 2017 21:48 Edited at: 18th Mar 2017 21:50
Thank you!

Scripts are -
- flowerquest from Eevnee (works well)


- mantisquest from Sool (automatically switches to the next script, "sool1". No idea why )

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Mar 2017 22:44
try changing the last part of the sool.lua script to read
if replica == 3 then
mainquest = 0 --add this line
SwitchScript(e, "mantis_quest" )
end

otherwise make sure you are not calling mainquest to become 1 elsewhere?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Olfa
7
Years of Service
User Offline
Joined: 12th Feb 2017
Location:
Posted: 19th Mar 2017 13:30
Quote: "make sure you are not calling mainquest to become 1 elsewhere?"

smallg, this.
I fixed it and now all is OK and I can move forward with my game.

Thank you so much!
PM

Login to post a reply

Server time is: 2024-12-23 04:24:46
Your offset time is: 2024-12-23 04:24:46