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

Puzzling thing

Mera Mero

Guess Who?
Joined
Dec 27, 2014
Messages
417
Reaction score
86
I need to make a Stone (it can be other thing, but stone is for example) what is required to kill. Every 10% hp (it can be just amount of hp) lose, it will spawn wave of monsters. Every wave will be stronger that previous. After kill the Stone, teleport will appear. i already saw it before on ot
Thanks
Yo @Limos
 
Last edited:
Alright,
All you have to do is make a onStatsChange creaturescript:

Code:
function onStatsChange(cid, attacker, type, combat, value)
  if type == 1 then
     if (getCreatureHealth(cid) > getCreatureMaxHealth(cid)*0.9) and (getCreatureHealth(cid)-value < getCreatureMaxHealth(cid)*0.9) then
            --Do whatever you want to happen after dropping below 90% health
     end
   end
   return true
end

Then add the above Creature Event to the monster of your choice.

There are cleaner ways to do it, but this is a example of one way.
 
Alright,
All you have to do is make a onStatsChange creaturescript:

Code:
function onStatsChange(cid, attacker, type, combat, value)
  if type == 1 then
     if (getCreatureHealth(cid) > getCreatureMaxHealth(cid)*0.9) and (getCreatureHealth(cid)-value < getCreatureMaxHealth(cid)*0.9) then
            --Do whatever you want to happen after dropping below 90% health
     end
   end
   return true
end

Then add the above Creature Event to the monster of your choice.

There are cleaner ways to do it, but this is a example of one way.
can u post full script i still Still do not understand
 
can u post full script i still Still do not understand

Sorry I refuse to do the work for you.

But I will explain what I have posted already.

Code:
function onStatsChange(cid, attacker, type, combat, value) -- onStatsChange is run every time a creature has health loss/gain or mana loss/gain
if type == 1 then -- Type == 1 makes sure that this script will only run when a creature takes damage
    local healthPercent = (getCreatureMaxHealth(cid)*0.9) -- If you multiply your max health by 0.9, the new total will be 90% of the creatures max health
    local currentHealth = getCreatureHealth(cid) --This is the creature's current health
    local afterDamage = (currentHealth -value) -- value is the damage that is being done, so you subtract it from currentHealth to get the new health
    if (currentHealth > healthPercent) and (afterDamage < healthPercent ) then --If the creature is above 90% health, and afterDamage is below 90% health
--Do whatever you want to happen after dropping below 90% health (Here you would summon creatures, etc)
--For Example you could put doCreateMonster(getCreaturePosition(cid), "bat")
end
end
return true
end

Hope this helps! If you have any specific questions let me know, but I refuse to make the entire script for you, or you will never learn, and never become a great OTLand Server Designer.
 
Sorry I refuse to do the work for you.

But I will explain what I have posted already.

Code:
function onStatsChange(cid, attacker, type, combat, value) -- onStatsChange is run every time a creature has health loss/gain or mana loss/gain
if type == 1 then -- Type == 1 makes sure that this script will only run when a creature takes damage
    local healthPercent = (getCreatureMaxHealth(cid)*0.9) -- If you multiply your max health by 0.9, the new total will be 90% of the creatures max health
    local currentHealth = getCreatureHealth(cid) --This is the creature's current health
    local afterDamage = (currentHealth -value) -- value is the damage that is being done, so you subtract it from currentHealth to get the new health
    if (currentHealth > healthPercent) and (afterDamage < healthPercent ) then --If the creature is above 90% health, and afterDamage is below 90% health
--Do whatever you want to happen after dropping below 90% health (Here you would summon creatures, etc)
--For Example you could put doCreateMonster(getCreaturePosition(cid), "bat")
end
end
return true
end

Hope this helps! If you have any specific questions let me know, but I refuse to make the entire script for you, or you will never learn, and never become a great OTLand Server Designer.
ok thx
 
Sorry I refuse to do the work for you.

But I will explain what I have posted already.

