• 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!

Server almost Complete, can you solve this? (RaceWars)

Eldin

Eldin Projects
Premium User
Joined
Jun 12, 2008
Messages
1,334
Reaction score
613
Location
Sweden
Greets fellow Scripters!

I have been working on my RaceWars server for some time now and its kinda getting ready for a Beta Test.
What I need is some help with a few scripts that ain't working like it should and some help to create a special one.

RaceWars Thread: (Haven't updated it in some time, alot happend in real life, but I worked alot more on it then it shows in the thread)
http://otland.net/f251/project-race-wars-eldin-rpg-war-discussion-ideas-146727/

Im using TFS 0.2 Mystic Spirit, Client 9.31. I will soon update to TFS 0.2 Mystic Spirit, Client 9.60/9.61.
(The new TFS version that I will upgrade to might have some functions I need, haven't checked that yet)

Im in need of some help and you are welcome to post a solution here or take it private. :)

Lets begin here anyway:

Script 1 [Global] - http://otland.net/f82/9-1-talking-signs-174622/
The script will do like it says, make something "talk" from the ground. I guess TFS 0.2 aint supporting the right stuff?
This script is mostly for fun but would be great for all my servers.

The Logg:
Code:
[11/02/2013 20:52:52] Lua Script Error: [GlobalEvent Interface] 
[11/02/2013 20:52:53] data/globalevents/scripts/talking.lua:onThink
[11/02/2013 20:52:53] data/globalevents/scripts/talking.lua:10: attempt to call global 'getPlayersOnline' (a nil value)
[11/02/2013 20:52:53] stack traceback:
[11/02/2013 20:52:53] 	[C]: in function 'getPlayersOnline'
[11/02/2013 20:52:53] 	data/globalevents/scripts/talking.lua:10: in function <data/globalevents/scripts/talking.lua:9>
[11/02/2013 20:52:53] [Error - GlobalEvents::think] Failed to execute event: talkingSigns

-----------------------------------------

Script 2 [CreatureScript] SOLVED :D

-----------------------------------------

Script 3 [CreatureScript]
I have a script that will set NoN-PvP for example all the Humans to prevent Wars within a Race. One thing seem to be wrong:

Code:
<event type="combat" name="RacePvP" script="RacePvP.lua"/>

The errors in the logg seems to point towards the "combat", I don't think TFS 0.2 supports it. What can I do?
(I can post the script if you need it, but the script is not the problem)

-----------------------------------------

Script 4 [NPC] - SOLVED :D

-----------------------------------------

Script 5 [NPC] - http://otland.net/f83/acu-npcs-refine-weapons-167983/
The idea is to make your items stronger, I can do the same here aswell, post the errors tomorrow if someone doesn't know directly what my problem is.
I don't remember what the real problem was, gonna check it tomorrow like I said.
The script would allow me to make alot of different refine NPCs and make em all special for each Race and Town.

-----------------------------------------

Thank You for reading and feel free to leave a comment here or too me in private.
I have 1 "bigger" request left once those or done, then Im ready to show you something new. ;)

The one who helps me can have the server directly once Im gonna start to host it,
I will release it later once I hosted it for some time and improved it aswell as crushed the bugs!

Kind Regards,
Eldin.


-----------------

EDIT:
One of the most important things will be to Conquer the world with your Race in some way.

MAIN SCRIPT FOR RACEWARS:
Here is my idea, feel free to bring new ones/change my thinking.

*I will create an NPC that sells you a certain item in each town for each race.
*I'll also create a kind of "pedestal/sacrifice place" where you will place this item.

So what I need is a script that will let you drop the X item on this X, Y, Z place and you have simply "Conquered" that area.
(A lever or whatever if the drop function wont work or is too hard to make)

If the X item was the Human Race Item (Simply X item) it will cast a Broadcast that says something like: (as for example)
"The Humans has now Conquered the Plains of Havoc and will now gain a bonus while in that area"

The script will make Vocation 1, 2, 3, and 4 (Humans) to gain some kind of bonus in area X, Y, Z, to X, Y, Z (a square like raids or something). If the item was the X item for Elfs, the Broadcast will say Elfs istead of Humans and they (Vocation 5, 6 and 7) will recieve the bonus while in that area.

