Product Chat / Using the radar script - How to use and configure

Author
Message
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 31st May 2016 01:55 Edited at: 4th Jun 2016 06:24
Hi all. Here's a quick video I did to show how to use the radar script. I also show how to quickly configure it so you can position it anywhere you want easily. The good news is that it should be included as standard in the next update But, if you can't wait and want to see how to do it yourself, here's how.

There is an official video showing the same basics (I watched the live stream at the time), but this probably gets to the point faster and also shows how to un-hard-code the position co-ordinates for easier use.

I've never used the radar script before and although I have seen it in use many times, after using it found it very cool and easy to use. I've just edited it a bit and made it a bit easier to navigate, with 2 variables to set the position now, rather than having to alter 3 sections of code
Here's a second video explaining how to add different objectives.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 31st May 2016 15:26 Edited at: 31st May 2016 15:26
Awesome Thanks ... Just what I need ..
I know Lee covered it but as you say .... Yours is much more clear and gets right into it
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 31st May 2016 19:52
Nice one DVader!!!
Suggestion: Notepad++ is a very good LUA editor, and is free. Just a suggestion

I'm not particularly interested in the radar now, I'm working on something different now (one scifi model for the store), but if it has to do with sprites, as they are created and how are destroyed.

The question is: Can you hide the radar temporarily, and turn it on again when you need it?

I've been reviewing the script radar, and can not find any code that does, from what I gather that not contemplate the possibility to hide or destroy and re-create it, when necessary.

There's nothing like "DeleteSprite (mySprite)" in the radar code.

I think something like "HideSprite / ShowSprite" avoid having to destroy it and create it, every time you want to use.

Had not worked much with sprites before, I'm not very familiar with them.