Code:
function onStatsChange(cid, attacker, type, combat, value) -- onStatsChange is run every time a creature has health loss/gain or mana loss/gain
if type == 1 then -- Type == 1 makes sure that this script will only run when a creature takes damage
    local healthPercent = (getCreatureMaxHealth(cid)*0.9) -- If you multiply your max health by 0.9, the new total will be 90% of the creatures max health
    local currentHealth = getCreatureHealth(cid) --This is the creature's current health
    local afterDamage = (currentHealth -value) -- value is the damage that is being done, so you subtract it from currentHealth to get the new health
    if (currentHealth > healthPercent) and (afterDamage < healthPercent ) then --If the creature is above 90% health, and afterDamage is below 90% health
--Do whatever you want to happen after dropping below 90% health (Here you would summon creatures, etc)
--For Example you could put doCreateMonster(getCreaturePosition(cid), "bat")
end
end
return true
end

Hope this helps! If you have any specific questions let me know, but I refuse to make the entire script for you, or you will never learn, and never become a great OTLand Server Designer.
Yeah he only works for me :)
thanks for this script but i didn't understand something :(
Ontopic, try exploring the code Flatlander posted, make your own edits, if it doesn't work the way you want or have another problem, then please post back here for help.
i've made creaturescript and login and edited monster that i need to make summon and i got this error
Code:
[30/01/2015 19:08:56] [Error - CreatureEvent::configureEvent] No valid type for creature event.onstatschange
[30/01/2015 19:08:56] [Warning - BaseEvents::loadFromXml] Cannot configure an event
sorry but what is type for creature event? of onstatschange? still newbie :p
 
Here is a file you can save for reference when using 0.3.#:

(Btw its just statschange)
Code:
[ SCRIPTSYSTEM_HELP
   Project Name
     The Forgotten Server

   Version
     0.3.7

   Codenamed
     Crying Damson

   License
     GNU GPLv3

   Forum
     http://otland.net/
]

[ ABOUT
   Few things, about scriptsystem, attributes possible to use in .xml declaration file.
]

