FANDOM


Supported In:
C D/S/W W-CD
? ? ?

The scripting command TakeOrGive has the opcode (0x0C).

Arguments

  • Byte - Take Type
  • Byte - Take Value (1, 2, or 4 bytes, depending on type, mostly 1)
  • Byte - Give Type
  • Byte - Give Value (1, 2, or 4 bytes, depending on type, mostly 1)


Description

Takes something from or gives something to someone, depending on given type and value. Can simultaneously take and give something.

Notes

Gives to the most recently "selected" character. Characters can be selected either with the WhoWill, SelRndChar, or SetChar command. By default, the first character is selected. If the selected character is set to 0 (via SetChar with a 0 argument) then all characters lose or get the specified thing. ie, to give all characters 60000 experience requires two lines:

0f 00                     // select all characters
0c 00 00 10 60 ea 00 00   // give 60000 experience to selected character (ie, all)

If the take or give fails (ie, if inventory is full, or there is no such item) then the code simply exits the event, with no chance of recovery.

While 0x0C, 0x1C, 0x1D, and 0x26 opcodes all execute the TakeGive command, there are differences which may warrant each to have their own page.

TakeGive types Edit

TypeArgumentsDescription
0x00 --- UNUSED: This does nothing. Do Not use!
0x01 --- UNUSED: This does nothing. Do Not use!
0x02 --- UNUSED: This does nothing. Do Not use!
0x03 Sex Take: UNUSED. Give: Sets character sex (0=male, 1=female)
0x04 Race Take: UNUSED. Give: Sets character race (0=Human, 1=Elf, 2=Dwarf, 3=Gnome, 4=H-Orc)
0x05 Class Take: UNUSED. Give: Sets character class (0=Knight, 1=Paladin, 2=Archer, 3=Cleric, 4=Sorcerer, 5=Robber, 6=Ninja, 7=Barbarian, 8=Druid, 9=Ranger)
0x06 --- UNUSED: This does nothing. Do Not use!
0x07 --- UNUSED: This does nothing. Do Not use!
0x08 HP (1) Does damage (TakeHP) or heals (GiveHP, no DMGType)
0x09 SP (1) Add/subtract Spell Points
0x0A AC (1) Set Armor Class. Updates the ACTemp value. Can be reduce below zero.
0x0B LevelTmp (1) Level bonus (extra beyond base). Can be reduced below zero.
0x0C Age (1) Age Temp. Can be reduced below zero
0x0D Skill (1) Take/Give Skill. 0=Theivary, 1=ArmsMaster, 2=Astrologer, 3=BodyBuilder, 4=Cartographer, 5=Crusader, 6=DirectionSense, 7=Linguist, 8=Merchant, 9=Mountaineer, 10=Navigator, 11=PathFinder, 12=PrayerMaster, 13=Prestidigitator, 14=Swimmer, 15=Tracker, 16=SpotSecretDoors, 17=DangerSense
0x0E --- UNUSED: This does nothing. Do Not use!
0x0F Award Removes/grants an award. Award 8 plays a spell FX when given. TODO: Seems a little more complex than just a straight lookup.
0x10 Exp (4) Add/subtract player experience (max 4,294,967,296). Unsigned; will integer wrap.
0x11 PartyPoison (1) Add/remove party poison resistance, as if set by Prot. from Elements spell.
0x12 Condition (1) Remove/set the given condition. 0=Cursed, 1=HeartBroken, 2=Weak, 3=Poisoned, 4=Diseased, 5=Insane, 6=InLove, 7=Drunk, 8=Asleep, 9=Depressed, 10=Confused, 11=Paralyzed, 12=Unconscious, 13=Dead, 14=Stoned, 15=Eradicated. Give Only: 16=Clear all conditions
0x13 Spell (1) Checks if the character class is capable of casting the given spell number, and gives or removes that spell if possible. See AllSpells for a list of spells, who can cast them, and their corresponding numbers. Will not grant a spell that cannot be cast by that class.
0x14 GameFlag (1) Sets/unsets the given game flag. See Game_bit.
0x15 Item (1) Gives the specified basic item number, or searches inventories until it finds and removes one. Halts further event execution if the item can not be given/removed because inventory is full or item does not exist.
0x16 --- UNUSED: This does nothing. Do Not use!
0x17 --- UNUSED: This does nothing. Do Not use!
0x18 --- UNUSED: This does nothing. Do Not use!
0x19 Minutes (2) Move forward or backward by the given number of minutes (Takes 2 bytes arguments, but only the first is used). Handles day/night transitions properly. Behaves opposite to expected. Take advances clock, give reverses clock.
0x1A --- UNUSED: This does nothing. Do Not use!
0x1B --- UNUSED: This does nothing. Do Not use!
0x1C --- UNUSED: This does nothing. Do Not use!
0x1D --- UNUSED: This does nothing. Do Not use!
0x1E --- UNUSED: This does nothing. Do Not use!
0x1F --- UNUSED: This does nothing. Do Not use!
0x20 --- UNUSED: This does nothing. Do Not use!
0x21 --- UNUSED: This does nothing. Do Not use!
0x22 Gold (4) Take/Give party gold (max 4,294,967,296). Take fails if there's not enough gold, displaying a "not enough" message, aborting further event execution.
0x23 Gems (2) Take/Give party gems (max 65,536). Take fails if there's not enough gems, displaying a "not enough" message, aborting further event execution.
0x24 --- UNUSED: This does nothing. Do Not use!
0x25 MightTmp Might Bonus (extra beyond base). Can be reduced below zero. Tops out at 255.
0x26 IntTmp Intelligence Bonus (extra beyond base). Can be reduced below zero. Tops out at 255.
0x27 PersTmp Personality Bonus (extra beyond base). Can be reduced below zero. Tops out at 255.
0x28 EndTmp Endurance Bonus (extra beyond base). Can be reduced below zero. Tops out at 255.
0x29 SpdTmp Speed Bonus (extra beyond base). Can be reduced below zero. Tops out at 255.
0x2A AccTmp Accuracy Bonus (extra beyond base). Can be reduced below zero. Tops out at 255.
0x2B LuckTmp Luck Bonus (extra beyond base). Can be reduced below zero. Tops out at 255.
0x2C --- UNUSED: This does nothing. Do Not use!
0x2D MightBase Might Base (before bonus). Tops out at 255.
0x2E IntBase Intelligence Base (before bonus). Tops out at 255.
0x2F PersBase Personality Base (before bonus). Tops out at 255.
0x30 EndBase Endurance Base (before bonus). Tops out at 255.
0x31 SpdBase Speed Bonus Base (before bonus). Tops out at 255.
0x32 AccBase Accuracy Base (before bonus). Tops out at 255.
0x33 LuckBase Luck Base (before bonus). Tops out at 255.
0x34 FireBase Fire Resistance Base (before bonus). Tops out at 255.
0x35 ElecBase Electricity Resistance Base (before bonus). Tops out at 255.
0x36 ColdBase Cold Resistance Base (before bonus). Tops out at 255.
0x37 PsnBase Poison Resistance Base (before bonus). Tops out at 255.
0x38 NrgBase Energy Resistance Base (before bonus). Tops out at 255.
0x39 MgcBase Magic Resistance Base (before bonus). Tops out at 255.
0x3A FireTmp Fire Resistance Bonus (extra beyond base). Tops out at 255.
0x3B ElecTmp Electricity Resistance Bonus (extra beyond base). Tops out at 255.
0x3C ColdTmp Cold Resistance Bonus (extra beyond base). Tops out at 255.
0x3D PsnTmp Poison Resistance Bonus (extra beyond base). Tops out at 255.
0x3E NrgTmp Energy Resistance Bonus (extra beyond base). Tops out at 255.
0x3F MgcTmp Magic Resistance Bonus (extra beyond base). Tops out at 255.
0x40 LevelBase Base level (before bonuses). Tops out at 255.
0x41 Food Party Food Amount. Take fails if there's not enough gold, displaying a "not enough" message, aborting further event execution.
0x42 --- Take: UNUSED. Give: Unknown. Seems to somehow create an item of some kind.
0x43 --- UNUSED: This does nothing. Do Not use!
0x44 --- UNUSED: This does nothing. Do Not use!
0x45 Levitate Reduces/increase levitate count.
0x46 Light Reduces/increase remaining light
0x47 PartyFire (1) Add/remove party fire resistance, as if set by Prot. from Elements spell.
0x48 PartyElec (1) Add/remove party electricity resistance, as if set by Prot. from Elements spell.
0x49 PartyCold (1) Add/remove party cold resistance, as if set by Prot. from Elements spell.
0x4A DayOfSorcery Add/remove levitate, light, walk on water spells, and party elemental resistances.
0x4B --- UNUSED: This does nothing. Do Not use!
0x4C Day Advance/subtract days. Wraps through years, as well. 100 days per year.
0x4D ACTmp Set Armor Class. Updates the ACTemp value. Can be reduce below zero.
0x4E xxx Take: UNUSED. Give: Set HP to HPMax. Takes 1 byte argument, but does not use it.
0x4F WizardEye Activate/deactivate Wizard Eye spell.
0x50 --- UNUSED: This does nothing. Do Not use!
0x51 xxx Take: UNUSED. Give: Set SP to SPMax. Takes 1 byte argument, but does not use it.
0x52 HP (1) Take: UNUSED. Give: GIVES damage (subtracts HP). Behaves exactly like Take HP (0x08) above.
0x53 --- UNUSED: This does nothing. Do Not use!
0x54 --- UNUSED: This does nothing. Do Not use!
0x55 Year Add/subtract from year. Resets year flags as if a year had actually passed.
0x56 --- UNUSED: This does nothing. Do Not use!
0x57 --- UNUSED: This does nothing. Do Not use!
0x58 --- UNUSED: This does nothing. Do Not use!
0x59 --- UNUSED: This does nothing. Do Not use!
0x5A --- UNUSED: This does nothing. Do Not use!
0x5B --- UNUSED: This does nothing. Do Not use!
0x5C --- UNUSED: This does nothing. Do Not use!
0x5D --- UNUSED: This does nothing. Do Not use!
0x5E WalkOnWater Activates/deactivates Walk On Water spell.
0x5F --- UNUSED: This does nothing. Do Not use!
0x60 --- UNUSED: This does nothing. Do Not use!
0x61 --- UNUSED: This does nothing. Do Not use!
0x62 --- UNUSED: This does nothing. Do Not use!
0x63 --- UNUSED: This does nothing. Do Not use!
0x64 Gold(4) Take: UNUSED. Give: Gives a random amount of gold between 1 and value. Takes 4 bytes argument, but only uses first two. (Max 65,536)
0x65 --- UNUSED: This does nothing. Do Not use!
0x66 --- UNUSED: This does nothing. Do Not use!
0x67 WorldFlag (1) Sets/unsets world flag See World_bit.
0x68 QuestFlag (1) Checks if the given quest flag is set. See Quest_bit.
0x69 --- UNUSED: This does nothing. Do Not use!
0x6A --- UNUSED: This does nothing. Do Not use!
0x6B InParty Unknown use. Appears to be incomplete. Uses the currently selected character, but does no sanity checks against it. Also references code blocks as data blocks. Probably not safe to use. DO NOT USE!


TODO: How does 0x42 work?

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.