Jump to content

Scripting Tutorial 4 - Hay


kevuwk

Recommended Posts

Posted

NOTICE: THIS TUTORIAL MAY BE OUTDATED! PLEASE READ: https://forum.multitheftauto.com/viewtopic.php?f=91&t=22270

This is our respond thread for our fourth weekly scripting tutorial.

You can respond to the tutorial here if you have any questions, etc.

Here's the link to the first tutorial: Scripting Tutorial IV - Hay

Kevuwk

Any comments made are purely my own and do not represent the interests of the MTA Team

  • MTA Team
Posted

Technical problems sorted. Enjoy.

One of the [VCP] leaders // honorary member of the =PCP= gang.

 

Do not PM me your MTA:SA Client / Server support questions, Lua scripting questions, unban requests or server toplist concerns - please ask them here: MTA:SA Support subforum, here: Scripting subforum, here: Ban appeals or here: Servers instead.

For other inquiries - please expect delays in replies when messaging me.

Posted

Thats very cool... the script looks a bit more complicated compared to the others, so I'll read it through tommorow...

The movie is great, it shows a lot more then the Christmas movie did.

50 Levels:
(a/b) x%

Is added by the script and shows how far you [and others] are right?

Posted

Pure freakin genious.

Lovely how such a simple source file can produce a stunning gamemode like that.

Umbrellas are like humans: you use them when it rains.

When you play a Windows 95 CD backwards, you hear a message from the devil. Even worse, if you just play it, it installs Windows 95.

Posted
Thats very cool... the script looks a bit more complicated compared to the others, so I'll read it through tommorow...

The movie is great, it shows a lot more then the Christmas movie did.

50 Levels:
(a/b) x%

Is added by the script and shows how far you [and others] are right?

Looks like it, yes.

Officially MTA's worst fanboy

default.pngdefault.png

default.pngdefault.pngdefault.png

Posted
Thats very cool... the script looks a bit more complicated compared to the others, so I'll read it through tommorow...

The movie is great, it shows a lot more then the Christmas movie did.

50 Levels:
(a/b) x%

Is added by the script and shows how far you [and others] are right?

It shows your name and health.

Posted

1) When a player joins, would the current hay bails be cynced for him?

2) If any rock falls and destroys every hay bail below, would all the players still be able to climb to the top?

3) I have also noticed, that someone's nick was cut as it was too long. IS there any way to avoid it and if yes, why wasn't it made in the video?

4) Is there any way to manage text outputs, like moving them to any point on the screen, changing styles, fonts, sizes etc? If yes, could you please give a sample of the needed function?

qateam.jpg

brotherhood.jpg

Posted
1) When a player joins, would the current hay bails be cynced for him?

2) If any rock falls and destroys every hay bail below, would all the players still be able to climb to the top?

3) I have also noticed, that someone's nick was cut as it was too long. IS there any way to avoid it and if yes, why wasn't it made in the video?

4) Is there any way to manage text outputs, like moving them to any point on the screen, changing styles, fonts, sizes etc? If yes, could you please give a sample of the needed function?

1) Yes it will be synced for everyone

2) I'm not sure about this

3/4) Those text displays were made by scripting and you can change their position, size, color etc. It was probably not changed in the video cause of lazy scripter :P

[lua]textCreateTextItem ( string text, float x, float y, priority, R, G, B, Alpha, Scale )

--This will display "hello" in the center of player's screen

textDisplay = textCreateDisplay ()

textItem = textCreateTextItem ( "hello", 0.5, 0.5, 1, 0, 0, 255, 255, 3 )

textDisplayAddText ( textDisplay, textItem )

textDisplayAddObserver ( textDisplay, myPlayer ) --Display it for myPlayer only[/lua]

Do not PM me, im not going to read it anyway.

Posted
Thats very cool... the script looks a bit more complicated compared to the others, so I'll read it through tommorow...

The movie is great, it shows a lot more then the Christmas movie did.

50 Levels:
(a/b) x%

Is added by the script and shows how far you [and others] are right?

It shows your name and health.

erm, doesnt it show name and how far up you are / furthest you have gone

mtabroph.png

Posted
textCreateTextItem ( string text, float x, float y, priority, R, G, B, Alpha, Scale )

As far as I understand, "priority" gives the ability to show one text above the other.

But where is the parameter for changing font?

qateam.jpg

brotherhood.jpg

Posted (edited)
1) When a player joins, would the current hay bails be cynced for him?

2) If any rock falls and destroys every hay bail below, would all the players still be able to climb to the top?

3) I have also noticed, that someone's nick was cut as it was too long. IS there any way to avoid it and if yes, why wasn't it made in the video?

4) Is there any way to manage text outputs, like moving them to any point on the screen, changing styles, fonts, sizes etc? If yes, could you please give a sample of the needed function?

1. Yes

2. If a bail is 'destroyed' it 'respawns' the next time that bail moves. (Quite nasty :))

3. Don't pick long names

4. Script is editble.

textCreateTextItem ( string text, float x, float y, priority, R, G, B, Alpha, Scale )

As far as I understand, "priority" gives the ability to show one text above the other.

But where is the parameter for changing font?

Font changing isn't possible. Priority stands for how quick the text in the display must be updated on a change.

Whats the point of this? [lua]function copyTable ( src, des )

for k,v in pairs(src) do

if (type(v) == "table") then

des[k] = {}

copyTable(src[k],des[k])

else

des[k] = v

end

end

end[/lua]

The script makes a copy of the current matrix, fills in the player positions then checks bail movement, at the next check we don't want the players position of the previous check in the matrix, thats why the copy and that functions copies the matrix.

Edited by Guest

"Never argue with an idiot. They bring you down to their level and beat you with experience."

"Arguing on the internet is like the Special Olympics. Even if you win, you're still retarded."

signature.gif

Posted

Font changing isn't possible. Priority stands for how quick the text in the display must be updated on a change.

Does that mean that there is only one font in the whole MTA:DM?

qateam.jpg

brotherhood.jpg

Posted

Font changing isn't possible. Priority stands for how quick the text in the display must be updated on a change.

Does that mean that there is only one font in the whole MTA:DM?

Yes.

"Never argue with an idiot. They bring you down to their level and beat you with experience."

"Arguing on the internet is like the Special Olympics. Even if you win, you're still retarded."

signature.gif

Posted

Very cool tutorial!

Also, not to rain on anybody's parade, but they're actually hay bales. :)

  • 1 year later...
Posted

Necromancing this thread for it's amazing, wonderfull & brilliant creator of this game mode: me.

"Never argue with an idiot. They bring you down to their level and beat you with experience."

"Arguing on the internet is like the Special Olympics. Even if you win, you're still retarded."

signature.gif

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...