The Bonus csn be whatever fits and will work. The best things would be like more X exp in that area or faster hp/mana regeneration. Can also be skills, armor or whatever if thats what you can do! :)
 
Last edited:
For #1 add this to your /lib/050-function.lua
Lua:
function getOnlinePlayers()
	local tmp = getPlayersOnline()
	local players = {}
	for i, cid in ipairs(tmp) do
		table.insert(players, getCreatureName(cid))
	end

	return players
end
#2 post the code

#3 post the code & errors

#4, 5 -> not sure, I've never used the 0.2 series.
 
Code:
[11/02/2013 20:52:53] data/globalevents/scripts/talking.lua:10: attempt to call global 'getPlayersOnline' (a nil value)

For #1 add this to your /lib/050-function.lua
Lua:
function getOnlinePlayers()
	local tmp = getPlayersOnline()
	local players = {}
	for i, cid in ipairs(tmp) do
		table.insert(players, getCreatureName(cid))
	end

	return players
end
fail'd, so da server does not got "getPlayersOnline" function, you try to help him with give other named function which function usings not existin function "getPlayersOnline", ya ++!

1. I don't know 2.0 ms functions, but you can delete:
Lua:
    local people = getPlayersOnline()
    if #people == 0 then
        return true
    end
these lines and error should be fixed but sings will talk with 0 ppl online.


2. this guy has not closed one of tables:
Lua:
monsters = {
	{name = "Amazon", normexp = 60, minlvl = 10, maxlvl = 20, extraexp = 100},-- <<-- here, i was do it
	{name = "Dragon", normexp = 4200, minlvl = 30, maxlvl = 60, extraexp = 500*getPlayerLevel(cid)},
	{name = "Rat", normexp = 5, minlvl = 1, extraprcnt = 10}
}


3. creatureevent.cpp
look for:
Code:
		case CREATURE_EVENT_COMBAT:
if u not found it - you don't have onCombat then and server don't support it, you can import it from other ver i think with no big trouble.
 
Last edited:
Also if you're planning on making such a custom server, 0.2 series really isn't the best option. It doesn't have nearly as much features as 0.3~ does
 
Thank You! Main Script:

Woah, didn't expect that many great answers, can't explain how much I appriciate it.
I will begin the testing one I get home from work, looking forward to it! :)

During the time, I'll try to explan whats going on in my crazy mind for the main script.
One of the most important things will be to Conquer the world with your Race in some way.

MAIN SCRIPT FOR RACEWARS:
Here is my idea, feel free to bring new ones/change my thinking.

*I will create an NPC that sells you a certain item in each town for each race.
*I'll also create a kind of "pedestal/sacrifice place" where you will place this item.

So what I need is a script that will let you drop the X item on this X, Y, Z place and you have simply "Conquered" that area.
(A lever or whatever if the drop function wont work or is too hard to make)

If the X item was the Human Race Item (Simply X item) it will cast a Broadcast that says something like: (as for example)
"The Humans has now Conquered the Plains of Havoc and will now gain a bonus while in that area"

The script will make Vocation 1, 2, 3, and 4 (Humans) to gain some kind of bonus in area X, Y, Z, to X, Y, Z (a square like raids or something). If the item was the X item for Elfs, the Broadcast will say Elfs istead of Humans and they (Vocation 5, 6 and 7) will recieve the bonus while in that area.

The Bonus csn be whatever fits and will work. The best things would be like more X exp in that area or faster hp/mana regeneration. Can also be skills, armor or whatever if thats what you can do! :)

Please tell me if I was unclear.
Again, thank you all who wrote for the great answers.

Kind Regards,
Eldin.


Fast explanation for the main script:
Place an item in a position,
the item dissapears,
certain vocations now get some kind of bonus in a chosen area,
A broadcast appears to let everyone know.


- - - Updated - - -

For #1 add this to your /lib/050-function.lua
Lua:
function getOnlinePlayers()
	local tmp = getPlayersOnline()
	local players = {}
	for i, cid in ipairs(tmp) do
		table.insert(players, getCreatureName(cid))
	end

	return players
end
#2 post the code

#3 post the code & errors