[ LIST
   *ACTIONS
     File: actions/actions.xml
     Attributes
       actionid
       uniqueid
       itemid
       fromid, toid
       fromaid, toaid
       fromuid, touid
         Defined in which situations action should be triggered.
         Execution order: unique, action, id, runeid
       allowfaruse
         ItemEx can be used from far?
         Only for items with option 'Use with'.
       blockwalls
         Defines if item will ignore walls and other blocking items.
         Only for items with option 'Use with'.
       function
         Default hardcoded functions.
         Values: increaseItemId, deincreaseItemId
     Function
       onUse(cid, item, fromPosition, itemEx, toPosition)

   *CREATURESCRIPTS
     File: creaturescripts/creaturescripts.xml
     Attributes
       type
         Event type
         Values:
           login, logout,
           spawn-single, spawn-global,
           advance, statschange,
           direction, outfit,
           mailsend, mailchange,
           traderequest, tradeaccept,
           channeljoin, channelleave,
           look, think, textedit, reportbug,
           push, target, follow,
           attack, combat, areacombat, cast
           kill, death, preparedeath,
           channelrequest, reportviolation,
           thankyou, houseedit, throw
     Functions:
       onLogin(cid)
       onLogout(cid, forceLogout)
       onSpawn(cid)
       onAdvance(cid, skill, oldLevel, newLevel)
       onStatsChange(cid, attacker, type, combat, value)
       onDirection(cid, old, current)
       onOutfit(cid, old, current)
       onMailSend(cid, receiver, item, openBox)
       onMailReceive(cid, sender, item, openBox)
       onTradeRequest(cid, target, item)
       onTradeAccept(cid, target, item, targetItem)
       onChannelJoin(cid, channel, users)
       onChannelLeave(cid, channel, users)
       onChannelRequest(cid, channel, custom)
       onLook(cid, thing, position, lookDistance)
       onThink(cid, interval)
       onTextEdit(cid, item, newText)
       onHouseEdit(cid, house, list, text)
       onReportBug(cid, comment)
       onReportViolation(cid, type, reason, name, comment, translation, statementId)
       onThankYou(cid, statementId)
       onAreaCombat(cid, ground, position, aggressive)
       onPush(cid, target, ground, position)
       onTarget(cid, target)
       onFollow(cid, target)
       onCombat(cid, target, aggressive)
       onAttack(cid, target)
       onCast(cid, target)
       onKill(cid, target, damage, flags, war)
       onDeath(cid, corpse, deathList)
       onPrepareDeath(cid, deathList)
       onThrow(cid, item, fromPosition, toPosition)

   *GLOBALEVENTS
     File: globalevents/globalevents.xml
     Attributes
       type
         Server events, script can be executed at server start, shutdown or players record.
         Values:
           startup
           shutdown
           globalsave
           record
       interval
         Script will be executed every x miliseconds.
         Ignored if 'type' specified.
       time
         Script will be executed at specified time.
         For example: '12:00:55'
     Functions
       onThink(interval)
       onStartup()
       onShutdown()
       onGlobalSave
       onRecord(current, old, cid)
       onTime()

   *MOVEMENTS
     File: movements/movements.xml
     Attributes
       type/event
         Values:
           StepIn, StepOut
           Equip, DeEquip
           AddItem, RemoveItem
       slot
         Values:
           head
           necklace
           backpack
           armor
           right-hand, left-hand
           two-handed, hand/shield
           legs
           feet
           ring
           ammo
       tileitem
         Defines if it is a tile item.
       level
         You can specify level required to use this item.
       maglevel
         Magic level required.
       premium
         Premium needed?
         Values: yes/no
       function
         Default hardcoded functions.
         Values:
           onStepInField
           onStepOutField
           onAddField
           onRemoveField
           onEquipItem
           onDeEquipItem
     Functions
       onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
       onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
       onEquip(cid, item, slot)
       onDeEquip(cid, item, slot)
       onAddItem(moveItem, tileItem, position, cid)
       onRemoveItem(moveItem, tileItem, position, cid)

   *SPELLS
     File: spells/spells.xml
     Attributes
       //TODO :(
     Function: onCastSpell(cid, var)

   *TALKACTIONS
     File: talkactions/talkactions.xml
     Attributes
       words
         Words used to execute this talkaction.
         Can be separated by a semicolon, fe. words="/a; /b",
           or using own separator, fe. words="/a, /b" separator=","
       separator
         Read "words".
       access
         Access required.
       groups
         Groups allowed to use.
       channel
         Will work only on specified channel.
       filter
         How params should be parsed.
         E.q
           If you use 'quotation' - you will need to write /goto "PlayerName
           If you use 'word' - you will need to write /goto PlayerName
           If you use 'word-spaced' - you are able to make seperate commands with space between word(s)
         Values: quotation/word/word-spaced
       logged
         Defines if talkaction should be logged.
         Default: no
       hidden
         Defines if talkaction should be hidden from displaying it when using /commands
       case-sensitive
         Defines if talkaction should be case sensitive. Is 'no' - then /command will be same as /CoMmAnD
         Default: yes
       exception
         List of players, who can't use this talkaction.
         Example: "GM John;GM 2;Maatt"
     Function: onSay(cid, words, param, channel)

   *WEAPONS
     File: weapons/weapons.xml
     Attributes
       //TODO
     Function: onUseWeapon(cid, var)
]
 
If I recall right, then 0.3.x didn't support onStatsChange for monsters, it had it's purpose for players only.
However you can do this with onThink, it's pretty similiar scriptwise to what Flatlander posted already.
 
***** it works on mobs, ya just need to register in the monster file now someone plez do this for tfs 1.0

everyone says go use tfs 1.0
guess what? every script being made is for 0.4/0.3 good luck getting new peeps to use 1.0

guess we'll be stuck in 8.6 forever
 
Last edited:
Back
Top