TalkAction Advanced sex system

elf

Sing, sing blue silver
Joined
Dec 11, 2007
Messages
3,665
Best answers
1
Reaction score
116
Location
Cracow, Poland
For the first, I'd like to thank Nostradamus_ for the basic idea and nice piece of code.
Second important thing - the function was made for TFS, I don't know will it work on other cores!
As third... I've decided to release the code today, after I rebuilded it, and its almost different than Nostradamus_'s one.
And last, I want to say, it is my first longer script, so I dont exclude aby bug :)
Okay, cut the shit off :rolleyes:


Features:
- Usable condoms (After use You may do a sex in next 5 minutes. Of course only once, no cheapness, after sex You need to wear a new one :D).
- Now You have to stand before a player with which You want to have a sex.
- Second player needs to accept the proposition of a sex.
- You may fuck only with different gender as self.
- After sex without condoms there is 1/4 possibility of a child, 1/4 of an aids and 2/4 of normal sex.
- Aids possibility for proposing player, accepting player or for both.
- Female always borns the child.
- Male name always first in child's description (More epic - 'Im mighty BLA2, son of the BLA (<- dad :p) from BLABLA!').
- Proposing player losses cash in case of a child.
- Player cannot be spammed with proposition of sex (Proposition is removed after other player invites for sex).
- Aids takes ~200 HP.

Todo:
- Other item for Females instead of condoms.
- Other Daughter doll.
- Increase Aids damage by player level.


1. Create a file in talkactions\scripts and name it sex.lua. Paste to it:
Code:
local combat = createCombatObject()
local condition = createConditionObject(CONDITION_DROWN)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 20, 2000, -10)
setCombatCondition(combat, condition)