#4, 5 -> not sure, I've never used the 0.2 series.

Synthetic@
Tryed to add the first one in the lib aswell as changed "getOnlinePlayers" like Acuben said. The errors then dissapeared until I logged in, I then got this:

Code:
[12/02/2013 22:52:06] Eldin has logged in.

[12/02/2013 22:52:08] Lua Script Error: [GlobalEvent Interface] 
[12/02/2013 22:52:08] data/globalevents/scripts/talking.lua:onThink
[12/02/2013 22:52:08] data/globalevents/scripts/talking.lua:16: attempt to call global 'doPlayerSay' (a nil value)
[12/02/2013 22:52:08] stack traceback:
[12/02/2013 22:52:08] 	[C]: in function 'doPlayerSay'
[12/02/2013 22:52:08] 	data/globalevents/scripts/talking.lua:16: in function <data/globalevents/scripts/talking.lua:9>
[12/02/2013 22:52:08] [Error - GlobalEvents::think] Failed to execute event: TalkingSigns
[12/02/2013 22:52:09] Eldin has logged out.

Would keep spamming if I didn't loggout directly.

---------------------------------

fail'd, so da server does not got "getPlayersOnline" function, you try to help him with give other named function which function usings not existin function "getPlayersOnline", ya ++!

Ernest JP@
1. I don't know 2.0 ms functions, but you can delete:
Lua:
    local people = getPlayersOnline()
    if #people == 0 then
        return true
    end
these lines and error should be fixed but sings will talk with 0 ppl online.


2. this guy has not closed one of tables:
Lua:
monsters = {
	{name = "Amazon", normexp = 60, minlvl = 10, maxlvl = 20, extraexp = 100},-- <<-- here, i was do it
	{name = "Dragon", normexp = 4200, minlvl = 30, maxlvl = 60, extraexp = 500*getPlayerLevel(cid)},
	{name = "Rat", normexp = 5, minlvl = 1, extraprcnt = 10}
}


3. creatureevent.cpp
look for:
Code:
		case CREATURE_EVENT_COMBAT:
if u not found it - you don't have onCombat then and server don't support it, you can import it from other ver i think with no big trouble.

Ernest JP@
1. Tryed to Remove the "getOnlinePlayers" like you said, got this error:
Code:
[12/02/2013 22:49:02] Warning: [Event::checkScript] Can not load script. /scripts/talking.lua
[12/02/2013 22:49:02] data/globalevents/scripts/talking.lua:18: '<eof>' expected near 'end'

2. Hah, missed that! Thanks alot mate! Its now working! A Small error when its about to tell you how much extra exp you get, but I can live with that.
Code:
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "For killing a monster over your level, you gained [B]" .. a.extraexp + (a.normexp/a.extraprcnt) .. "[/B] extra experience points.")

3. Didn't find the Creature_Event_Combat thing, I will try to search how to implent it, feel free to give me a good link or explain. :)

-----------------------------------------------

Also if you're planning on making such a custom server, 0.2 series really isn't the best option. It doesn't have nearly as much features as 0.3~ does

Synthetic@ (Again) :D
The reason why im using it is because Znote told me its the most stable server. He helps from time to time and I do ofcourse want a stable server but I get your point. ;)

--------------------------------------

0.2 uses getOnlinePlayers() i think

Acubens@
Added it together with Synthetics lib script and it went in the right direction I think. :)
By the way Acubens, your the creator of Refine weapons! I got some problem there aswell.

Once I speak to to NPC, I say refine, then continue. Once I say "Continue", nothing happens and I get this in the logg:
Code:
[12/02/2013 23:14:38] Lua Script Error: [Npc interface] 
[12/02/2013 23:14:38] data/npc/scripts/Refine.lua:onCreatureSay
[12/02/2013 23:14:38] data/npc/scripts/Refine.lua:53: attempt to call global 'isWeapon' (a nil value)
[12/02/2013 23:14:38] stack traceback:
[12/02/2013 23:14:38] 	[C]: in function 'isWeapon'
[12/02/2013 23:14:38] 	data/npc/scripts/Refine.lua:53: in function 'callback'
[12/02/2013 23:14:38] 	data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[12/02/2013 23:14:38] 	data/npc/scripts/Refine.lua:13: in function <data/npc/scripts/Refine.lua:13>

