• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[LUA] Zysens Scripts

Zysen

=)
Joined
Sep 18, 2010
Messages
2,270
Reaction score
170
Location
Bosnia & Herzegovina
Hello!

I was reading some tutorials,and I hope I learned something.I made an welcome script.When you login you got an message welcome back and you get XXX health and XXX mana recovery.I hope this script works.


Note:It's 100% made by me. :$


Code:
function onStepIn(cid, item, frompos, itemEx, topos)
local temple = { x = XXX, y = XXX, z = X }  ---- TEMPLE POS
		doPlayerSendTextMessage(cid,21,"Welcome back! You got full health and mana now!")
		doCreatureAddMana(cid,XXX)  ---- MANA ADD
		doCreatureAddHealth(cid,XXX) ---- HEALTH ADD
  end
        return TRUE
end



Hope it's correct!



Regards,
zysen
 
Last edited:
Well people will abuse this for magic level, everytime they stepin on that tile they will gain the amount of mana you enter. So it's like an infinite mana.

I know it's your first script and Gratz you got the point and your goin to the correct way on scripting, I'll tell you a hint for people dont abuse this.

try making it on 'data/creaturescripts/scripts', The first steps on programming or coding scripts are difficult so never backdown.

Here is a link, check it hope this help you.
[Evil Hero's Scripting Guide] http://otland.net/f481/scripting-guide-74030/

ps: this script doesnt work yo need to call 'if' to close one 'end' try reading the tutorial of evil hero.
Good luck!, Efren.
 
I don't get ANYTHING about scripting, It's so boring and confusing, writing lines and lines and lines and lines OMG that's what school is for, to write lines and lines and lines T_T
 
Just explain this to me: What's fun about typing for 2 hours?

The feeling that you're creating something? If so, Map.. you can actually SEE what you're making lawl
 
Lua:
function onLogin(cid)

	doPlayerSendTextMessage(cid,21,"Welcome back! You got full health and mana now!")
	doCreatureAddMana(cid,(getCreatureMaxMana(cid)-getCreatureMana(cid)))  ---- MANA ADD
	doCreatureAddHealth(cid,(getCreatureMaxHealth(cid)-getCreatureHealth(cid))) ---- HEALTH ADD
		
   return TRUE
end

This will execute the script when you login, and it will add the mana you need for max mana, and the health you need for max health.
Hope this helps you. I suggest you to have the lua_functions open all the time and search for usefull things.

Kind regards,
Spoking
 
Lua:
function onLogin(cid)

	doPlayerSendTextMessage(cid,21,"Welcome back! You got full health and mana now!")
	doCreatureAddMana(cid,(getCreatureMaxMana(cid)-getCreatureMana(cid)))  ---- MANA ADD
	doCreatureAddHealth(cid,(getCreatureMaxHealth(cid)-getCreatureHealth(cid))) ---- HEALTH ADD
		
   return TRUE
end

Still people will abuse, Everytime they login they gain full hp and mana, So the function 'onlogin(cid)' is wrong.
hint: Try with another function.

@Prest, This isn't like school, its most likely to a practice for future progammers, Lua is one of the most easiest lenguaje to learn, Its fun creating something, in other case mapping is for art (designers), Im a programmer so that's why i learned lua so easily, but mapping keep my mind in a peacefull place (no stress, etc..) Some ppl choose witch of these will practice, cuz on the future probably they will like to work on an office with an airconditioner and using a computer.

For me is fun, Efren.
 
just add exhaustion and that'll take care of it

@OP good job :)
 
New script release:Hope this works.Logout message:




Code:
function onLogout(cid)
		doPlayerSendTextMessage(cid,21,"Good bye!")
	doSendMagicEffect(pos, type[, player])
end
	return TRUE
end



Regards,
Zysen
 
New script release:Hope this works.Logout message:

remove extra 'end' and change undefined var 'pos' to a working function:
Code:
function onLogout(cid)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'Good bye!')
    doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    return true
end
 
Hey CyberM,thanks for advices,I will use them for sure.Am I good?

I got an new script xD



Code:
functionBest (OtLand)
if isBest == TRUE 
end
return true
end
 
Last edited by a moderator:
good keep scripting! and don't be afraid to ask anyone any questions!

remember this for every "if" statement an "end", here is a Life example of what I'm talking about.
Lua:
function onLife()
	if morning == true then
		Wakeup
	end
	if Wakeup == false then
		WakeupAgain
	else
		GoToBathroom
	end
	if Time < "7:30" then
		TakeAShower
		Brushteeth
		GetDressed
		CombHair
	elseif Time > "7:30" then
		Brushteeth
		GetDressed
	end
	local ThingsToDo = {PackBackpack, PackLunch, SayGoodbye, GoToBus}
	for i = 1, #ThingsToDo do
		doTask(ThingsToDo[i])
	break
	end
return Life			
end
hope this shows you lots, also like some other user suggested read EvilHero's Tutorial it has helped me a lot and it will help you too!
 
I'll probably get trolled but,

Code:
local temple = { x = XXX, y = XXX, z = X }  ---- TEMPLE POS

why is that there exactly?
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
		doPlayerSendTextMessage(cid,21,"Aaaah...")
	if item.itemid == XXX then
	getCreatureMaxHealth(cid)
	getCreatureMaxMana(cid)
	end
	return TRUE
end
 
Back
Top