function onSay(cid, words, param)
sexProposal = getPlayerStorageValue(cid, 66600)
sexAccept = cid
noCondom = math.random(4)
aidsEffect = math.random(3)

	local playerPos = getCreaturePosition(cid)
	if getPlayerLookDir(cid) == 1 then 
		posDir = {x = playerPos.x + 1, y = playerPos.y, z = playerPos.z, stackpos = 253}
	elseif getPlayerLookDir(cid) == 2 then
		posDir = {x = playerPos.x, y = playerPos.y + 1, z = playerPos.z, stackpos = 253}
	elseif getPlayerLookDir(cid) == 3 then
		posDir = {x = playerPos.x - 1, y = playerPos.y, z = playerPos.z, stackpos = 253}
	else
		posDir = {x = playerPos.x, y = playerPos.y - 1, z = playerPos.z, stackpos = 253}
	end
	target = getThingfromPos(posDir)
	if isPlayer(target.uid) == TRUE then
		if getPlayerLookDir(target.uid) == getPlayerLookDir(cid)-2 then
			sameLookDir = TRUE
		elseif getPlayerLookDir(target.uid) == getPlayerLookDir(cid)+2 then
			sameLookDir = TRUE
		else
			sameLookDir = FALSE
		end
		if sameLookDir == TRUE then
			if getPlayerSex(target.uid) == getPlayerSex(cid) then
				doPlayerSendCancel(cid, 'You cannot make sex with same gender as self, pervert!')
				doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
			else
				if getPlayerGroupId(cid) > 3 and getPlayerGroupId(cid) >= getPlayerGroupId(target.uid) then
					sexProposal = cid
					sexAccept = target.uid
					allowSex = TRUE
				elseif target.uid == sexProposal then
					allowSex = TRUE
				else
					allowSex = FALSE
				end
				if allowSex == TRUE then
					if getPlayerStorageValue(sexProposal, 66660) > 0 or getPlayerStorageValue(sexAccept, 66660) > 0 then
						doSendAnimatedText(getCreaturePosition(sexProposal), 'Ahh, Ahh...', TEXTCOLOR_YELLOW)
						doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_STUN)
						doSendAnimatedText(getThingPos(sexAccept), 'Ohh, Ohh!', TEXTCOLOR_TEAL)
						doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_STUN)
						setPlayerStorageValue(sexProposal, 66660, 0)
						setPlayerStorageValue(sexAccept, 66660, 0)
					else
						if noCondom == 3 then
							hurtMessage = 'Sex without condoms brings consequences - You just got AIDS!\nYour sickness will hurt alot...'
							partnerMessage = 'Sex without condoms brings consequences - Your partner just got AIDS!'
							bothMessage = 'Sex without condoms brings consequences - You and Your partner just got AIDS!\nYour sickness will hurt alot...'
							if aidsEffect == 1 then
								proposalMessage = hurtMessage
								acceptMessage = partnerMessage
								hurtPlayer = sexProposal
							elseif aidsEffect == 2 then
								proposalMessage = partnerMessage
								acceptMessage = hurtMessage
								hurtPlayer = sexAccept
							else
								proposalMessage = bothMessage
								acceptMessage = bothMessage
								hurtPlayer = FALSE
							end
							doPlayerSendTextMessage(sexProposal, MESSAGE_STATUS_WARNING, proposalMessage)
							doPlayerSendTextMessage(sexAccept, MESSAGE_STATUS_WARNING, acceptMessage)
							if hurtPlayer == FALSE then
								doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_YELLOW_RINGS)
								doCombat(0,combat,numberToVariant(sexProposal))
								doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_YELLOW_RINGS)
								doCombat(0,combat,numberToVariant(sexAccept))
							else
								doSendMagicEffect(getPlayerPosition(hurtPlayer),CONST_ME_YELLOW_RINGS)
								doCombat(0,combat,numberToVariant(hurtPlayer))
							end
						elseif noCondom == 2 then
							payMessage = '\nAs a good parent You spend whole Your gold for the child.'
							if getPlayerSex(sexProposal) == 0 then
								childMother = sexProposal
								childFather = sexAccept
								motherMsg = payMessage
								fatherMsg = ""
							elseif getPlayerSex(sexProposal) == 1 then
								childMother = sexAccept
								childFather = sexProposal
								motherMsg = ""
								fatherMsg = payMessage
							else
								if getPlayerSex(sexAccept) == 0 then
									childMother = sexAccept
									childFather = sexProposal
									motherMsg = ""
									fatherMsg = payMessage
								else
									childMother = sexProposal
									childFather = sexAccept
									motherMsg = payMessage
									fatherMsg = ""
								end
							end
							doPlayerSendTextMessage(childFather, MESSAGE_STATUS_WARNING, 'Sex without condoms brings consequences - '..getCreatureName(childMother)..' just born a child!' .. fatherMsg)
							doPlayerSendTextMessage(childMother, MESSAGE_STATUS_WARNING, 'Sex without condoms brings consequences - You have just born a child!' .. motherMsg)
							doSendMagicEffect(getPlayerPosition(childFather), CONST_ME_FIREWORK_YELLOW)
							doSendMagicEffect(getPlayerPosition(childMother), CONST_ME_FIREWORK_RED)
							if math.random(2) == 1 then
								childGender = "son"
							else
								childGender = "daughter"
							end
							doSetItemSpecialDescription(doPlayerAddItem(childMother,6579,1),'It is a '..childGender..' of '..getCreatureName(childFather)..' and '..getCreatureName(childMother)..'.')
							local gps = getPlayerItemCount(sexProposal, ITEM_GOLD)
							local pcs = getPlayerItemCount(sexProposal, ITEM_PLATINUM)
							local ccs = getPlayerItemCount(sexProposal, ITEM_CRYSTAL)
							if gps > 0 or pcs > 0 or ccs > 0 then
								doPlayerRemoveItem(sexProposal, ITEM_GOLD, gps)
								doPlayerRemoveItem(sexProposal, ITEM_PLATINUM, pcs)
								doPlayerRemoveItem(sexProposal, ITEM_CRYSTAL, ccs)
							end
						else
							doSendAnimatedText(getCreaturePosition(sexProposal), 'Ahh, Ahh...', TEXTCOLOR_YELLOW)
							doSendMagicEffect(getPlayerPosition(sexProposal),CONST_ME_STUN)
							doSendAnimatedText(getThingPos(sexAccept), 'Ohh, Ohh!', TEXTCOLOR_TEAL)
							doSendMagicEffect(getPlayerPosition(sexAccept),CONST_ME_STUN)
						end
					end
					setPlayerStorageValue(sexProposal, 66600, 0)
					setPlayerStorageValue(sexAccept, 66600, 0)
				else
					if getPlayerStorageValue(target.uid, 66600) == cid then
						doPlayerSendCancel(cid, 'You have already sent a sex proposal to '..getCreatureName(target.uid)..'.')
						doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
					else
						setPlayerStorageValue(target.uid, 66600, cid)
						doPlayerSendTextMessage(cid, 22, 'You have sent a sex proposal to '..getCreatureName(target.uid)..'.')
						doPlayerSendTextMessage(target.uid, 22, getCreatureName(cid)..' wants to have a sex with You.')
						doSendMagicEffect(getPlayerPosition(target.uid),CONST_ME_HEARTS)
					end
				end
			end
		else
			doPlayerSendCancel(cid, 'You must stand after your partner to do sex.')
			doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
		end
	else
		doPlayerSendCancel(cid, 'You may do sex only with players.')
		doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
	end
	doPlayerSendTextMessage(cid, 25, words)
	return FALSE
end
Save and close.

2. Open talkactions\talkactions.xml and add somewhere between other actions:
Code:
	<talkaction words="!sex" script="sex.lua"/>
Save and close.

3. Create a file in actions\scripts and name it condom.lua. Paste to it:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local exhaust = getPlayerStorageValue(cid, 66660) + 300
	if (os.time() >= exhaust) then
		setPlayerStorageValue(cid, 66660, os.time())
		doSendMagicEffect(toPosition, CONST_ME_GIFT_WRAPS)
		doPlayerSendTextMessage(cid, 22, 'You are now wearing a condom for next 5 minutes.')
		doRemoveItem(item.uid, 1)
	else
		doPlayerSendCancel(cid, 'You are already safe for sex!')
	end
	return TRUE