Got any idea? Might be able to solve the next NPC aswell if we solve this one.

----------------------

The Buff NPC - http://otland.net/f83/buffer-131246/

If I say as for example "speed", he asks me if I would like to buff it. Once I answer YES, nothing happends and I recieve those errors in the logg:
Code:
[12/02/2013 23:12:27] Lua Script Error: [Npc interface] 
[12/02/2013 23:12:27] data/npc/scripts/Buffe.lua:onCreatureSay
[12/02/2013 23:12:27] data/npc/scripts/Buffe.lua:244: attempt to call global 'getCreatureStorage' (a nil value)
[12/02/2013 23:12:27] stack traceback:
[12/02/2013 23:12:27] 	[C]: in function 'getCreatureStorage'
[12/02/2013 23:12:27] 	data/npc/scripts/Buffe.lua:244: in function 'callback'
[12/02/2013 23:12:27] 	data/npc/lib/npcsystem/keywordhandler.lua:27: in function 'processMessage'
[12/02/2013 23:12:27] 	data/npc/lib/npcsystem/keywordhandler.lua:135: in function 'processNodeMessage'
[12/02/2013 23:12:27] 	data/npc/lib/npcsystem/keywordhandler.lua:103: in function 'processMessage'
[12/02/2013 23:12:27] 	data/npc/lib/npcsystem/npchandler.lua:387: in function 'onCreatureSay'
[12/02/2013 23:12:27] 	data/npc/scripts/Buffe.lua:7: in function <data/npc/scripts/Buffe.lua:7>

--------------------------------------

Thank You all for great answers, already solved one problem thanks too you and seems to be on our way for the next ones aswell!

Kind Regards,
Eldin.
 
Last edited:
I dont 100% sure if 0.2 have the function setItemAttribute but if exist
You need add this to your global.lua to fix the error of the npc
Lua:
function isWeapon(uid) 
    return (getItemAttack(uid) > 0) and TRUE or FALSE 
end

Error º2

[12/02/2013 23:12:27] Lua Script Error: [Npc interface]
[12/02/2013 23:12:27] data/npc/scripts/Buffe.lua:eek:nCreatureSay
[12/02/2013 23:12:27] data/npc/scripts/Buffe.lua:244: attempt to call global 'getCreatureStorage' (a nil value)
[12/02/2013 23:12:27] stack traceback:
[12/02/2013 23:12:27] [C]: in function 'getCreatureStorage'
[12/02/2013 23:12:27] data/npc/scripts/Buffe.lua:244: in function 'callback'
[12/02/2013 23:12:27] data/npc/lib/npcsystem/keywordhandler.lua:27: in function 'processMessage'
[12/02/2013 23:12:27] data/npc/lib/npcsystem/keywordhandler.lua:135: in function 'processNodeMessage'
[12/02/2013 23:12:27] data/npc/lib/npcsystem/keywordhandler.lua:103: in function 'processMessage'
[12/02/2013 23:12:27] data/npc/lib/npcsystem/npchandler.lua:387: in function 'onCreatureSay'
[12/02/2013 23:12:27] data/npc/scripts/Buffe.lua:7: in function <data/npc/scripts/Buffe.lua:7>

Change all getCreatureStorage and setCreatureStorage by getPlayerStorageValue and setPlayerStorageValue
 
Same error at your script after I put that in global.lua, must add the function in one way or another... :/

BUFFE WORKS! :D

Thanks ALOT! I will soon be adding a mission NPC aswell, do you think yours will work for TFS 0.2 or will I encounter the same problem as the Refine Weapons one?
Only a few scripts left now!

Kind Regards,
Eldin.
 

Perfect! Will have a look when I get home!

My Mission NPC script will work on 0.2 if not pm the error

Great, will soon try that one! :)

------------------

Is no one able to make my biggest request?

*Sacrifice items for an effect works
*vocation id works
*Broadcast works
*Give temporary bonus like the buff npc does works
*from pos X, Y, Z to pos X, Y, Z works (from raids)

Shouldn't it work then in some way?

Kind Regards,
Eldin.
 
Back
Top