Action [Release] Ultimate Bomb

Third Aid

Banned User
Joined
Dec 14, 2009
Messages
62
Best answers
0
Reaction score
0
Location
Sweden
Bomb Release

Tested with TFS Crying Damson 0.3.6


Information:
4 players stand on 4 tiles
Pulls the switch
Gets teleported to a room
After 30 seconds a bomb will get activated
Every minute 3 monsters will spawn in the room
After 15 minutes the room explodes and everyone dies
The mission in the room is to destroy a wall with alot of health to survive (If they destroy the wall they can enter a teleport to get their reward)



Screen 1:


Screen 2:




Action Script:
actions/scripts/bombQuest.lua
Lua:
-- Made by Third Aid

function monsterSpawns()
	local monsters = {"Rat", "Rotworm", "Bog Raider", "Giant Spider", "Diabolic Imp", "Destroyer", "Dark Torturer", "Behemoth", "Hellspawn", "War Golem", "Serpent Spawn", "Hellhound", "Plaguesmith", 
					  "Demon", "Undead Dragon"}
					  
	local monstersPos = {x=4605, y=4695, z=8} -- Where the monsters should be spawned
	
	local bombPos = {x=4600, y=4695, z=8, stackpos=2} -- Position of the bomb
	local getBomb = getThingFromPos(bombPos)
	
	local northWestX = 4595 -- North West X of the room with the bomb
	local northEastX = 4607 -- North East X of the room with the bomb
	local northWestY = 4692 -- North West Y of the room with the bomb
	local southWestY = 4698 -- South West Y of the room with the bomb
	local roomFloor = 8 -- Floor / Z of the room with the bomb
	
	if getGlobalStorageValue(17001) == 0 then
		doTransformItem(getBomb.uid, 9890)
	end
	
	setGlobalStorageValue(17001, getGlobalStorageValue(17001)+1)
	doSendAnimatedText(bombPos, "" .. 16-getGlobalStorageValue(17001) .. " min", TEXTCOLOR_YELLOW)
	
	if getGlobalStorageValue(17001) <= 15 then
		doSummonCreature(monsters[getGlobalStorageValue(17001)], monstersPos)
		doSummonCreature(monsters[getGlobalStorageValue(17001)], monstersPos)
		doSummonCreature(monsters[getGlobalStorageValue(17001)], monstersPos)
		addEvent(monsterSpawns, 60*1000)
	else
		setGlobalStorageValue(17000, 0)
		setGlobalStorageValue(17001, 0)
		doTransformItem(getBomb.uid, 9891)
		for x = northWestX, northEastX do
			for y = northWestY, southWestY do
			local explosionArea = {x=x, y=y, z=roomFloor, stackPos=253}
			local getCreatures = getTopCreature(explosionArea).uid
				doSendMagicEffect(explosionArea, CONST_ME_FIREATTACK)
				if(isCreature(getCreatures) == TRUE) then
					doCreatureAddHealth(getCreatures, -getCreatureHealth(getCreatures))
				end
			end
		end
		
		for _, pid in ipairs(getPlayersOnline()) do
			if getPlayerStorageValue(pid, 17000) == 1 then
				setPlayerStorageValue(pid, 17000, 0)
				doCreatureAddHealth(pid, -getCreatureHealth(pid))
				setGlobalStorageValue(17000, 0)
			end
		end
	end
return true
end
	
	
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local playerPos1 = {x=4935, y=4973, z=8, stackpos=STACKPOS_TOP_CREATURE} -- The tiles they should stand on when pulling the switch
	local playerPos2 = {x=4934, y=4973, z=8, stackpos=STACKPOS_TOP_CREATURE}
	local playerPos3 = {x=4933, y=4973, z=8, stackpos=STACKPOS_TOP_CREATURE}
	local playerPos4 = {x=4932, y=4973, z=8, stackpos=STACKPOS_TOP_CREATURE}
	
	local getPlayerPos1 = getThingFromPos(playerPos1)
	local getPlayerPos2 = getThingFromPos(playerPos2)
	local getPlayerPos3 = getThingFromPos(playerPos3)
	local getPlayerPos4 = getThingFromPos(playerPos4)
	
	local newPlayerPos1 = {x=4602, y=4694, z=8} -- Where they get teleported in the room with the bomb
	local newPlayerPos2 = {x=4602, y=4696, z=8}
	local newPlayerPos3 = {x=4598, y=4694, z=8}
	local newPlayerPos4 = {x=4598, y=4696, z=8}
	
	local wallName = "Brick Wall" -- Name of the "Wall monster"
	local wallPos = {x=4607, y=4695, z=8} -- Where the wall should be
	
	
		if getPlayerPos1.itemid > 0 and getPlayerPos2.itemid > 0 and getPlayerPos3.itemid > 0 and getPlayerPos4.itemid > 0 then
			if getGlobalStorageValue(17000) <= 0 then
				setPlayerStorageValue(getPlayerPos1.uid, 17000, 1)
				setPlayerStorageValue(getPlayerPos2.uid, 17000, 1)
				setPlayerStorageValue(getPlayerPos3.uid, 17000, 1)
				setPlayerStorageValue(getPlayerPos4.uid, 17000, 1)
				doTeleportThing(getPlayerPos1.uid, newPlayerPos1)
				doTeleportThing(getPlayerPos2.uid, newPlayerPos2)
				doTeleportThing(getPlayerPos3.uid, newPlayerPos3)
				doTeleportThing(getPlayerPos4.uid, newPlayerPos4)
				doSendMagicEffect(newPlayerPos1, CONST_ME_TELEPORT)
				doSendMagicEffect(newPlayerPos2, CONST_ME_TELEPORT)
				doSendMagicEffect(newPlayerPos3, CONST_ME_TELEPORT)
				doSendMagicEffect(newPlayerPos4, CONST_ME_TELEPORT)
				doSendMagicEffect(playerPos1, CONST_ME_POFF)
				doSendMagicEffect(playerPos2, CONST_ME_POFF)
				doSendMagicEffect(playerPos3, CONST_ME_POFF)
				doSendMagicEffect(playerPos4, CONST_ME_POFF)
				setGlobalStorageValue(17000, 1)
				setGlobalStorageValue(17001, 0)
				doSummonCreature(wallName, wallPos)
				addEvent(doSendAnimatedText, 30*1000, {x=4600, y=4695, z=8}, "ACTIVATED", TEXTCOLOR_GREEN)
				addEvent(monsterSpawns, 30*1000)
				for _, pid in ipairs(getPlayersOnline()) do
					if getPlayerStorageValue(pid, 17000) == 1 then
						doPlayerSendTextMessage(pid, 22, "The bomb will start ticking in 30 seconds, you have 15 minutes to destroy the wall and get out of the room before it explodes! Three monsters will spawn every minute!")
					end
				end
			else
				doPlayerSendTextMessage(cid, 22, "Some people are already in there, wait until they're done.")
			end
		else
			doPlayerSendCancel(cid, "Sorry, not possible.")
		end
	return true