end
Save and close.

4. Open actions\actions.xml and add somewhere between other actions:
Code:
<action itemid="6527" script="condom.lua" />
Save and close.

5. Open items\items.xml and find:
Code:
	<item id="6527" article="a" name="christmas token" plural="christmas tokens">
		<attribute key="weight" value="5"/>
	</item>
And replace it with:
Code:
	<item id="6527" article="a" name="condom" plural="condoms">
		<attribute key="weight" value="5"/>
		<attribute key="description" value="May be used for safe sex, last 5 minutes."/>
	</item>
Find:
Code:
	<item id="6579" article="a" name="tibia doll">
		<attribute key="weight" value="750"/>
	</item>
And replace it with:
Code:
	<item id="6579" article="a" name="child">
		<attribute key="weight" value="5000"/>
	</item>
Save and close.

Please test it and post Your oppinions :)


P.S. Actually I was thinking of adding to the code something like:
Without condom in case of sex, it removes 100hp from female, 100mp of male and both players soul points.
After sex without condom, it regenerates and soul points to full of both players.
After sex with condom, it regenerates 1/10 of hp and 100 soul points of both players.
Wasn't sure of it :)
 
Last edited:

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
Haha, nice piece of code! Good work!
 

Nostradamus

New Member
Joined
Jun 2, 2007
Messages
219
Best answers
0
Reaction score
4
Wow, it is the first time that someone like some codes of mine, haha, joking :p

Congratulations!
 
OP
elf

elf

Sing, sing blue silver
Joined
Dec 11, 2007
Messages
3,665
Best answers
1
Reaction score
116
Location
Cracow, Poland
@Royal Elite

Didn't test it on other cores :)
 

robertoooo

New Member
Joined
Jan 3, 2008
Messages
20
Best answers
0
Reaction score
0
lol, sounds funny XD
haha :p like it, lol sex in tibia XD
 

AGS

DeathSouls Owner
Joined
Oct 29, 2007
Messages
400
Best answers
0
Reaction score
8
Location
Mexico
Nice code, but I don't think I will ever add this to my server xD.

You should make it so when you get AIDS you get a storagevalue, and if you have sex with another person without condom, the other person will always get AIDS....

What is numberToVariant() for?
 

Ronaldino

Esso Eh
Joined
Dec 25, 2007
Messages
745
Best answers
0
Reaction score
0
can you add level remaining for making sex? cuz of players make noob chars and spam !sex ;s
 

Evil Hero

Legacy Member
TFS Developer
Joined
Dec 12, 2007
Messages
1,179
Best answers
15
Reaction score
553
Location
Germany
Very nice Script well done! i will try it later on other servers :p
 

justin234

New Member
Joined
Jan 22, 2008
Messages
999
Best answers
0
Reaction score
3
sex on tibia, umm...no, why the hell would someone want this?
 
OP
elf

elf

Sing, sing blue silver
Joined
Dec 11, 2007
Messages
3,665
Best answers
1
Reaction score
116
Location
Cracow, Poland
Ronaldino - !sex has to be accepted.
@up - Dunno why ;D For fun :) And ots != tibia.
 

Ronaldino

Esso Eh
Joined
Dec 25, 2007
Messages
745
Best answers
0
Reaction score
0
Ronaldino - !sex has to be accepted.
@up - Dunno why ;D For fun :) And ots != tibia.
accepting doesnt work for me... just if someone say more that one time "!sex" you can make sex wichout accepting :/
 

Shadow Blade

Arcadia BETA - 04/18/08
Joined
Feb 15, 2008
Messages
5
Best answers
0
Reaction score
0
Not sure if this will work...

But if it does, good times are to be had by all!

:thumbup:
 

Korrex

Intermediate OT User
Joined
Jan 19, 2008
Messages
2,748
Best answers
0
Reaction score
110
It doesn't happen anything and i am using a evolutions server and the talkaction works but it doesn't do anything like that thing with the consequenses.
 

Clary

New Member
Joined
Mar 7, 2008
Messages
1,007
Best answers
0
Reaction score
1
it works will just that the other cann't refuse it is just made
 

Saj

Remember my name
Joined
Feb 26, 2008
Messages
2,127
Best answers
0
Reaction score
5
Haha very nice, I will for sure use it! :)
 

Powahz0r

Banned User
Joined
Dec 28, 2007
Messages
63
Best answers
0
Reaction score
0
sex on tibia, umm...no, why the hell would someone want this?
Stupid comment, ever.
Never seen the million horny uglish br's on Tibia looking for a GF, while 96% of the girls r male irl? xd
 

GM Seriosa

Viva la Revolution!
Joined
Jun 7, 2007
Messages
118
Best answers
0
Reaction score
3
Location
Sweden
Wow, this is awesome! Now I can make my Porn Server 8.10 , rofl just joking.. Funny script tho xD
 
Top