Jump to content

Scripting Tutorial 2 - MTA Snow


ijsf

Recommended Posts

Posted

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

Following last week's scripting tutorials on user created portals, we've just published a new tutorial covering MTA Snow.

The tutorial shows you how to create special entities, how to make them look and fall like snow.. with some imagination of course.

Head over to the Tutorials section to see!

Posted

You should probably use a newline for comments, like it was last time. I'm sure it will be fixed soon.

Nice tutorial by the way. Not quite what I expected, but it shows once again the power of Lua and MTA.

.edit.

The link to the complete script results in a 404. :(

Posted
Don't know if it's just me but I can't see all of the script text....

I use opera and when I get sucha problem I go to Tools/Preferences/Web Pages/Fit to width.... i dont know which browser u use, but try something like that

Posted
You should probably use a newline for comments, like it was last time. I'm sure it will be fixed soon.

Nice tutorial by the way. Not quite what I expected, but it shows once again the power of Lua and MTA.

i think this tutorial was to show the object manipulation which you will have also seen with the hay bails in the xmas vid

Posted (edited)

Talco is right, downloading the scripts give me a "404 - Not Found" error.

Also, for viewing the comments: you cannot see them, but they are copied when you select the whole page :).

Lol will this work?:

[lua]addCommandHandler ( "teleport", "tele_TeleCommand" )

function tele_TeleCommand ( player, commandname, x, y, z )

outputChatBox ( getClientName ( player ) .. " was teleported." ) --Thx eAi for telling me about the space :)

setElementPosition ( player, x, y, z )

end[/lua] Probably not but at least I tried to make something. :)

Also about the outputChatBox function, can i make the text I put in the chatbox purple or red (or wutever color)?

Edited by Guest
Posted

Yes, that looks like it'll work, except you'll want a space before 'was', i.e. " was teleported".

As for colors, yes, you can use them, just by adding the RGB value as arguments. The full definition for outputChatBox is:

[lua]bool outputChatBox ( string text, [ element visibleTo=getRootElement(), int r=255, int g=255, int b=255 ] )[/lua]

Posted

How much bandwidth does this thing use as repeatedly setting a load of entities positions for loads of players can't be great. Also, wouldn't:

if not px or not py or not pz then

snowing = false

return

stop the snow if the player was on one of the axis? I.e. stood right in the middle of the world where X and Y would be 0.0, thus evaluating to false?

Posted (edited)

unless lua knows/sees the diffrence between 0 and 0.0000000 i think you're right. besides, if my teleport 'script' (rather to be called a very small code) will work with the first release, you could try it, and teleport to any position with either x, y, or z as 0

also the correct usage of outputChatBox would be:

[lua]outputChatBox ( getClientName ( player ) .. " was teleported." , 255 , 43 , 43)[/lua]

right?

btw sorry for asking so much time that could be spend on development :P

Edited by Guest
Posted

color is not required, if it's not set, mta uses default color

here:

bool outputChatBox ( string text, [ element visibleTo=getRootElement(), int r=255, int g=255, int b=255 ] )

all the stuff in [] brackets is not required

Posted

[lua]-- outputChatBox ( "What you wanna say", visibleto, r, g, b )

-- Example

root = getRootElement ()

outputChatBox ( "Sniff me!", root, 255, 80, 60 ) [/lua]

Posted
How much bandwidth does this thing use as repeatedly setting a load of entities positions for loads of players can't be great. Also, wouldn't:

if not px or not py or not pz then

snowing = false

return

stop the snow if the player was on one of the axis? I.e. stood right in the middle of the world where X and Y would be 0.0, thus evaluating to false?

No, it would only be false if one of the values were either false or nil.

  • MTA Team
Posted
Sorry i know its not a 'script' question, but what music was that?

The Prodigy - Babys Got A Temper (instrumental)

Posted

Lua does not see 0 as being equal to false, so 'if not a' is not the same as 'if a ~= 0'

Posted

For an engine so capable of powerful and wondrous things, it's quite a downer to see these superfluous uses of it. Nobody will jump on the LUA bandwagon if your first impressions are these little lights you call "snowflakes". You could argue that you are merely showcasing the engine's capabilities in some fashion, but it strangely resembles the inevitable failure of a politician with bad speaking skills; claiming to be promising and almighty, yet unwilling or uncapable of expressing it in a way that has a community convinced.

Posted

You are defining superfluous by a GTA standard. In MTA, its all about innovation. Snow could be used logically in maps. The amazing stuff will be revealed later. Right now we are keeping it simple. After all not all of us are mta hackin super computer buffs.

Posted

it's all up to the creators imagination, I'm 100% positive that after DM is released the community will come up with loads of creative ideas, which had also happened in Race.. some of the maps I've played are simply extraordinary and all of them were made in the Race Map Editor which compared the to new scripting system is very limited..

Lua has to offer a lot and I don't think I'm exagerating when I say that "everything will be possible", you've only seen a small portion of the tip of the iceberg..

can't wait!

  • MTA Team
Posted
For an engine so capable of powerful and wondrous things, it's quite a downer to see these superfluous uses of it. Nobody will jump on the LUA bandwagon if your first impressions are these little lights you call "snowflakes". You could argue that you are merely showcasing the engine's capabilities in some fashion, but it strangely resembles the inevitable failure of a politician with bad speaking skills; claiming to be promising and almighty, yet unwilling or uncapable of expressing it in a way that has a community convinced.
Basicly it's up to your own imagination. You see snow, other people see what is behind it: object manipulation. And with that you can do nice stuff that we have showed in the past. The QA team's christmas movie contained a game mode with moving haystacks. And this rocket does really fly.
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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