• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[request] Script - Weeds effects

bury

Active Member
Joined
Jul 27, 2008
Messages
421
Solutions
7
Reaction score
25
Hello!

I want to know if somebody could help me with a script.

First of all I want to take over control it with a storage.

Step by step; I have made a quest that once finished it gives you a "weed cake", it gives you storage = 124.

What I need now is the script of that effect.... What effect? I would want to be like move east and west and onplayersay (cid, "Hey dude, where dafuq is my house?") All each 6 seconds, for example, in a endless loop.

I have tried to make it but im starting in scripting and im not very good. I think it would be something like this:

LUA:
 Function onThink (cid, interval)
if getPlayerStorageValue(cid, 124) > 0 then
move east and west and say "Hey dude, where dafuq is my house?" TEMPO*6 (seconds) 
return true
              end
        return true
      end

Then, with the admin char I can disable it when I want ^^.

Thanks you for your help!
 
This is a very noobcode that I made for you, it isn't working as you wanted but should help you a little so you can finish it :)

Open "globalevents.xml" and add:
PHP:
<globalevent name="Weed" interval="6000" event="script" value="weed.lua"/>

Create or copy a LUA file on "globalevents\scripts" name it "weed.lua" and paste this code inside:
PHP:
function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
		 local storage = 124
			
		if getPlayerStorageValue(cid, storage) == -1 then			
            pos = getPlayerPosition(cid)
			pos.x = pos.x + 1
						
			doCreatureSay(cid, "Hey dude, where dafuq is my house?", TALKTYPE_ORANGE_1)
			doTeleportThing(cid, pos)
			
        end
        end
        return true
end
 
Last edited:
well, i think this should works
LUA:
function onThink(cid, interval)
	local config = {
	position = {
	[1] = {x = getPlayerPosition(cid).x + 1, y = getPlayerPosition(cid).y, z = getPlayerPosition(cid).z},
	[2] = {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y + 1, z = getPlayerPosition(cid).z},
	[3] = {x = getPlayerPosition(cid).x - 1, y = getPlayerPosition(cid).y, z = getPlayerPosition(cid).z},
	[4] = {x = getPlayerPosition(cid).x, y = getPlayerPosition(cid).y - 1, z = getPlayerPosition(cid).z}
	},
	random = math.random(1, 4),
	storage = 124,
	time = 6 -- interval time seconds~
	}

	function isWalkable(cid, pos)
	pos.stackpos = 0
	if getTileThingByPos(pos).uid ~= 0 then
		local n = getTileInfo(pos)
		if n.house == false and getTopCreature(pos).uid == 0 and doTileQueryAdd(cid, pos) == RETURNVALUE_NOERROR then
			return true
		end
	end
	end
	if getPlayerStorageValue(cid, config.storage + 4321) > os.time() then return false end
		if getPlayerStorageValue(cid, config.storage) > 0 then
			for var, pos in ipairs(config.position) do
				if getTileInfo(pos).protection == false then
					if config.random == var then
						if isWalkable(cid, pos) then
							doTeleportThing(cid, pos, TRUE)
						else
							doCreatureSay(cid, "Hey dude, where dafuq is my house?", TALKTYPE_ORANGE_1)
						end
					setPlayerStorageValue(cid, config.storage + 4321, os.time() + config.time)
					end
				end
			end
		end
	return true
end

register it (login.lua and creaturescripts.xml)

anyways, cool idea (i feel like the script right now jajaja), i test it in my laptop and works perfect
 
Last edited:
It works xD So funny the character wanders saying hey dude dafuq is my house heheheheh. My friends will love it!

I dont want to do multiposting so what I was saying u before is that I wanted to add another drug effect, maybe mushrooms.

It would be awesome if instead of move the character it turns west north east and south (I mean only turn, look at, no move) randomly and say like utevo res ina "Pig with storage 125, for ex.

Then I would be able to do two quest to add that storage and then I will can take control over it with my admin characters. My friends would love it.

Thanks for helping me, mate
 
Last edited:
Back
Top