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

[SOLVED] Summon single creature. +Rep

Guitar Freak

_LüA_n☺b_
Joined
Dec 27, 2008
Messages
831
Reaction score
13
Location
Caracas, Venezuela
EDIT:
This thread is solved. Thank to darkhaos and Old Greg for helping me out on the make and remake of the script.

Here's the link to the final script in case anyone is interested:
http://otland.net/f132/old-greg-chris77s-scripting-services-37296/index9.html#post378146

<-------Solved-------->

Im wondering if it is possible to make a script that works similar/same to "utevo res" (because this one works by a function, not a script)?

If you dont understand, Ill make an example.

Lets say I want a spell named Whatever that works when I say the words whatever "monster, and it can summon a monster ONLY under certain conditions, like being drunk or by having x amount of items on you, etc. I can make the conditions part, but I need a script to put them into, a normal spell script.

So by saying for example the words 'whatever "dog' it would check if you're drunk and if you are it will summon the dog, if you're not it wont work.

As I said, I can make the conditions part, dont worry about that, what I need is the spell itself. A working "summonmonster.lua" that works the same as utevo res.

This is what "utevo res" looks like in spells.xml:

Lua:
	<instant name="Summon Creature" words="utevo res" lvl="25" params="1" exhaustion="2000" needlearn="0" event="function" value="summonMonster">
		<vocation name="Sorcerer"/>
		<vocation name="Druid"/>
		<vocation name="Master Sorcerer"/>
		<vocation name="Elder Druid"/>
	</instant>

See? Its a function called summonMonster, but no scripts or anything to work with, thats why I have no idea how to even start a script like that.

So, anyone knows how to transcribe the spell to a SCRIPT that works the same?

Ill +Rep of course. Even if you can at least point my in the right direction.

Cheers.

PS: Im using TFS 0.3.2.
 
Last edited:
This should work
Lua:
function onSay(cid, words, param, channel)

local level = 30
local mana = 200
local vocsCanUse = {1, 2, 3, 4, 5, 6, 7,8}
local condition = CONDITION_DRUNK
local canBeSummoned = {"Dog", "Troll", "Bug", "Fire Devil", "Fire Elemental"}

	if getPlayerLevel(cid) < level then
		doPlayerSendCancel(cid, "Your level is too low.")
		return TRUE
	end

	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end

	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end

	if(not isInArray(vocsCanUse, getPlayerVocation(cid))) then
		doPlayerSendCancel(cid, "Your vocation cannot use this spell.")
		return TRUE
	end

	if getCreatureCondition(cid, condition) == FALSE then
		doPlayerSendCancel(cid, "You need to be drunked to use this spell.")
		return TRUE
	end

	if(not isInArray(canBeSummoned, param)) then
		doPlayerSendCancel(cid, "You cannot summon this creature.")
		return TRUE
	end

	doSummonCreature(param, getCreaturePosition(cid), FALSE)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
	return TRUE
end

paste this in talkactions.xml
Lua:
<talkaction access="0" log="no" filter="quotation" words="/summon" event="script" value="SCRIPTNAME.lua" />
 
This should work
Lua:
function onSay(cid, words, param, channel)

local level = 30
local mana = 200
local vocsCanUse = {1, 2, 3, 4, 5, 6, 7,8}
local condition = CONDITION_DRUNK
local canBeSummoned = {"Dog", "Troll", "Bug", "Fire Devil", "Fire Elemental"}

	if getPlayerLevel(cid) < level then
		doPlayerSendCancel(cid, "Your level is too low.")
		return TRUE
	end

	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end

	if getCreatureMana(cid) < mana then
		doPlayerSendCancel(cid, "You do not have enough mana.")
		return TRUE
	end

	if(not isInArray(vocsCanUse, getPlayerVocation(cid))) then
		doPlayerSendCancel(cid, "Your vocation cannot use this spell.")
		return TRUE
	end

	if getCreatureCondition(cid, condition) == FALSE then
		doPlayerSendCancel(cid, "You need to be drunked to use this spell.")
		return TRUE
	end

	if(not isInArray(canBeSummoned, param)) then
		doPlayerSendCancel(cid, "You cannot summon this creature.")
		return TRUE
	end

	doSummonCreature(param, getCreaturePosition(cid), FALSE)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
	return TRUE
end

paste this in talkactions.xml
Lua:
<talkaction access="0" log="no" filter="quotation" words="/summon" event="script" value="SCRIPTNAME.lua" />

Thanks mate but is there any way to make it a spell spell instead of a talkaction?

Still I appreciate it :thumbup:

Already +Repped~

Pro~ you can post your version too if you know how to make it as a spell ;)
 
Its ok I tweaked it a bit to make it work properly like I wanted as a talkaction, but Ive got a few problems:

1st, you forgot to set the "doConvinceCreature(cid, creature)" part so the monster doesnt atk me nor I get loot from it so its a summon summon, but its ok, you probably didnt understood my post correctly, I should've explained that I wanted the summon to be a "personal summon" like in utevo res, instead of just a monster spawned that you get exp from and stuff.

Anyways, that part I could add it and it worked out, but Im trying to make it so you can only have 2 summons at a time using the function "getCreatureSummons(cid)" but after doing a lot of stuff with it, I just cant make it work. It tells me an error that Im "trying to compare numbers with tables" or something similar.

Also, another problem (more important) with the "convince" part, is that if I have all the requirements, it summons the monster correctly, but if I dont have them or just even 1 requirement, it summons the monster like a monster (giving exp, etc) instead of as a summon.

Ive tried returing LUA_ERROR and stuff but it still summons monsters when I dont have any of the requirements (lvl, condition, w/e).

So Im asking for a bit of help on that case. Im sure you or anyone else here can modify this same code (darkhaos's) with the "convince" and the "max summons" part cleaner than me, and working :thumbup:

Cheers.
 
Its ok I tweaked it a bit to make it work properly like I wanted as a talkaction, but Ive got a few problems:

1st, you forgot to set the "doConvinceCreature(cid, creature)" part so the monster doesnt atk me nor I get loot from it so its a summon summon, but its ok, you probably didnt understood my post correctly, I should've explained that I wanted the summon to be a "personal summon" like in utevo res, instead of just a monster spawned that you get exp from and stuff.

Anyways, that part I could add it and it worked out, but Im trying to make it so you can only have 2 summons at a time using the function "getCreatureSummons(cid)" but after doing a lot of stuff with it, I just cant make it work. It tells me an error that Im "trying to compare numbers with tables" or something similar.

Also, another problem (more important) with the "convince" part, is that if I have all the requirements, it summons the monster correctly, but if I dont have them or just even 1 requirement, it summons the monster like a monster (giving exp, etc) instead of as a summon.

Ive tried returing LUA_ERROR and stuff but it still summons monsters when I dont have any of the requirements (lvl, condition, w/e).

So Im asking for a bit of help on that case. Im sure you or anyone else here can modify this same code (darkhaos's) with the "convince" and the "max summons" part cleaner than me, and working :thumbup:

Cheers.

Bumpek~
 
/summon (to summon wild monster).

That one doesnt have a "Max" amount of summons, you can just summon as many as you wish, and also doesnt run by requirements (like lvl and such).

As previously stated in the thread, we already have the working script for the requirements and everything, I just need a working script with the part where there is a "max" amount of summons at once, just like "utevo res" which allows 2 maximum.

Cheers.

EDIT: Problem solved. Read here for information about the solution:

http://otland.net/f132/summon-single-creature-rep-36507/#post368334
 
Last edited:
Back
Top