Scripts / coin script issue

Author
Message
DonVito Napolitano
7
Years of Service
User Offline
Joined: 17th Feb 2017
Location:
Posted: 10th Feb 2018 19:02
Hi, I'm creating a Mario fan game just for myself. I actually made a script for a coin model I imported into game guru. However my script does not do what I though it was going to do. It does not even show the text on screen when I test my game. I been working on this for a while and before I go on I just want to collect the coin and for it to then be destroyed and added to a score on the game screen



Chances are i'll post my game on youtube but other than that I just cant post it, Nintendo is to strict about fan games! Im not making this to share anyway... just because I love me some mario

Thank you in advance and I plan to be more involved on the forums. If any one wants to see what I created so far I could attach a picture I guess....


PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Feb 2018 19:53
Have you made the entity active?

Is the name of the script "aicoinmario.lua"?

Have you attached the script to the entity?

If you still don't see the text try putting Prompt("Here") as the first line in the aicoinmario_main function to see if you get that displayed.
Been there, done that, got all the T-Shirts!
PM
DonVito Napolitano
7
Years of Service
User Offline
Joined: 17th Feb 2017
Location:
Posted: 10th Feb 2018 22:38
Hi. The coin entity is active and I attached the script and yes that is the name of the script, "aicoinmario.lua" I added the line Prompt("Here"). Still no text on screen.


[img]null[/img]

I attached two screen shots of my test level if it helps. I must be missing something but for now Im not exactly sure what Im doing wrong...

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Feb 2018 22:48 Edited at: 10th Feb 2018 23:06
Ahh, I think I know what is happening, change 'PlayerDist' to 'local PlayerDist'.

Edited to add, actually that shouldn't be the problem as you are setting it before checking it. Hmm, bit of a puzzle.

Try commenting out the Destroy and see if that gets the Prompt displayed.
Been there, done that, got all the T-Shirts!
PM
DonVito Napolitano
7
Years of Service
User Offline
Joined: 17th Feb 2017
Location:
Posted: 10th Feb 2018 23:03


That is what you mean right? Still the same outcome. Is there anything else you notice that I don't or that you recommend? Thank you in advance
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Feb 2018 23:10
Yep, that was it, had a theory but obviously its not that, try commenting out the Destroy command to see if you get the Prompt then.
Been there, done that, got all the T-Shirts!
PM
DonVito Napolitano
7
Years of Service
User Offline
Joined: 17th Feb 2017
Location:
Posted: 10th Feb 2018 23:19
I even commented out my local variable and if statement and still no text. I'm really not entirely sure what is going on
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 10th Feb 2018 23:21 Edited at: 10th Feb 2018 23:31
Well to start with, the text will only display as long as the item exists on the map, as soon as you pick it up it gets destroyed and is no longer telling the engine to display the text, you have to display the text using a separate script that's in an always active object that doesn't get destroyed. Also you need to make points g_points so that it can be accessed globally by multiple scripts. Also your distance check is way too low, if it's < 1 like that then you need to be 100% on the exact spot where it's origin point is to collect it, which you never will be because of camera height and position, < 50 is what you need.

I've attached two scripts, put coinhud.lua in an always active dynamic object out of site somewhere in the map, put aicoinmario.lua in the coin.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Feb 2018 23:27
It is definitely not running the script, double check that the script name is exactly the same as the function names.

Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 10th Feb 2018 23:29 Edited at: 10th Feb 2018 23:38
Quote: "It is definitely not running the script, double check that the script name is exactly the same as the function names.
"


I've fixed it for him in the post above. It's because he's calling text inside the same script he's destroying, so it never gets displayed. He needs to put the text part in a separate script, and his distance check is too small.



Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Feb 2018 23:31
With the Destroy commented out it should have displayed the text.
Been there, done that, got all the T-Shirts!
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 10th Feb 2018 23:34 Edited at: 10th Feb 2018 23:34
Oh and also with the text thing, you need a space before the ) for some reason. So plenty of issues, but if you use my scripts posted above it should work.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
DonVito Napolitano
7
Years of Service
User Offline
Joined: 17th Feb 2017
Location:
Posted: 11th Feb 2018 00:03
Thanks! I understand now and Ill keep working on my lua skills. I hope to show the game guru community my game soon!
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 11th Feb 2018 00:05
I was just going to say.... a distance check of 1 is way too small.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960

Login to post a reply

Server time is: 2024-12-22 19:37:32
Your offset time is: 2024-12-22 19:37:32