end
actions/actions.xml
PHP:
<action actionid="17000" event="script" value="bombQuest/bombQuest.lua"/>

Movement Script:
movements/scripts/bombQuest.lua

Lua:
function onStepIn(cid, item, position, fromPosition)
	doTeleportThing(cid, {x=4625, y=4695, z=8}) -- Reward room position
	setPlayerStorageValue(cid, 17000, 0)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	doSendMagicEffect(fromPosition, CONST_ME_POFF)
return true
end
movements/movements.xml
PHP:
<movevent type="StepIn" actionid="17001" event="script" value="bombQuest.lua"/>
monsters/misc/Brick Wall.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Brick Wall" nameDescription="a brick wall" race="blood" experience="500000" speed="0" manacost="200">
	<health now="540000" max="540000"/>
	<look typeex="1025"/>
	<targetchange interval="2000" chance="0"/>
	<strategy attack="100" defense="0"/>
	<flags>
		<flag summonable="0"/>
		<flag attackable="1"/>
		<flag hostile="1"/>
		<flag illusionable="0"/>
		<flag convinceable="0"/>
		<flag pushable="0"/>
		<flag canpushitems="0"/>
		<flag canpushcreatures="0"/>
		<flag targetdistance="1"/>
		<flag staticattack="90"/>
		<flag runonhealth="0"/>
	</flags>
	<attacks>
		<attack name="melee" interval="2000" skill="0" attack="0">
		</attack>
	</attacks>
	<defenses armor="1" defense="5"/>
	<loot>
	</loot>
</monster>
monsters/monsters.xml

PHP:
<monster name="Brick Wall" file="Misc/Brick Wall.xml"/>
Don't forget to Rep++ if you like it :)
 
Last edited:

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
852
Location
Caribbean Sea
you took this idea from the one posted in otfans, right? its almost the same
 
OP
Third Aid

Third Aid

Banned User
Joined
Dec 14, 2009
Messages
62
Best answers
0
Reaction score
0
Location
Sweden
Nah, I'm the same person ;p Long time ago I made the other script and it didn't even work so I updated it.
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
852
Location
Caribbean Sea
oO okh ;d
i updated that old one in for my tfs 0.3.6 xd when time runs out they are tped to their hometown and other small feaures
 

grzechopl

New Member
Joined
Jun 23, 2009
Messages
200
Best answers
0
Reaction score
1
i am to lazy and i am to low in mapping so can you upload it? :<
 

frankfarmer

who'r ninja now
Joined
Aug 5, 2008
Messages
1,472
Best answers
0
Reaction score
30
Location
swe?
Code:
[Error - Action Interface] 
[30/12/2009 12:33:22] data/actions/scripts/quests/bomb.lua nUse
[30/12/2009 12:33:22] Description: 
[30/12/2009 12:33:22] (luaGetThingFromPos) Tile not found
HM? Using 0.3.6
 

grzechopl

New Member
Joined
Jun 23, 2009
Messages
200
Best answers
0
Reaction score
1
hm, i have problem with Brick Wall it isnt work for me, when i import it in RME i dont see a skin (maybe looktype is incorrect)
are you sure the script brick wall is good?
 
OP
Third Aid

Third Aid

Banned User
Joined
Dec 14, 2009
Messages
62
Best answers
0
Reaction score
0
Location
Sweden
The brick wall summons when you pull the switch, there's no need to place it anywhere with the map editor.
 
Top