Suppose you have a computer display in should appear a number of sprites (let's say fruits), arranged in rows and columns, as well, the fact of calculating the position of these sprites (fruits) over the pc display is a pain for me, and I have to use trial and error to find the ideal position for each one, and I hate having to do this.

I think there must be a simpler way to do this, if so, do you explain it?

I already know the theory, you create first screen in the init section of the code, and then create and "position sprites" other above the screen (this is the hardest part for me), and I would like to simplify, if possible.

I have understood that they are based on the screen coordinates, this would be fine for the first sprite, the sprite base, in this case, the pc display; but for me, the sprites intended to go over the base sprite (display), they should be in this case "display" co-or based, and not screen based, it may help to position the others sprite.

SetSpritePosition ( mySpriteBase , 50 , 50 ) -- center of the screen. (4 the pc display). And...

SetSpritePosition ( mySpriteApple , mySpriteBase['x']-0.5 , mySpriteBase['y']-0.5 ) as example

so with the rest of the fruits, till get all them arrange in cols and rows over the pc display, so the player can choose whatever.

Or it is already so, and I'm missing someting here?

Thanks 4 all feedbacks

3com


Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 31st May 2016 20:11
Maybe a separate script that hides/shows the object you have your radar script attached to? Or would the radar still run with the object its attached to hidden?

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st May 2016 20:15 Edited at: 31st May 2016 20:16
the trouble with making it co-ord based is not every screen will be the same and you would also need to include the option to adjust the resolution right?
% based is much better in the end, you need to do far less work to make it work in all resolutions and you can always convert your co-ords to a % anyway.
% = (co-ord you want / max size in that direction) * 100
i.e. to find the % value of x for the co-ordinate x = 40 on a screen size of 1980
x% = (40/1980)*100
x% = 2%

to hide a sprite you can simply move it past 100, in the radar they use SetSpritePosition("name",200,200)
there is also a DeleteSprite("name") command but if you are reusing the sprites this is a bad idea.

edit, yes the code will still run while the object is hidden.
radar images even carry over to new levels (sprites dont get cleaned up on level complete as they should)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 31st May 2016 21:03
@ Belidos
I really do not want to use radar, but the logical of the radar script in my own, to fit my needs.
I just want somehing like the example above (fruits over the pc display, arranged as cols and rows).
And my question is, how to position the fruits over the pc display easier.

@ smallg
Quote: "edit, yes the code will still run while the object is hidden.
radar images even carry over to new levels (sprites dont get cleaned up on level complete as they should)"

Ya, that's my point.

Quote: "there is also a DeleteSprite("name") command but if you are reusing the sprites this is a bad idea."

Yes, I'm reusing them.
Delete them does not the best way, but at the end, the best perfomance option, I afraid.

In fact my goal goes o how to get this "X=40" in the screen, in another words:

Imagine scene, you've the pc display in front of you, you know where you would want the fruit appears, but how you get this point, without position it/run test game/see than their position has nothing to do/ try another value in script, and start again, and again, and again, till you get the position you want; and now repeat the same hate proccess again, with the rest of the fruits.

So, is there any easy way to do so, and I'm missing it ?

Thanks to both for the feedbacks.

I've noticed they does, just declaring some params when array is create, for later use, I'm using same way, and it works; anyway I would prefer sprites having X,Y, coordinates, and the way to work with, like my example above.
If the base sprite is already centered in the screen, never may customer screen size; and the rest of the fruits taking display coordinates, instead of screen coordinates.

3com






Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 31st May 2016 22:30
Well, percentage can cause issues but as said above, also keeps it working with multi-resolutions easier. There's no hide sprite as yet, I simply position them off screen far enough so you will never see them, say 200,200. So to hide the radar, you would simply change radarx and radary to 200 and that would move it out of the way until you want to move it back.

Messing about running and testing to get things looking right is part of the process really. Percentage makes it fairly easy to get close just by guessing. Most of my time scripting stuff, is spent testing and running over and over. You could of course, write code to position the sprites with your mouse and save them. Or just display the co-ordinates on screen so you can note them down.

Oh, and thanks synchromesh, glad to help


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
Jerry Tremble
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 31st May 2016 23:20
Thanks for this little tutorial! I never watched the broadcast and am still not sure whether I want radar in my game or not, but it's good to know. I tried it in a level I'm working on and it helped me discover that most of my entities were set to explodable, lol. I was treated to a very nice chain reaction!
MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 10/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 10/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 1st Jun 2016 07:27
great tut, thanks DVader-might use this in my game
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen). Wanting a new PC at some point.
Interests: Drumming, Saxophone, Art, Theatre, Music.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 1st Jun 2016 12:46
Thanks a lot DVader 4 the useful tip.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 3rd Jun 2016 17:16 Edited at: 3rd Jun 2016 17:17
I would like to have two different types of objective with two differently coloured dots on the radar. Can someone please suggest the most efficient way to do this.

Many thanks.
Julian
PM
lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 3rd Jun 2016 23:40 Edited at: 3rd Jun 2016 23:43
Quote: "
I would like to have two different types of objective with two differently coloured dots on the radar. Can someone please suggest the most efficient way to do this."


I've been trying for several hours now and no joy. Anyone got an idea?

At least it taught me what arrays are but I still can't get it to work.
Julian
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 4th Jun 2016 00:55 Edited at: 4th Jun 2016 00:56
You mean like this?

It's not as easy as you would think, as you can see from your own efforts. Very easy to get total crashes when getting scripts to talk to each other like this does. It took me a fair few tries to get it to work, but have now added a different type of waypoint and set it as green. I'll see if I can get a video up showing what I have done. There's not too much extra code involved and I have basically made a second objective script for the sake of keeping it simple and changed the logic of the main radar script a little.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.

Attachments

Login to view attachments
lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 4th Jun 2016 17:44
Thanks. Yes, I got a lot of crashes and runtime errors, 302 I think and 502.
Julian
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 4th Jun 2016 18:02
The video is already up by the way in case you missed it Just look at the start of the thread.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
lordjulian
10
Years of Service
User Offline
Joined: 10th Jan 2014
Location:
Posted: 6th Jun 2016 18:51 Edited at: 6th Jun 2016 21:39
Thanks! This works well!
Julian
PM

Login to post a reply

Server time is: 2024-11-25 01:51:30
Your offset time is: 2024-11-25 01:51:30