if (this.parent = game.pov) {
if (not game.pov.equipped = fists and not game.pov.equipped = null) {
msg ("You put away your " + game.pov.equipped.alias + " and draw your " + this.alias + ".")
}
else {
msg ("You draw your " + this.alias + ".")
}
game.pov.equipped = this
this.inventoryverbs = Split ("Look at;Drop;Unequip", ";")
game.pov.equippedstatus = "Wielding: " + this.alias
}
else {
msg ("You don't have it.")
} if (this.parent = game.pov) {
msg ("You put away your " + game.pov.equipped.alias + ".")
game.pov.equipped = fists
this.inventoryverbs = Split ("Look at;Drop;Equip", ";")
game.pov.equippedstatus = "Wielding: nothing"
}
else {
msg ("You don't have it.")
}as from what I've read, you're game seems to be really awesome!
actually, you want to have your actions (attack, equip, unequip, etc) be scripts (Script Attributes ARE your "Verbs"), so change them from "string" to "script". Then you add the whatever Scripts to them (exactly like a Verb). Otherwise, maybe you want to use the Commands (like how Chase's library works), in this case, you'd NOT add any of the action stuff as Script Attributes of/for/to your Object Types.
However, there's an issue with using Object Types, as their Attributes will be applied/added to many different weapon/monster Objects, which MEANS you have to use the 'this' special word, in place of the spot where you'd use the Object's name. if you're 'monster' Object Type scripting uses for example, 'orc.damage = 1", it'll work fine being applied to your 'orc' monster Object, but won't work being applied to your 'ogre' monster Object.
that's where the special 'this' comes in:
this.damage = 1
personally... if you got the time (which I don't think you do, as you're trying to get out your game), it'd be better to slowly learn combat, first making / understanding how to do the most simple type of combat, getting down how to do basic combat (simple damage, etc).
<object name="player">
<attr name="alias" type="string">Neonayon</attr>
<attr name="damage" type="int">100</attr>
<attr name="current_life" type="int">999</attr>
</object>
<object name="orc_1">
<inherit name="monster" />
<attr name="alias" type="string">orc</attr>
<attr name="damage" type="int">25</attr>
<attr name="current_life" type="int">250</attr>
</object>
<object name="ogre_1">
<inherit name="monster" />
<attr name="alias" type="string">ogre</attr>
<attr name="damage" type="int">50</attr>
<attr name="current_life" type="int">500</attr>
</object>
<type name="monster">
<attr name="dead" type="boolean">false</attr>
<attr name="attack" type="script">
if (this.dead) {
msg ("The " + this.alias + " is already dead, silly")
} else {
this.current_life = this.current_life - player.damage
msg ("You attack the " + this.alias + ", doing " + player.damage + " damage, leaving the " + this.alias + " with only " + this.current_life + " life left.")
if (this.current_life <= 0) {
this.dead = true
msg ("You killed the " + this.alias + "!")
} else {
player.current_life = player.current_life - this.damage
msg ("The " + this.alias + " attacks you, doing " + this.damage + " damage, leaving you with only " + player.current_life + " life left.")
if (player.current_life <= 0) {
msg ("You were killed by the " + this.alias +".")
msg ("GAME OVER")
finish
}
invoke (this.attack) // this will loop the 'attack' script, meaning that you and the monster will continue damaging each other, until one is dead.
}
}
</attr>
<attr name="displayverbs" type="simplestringlist">look;attack</attr>
</type>
<verb>
<property>attack</property>
<pattern>attack</pattern>
<defaultexpression>"You can't attack it"</defaultexpression>
</verb><object name="orc_1">
<attr name="alias" type="string">orc</attr>
<attr name="attack" type="script">
msg ("The " + orc_1.alias + " attacks you!")
</attr>
</object>
<object name="ogre_1">
<attr name="alias" type="string">ogre</attr>
<attr name="attack" type="script">
msg ("The " + ogre_1.alias + " attacks you!")
</attr>
</object>
<object name="troll_1">
<attr name="alias" type="string">troll</attr>
<attr name="attack" type="script">
msg ("The " + troll_1.alias + " attacks you!")
</attr>
</object><object name="orc_1">
<inherit name="monster" />
<attr name="alias" type="string">orc</attr>
</object>
<object name="ogre_1">
<inherit name="monster" />
<attr name="alias" type="string">ogre</attr>
</object>
<object name="troll_1">
<inherit name="monster" />
<attr name="alias" type="string">troll</attr>
</object>
<type name="monster">
<attr name="attack" type="script">
msg ("The " + this.alias + " attacks you!")
</attr>
</object><object name="player">
<attr name="equipped" type="object">fist</attr>
</object>
// I'm NOT giving the 'fist' Object the 'weapon' Object Type (and you don't want it to be drop'able, and you want it to always be on the player), because I don't want it to have the 'unequip' Script Attribute/Verb, as the 'fist' is your default weapon (weaponless: "naked weapon"), so you can always do some damage. Well, you could just have your player have a 'damage=1' Integer Attribute, and not even have a "fist" weapon, but by using a 'fist' weapon, it allows for more easily done complex combat features, if you wish to go there with your combat.
<object name="fist">
<attr name="parent" type="object">player</attr>
<attr name="damage" type="int">1</attr>
<attr name="equip" type="script">
if (this.parent = player and not player.equipped = this) {
msg ("You remove the " + player.equipped.alias + ", and put on the " + this.alias +".")
player.equipped = this
} else if (player.equipped = this) {
msg ("You're already wearing the " + this.alias + ".")
} else if (not this.parent = player) {
msg ("You can't equip the " + this.alias + " when it's not in your possession!")
} else {
msg ("You can't equip it for whatever the reason.")
}
</attr>
<attr name="displayverbs" type="simplestringlist">equip</attr>
</object>
<object name="sword">
<inherit name="weapon" />
<attr name="damage" type="int">50</attr>
</object>
<object name="axe">
<inherit name="weapon" />
<attr name="damage" type="int">100</attr>
</object>
<type name="weapon">
<attr name="equip" type="script">
if (this.parent = player and not player.equipped = this) {
msg ("You remove the " + player.equipped.alias + ", and put on the " + this.alias +".")
player.equipped = this
} else if (player.equipped = this) {
msg ("You're already wearing the " + this.alias + ".")
} else if (not this.parent = player) {
msg ("You can't equip the " + this.alias + " when it's not in your possession!")
} else {
msg ("You can't equip it for whatever the reason.")
}
</attr>
<attr name="unequip" type="script">
if (player.equipped = this) {
msg ("You remove the " + this.alias + ".")
player.equipped = fist
} else if (not player.equipped = this) {
msg ("You're already not wearing the " + this.alias + ".")
} else if (not this.parent = player) {
msg ("You can't unequip the " + this.alias + " when it's not in your possession! Houston, we got a coding logic bug/error/mistake problem!")
} else {
msg ("You can't unequip it for whatever the reason.")
}
</attr>
<attr name="displayverbs" type="simplestringlist">equip;unequip</attr>
<attr name="inventoryverbs" type="simplestringlist">equip;unequip</attr>
</type>
I too like jumping right into stuff too, hehe
I think your 'equip' and 'unequip' code will already work correctly for/with your 'weapon' Object Type, so go ahead and add them as Script Attributes to your 'weapon' Object Type
<attr name="pov" type="object">player</attr><inherit name="actor" />
<inherit name="playable" /><inherit name="actor" />
<inherit name="monster" /><attr name="parent" type="object">game.pov</attr>
<attr name="damage" type="int">1</attr>
<attr name="equip" type="script">
</attr><attr name="parent" type="object">orc</attr>
<attr name="damage" type="int">10</attr><inherit name="weapon" />
<attr name="damage" type="int">50</attr><inherit name="weapon" />
<attr name="damage" type="int">100</attr><attr name="parent" type="object">room</attr>
<attr name="changedequipped" type="script">
this.damage = this.equipped.damage
</attr><attr name="life" type="int">999</attr>
<attr name="equipped" type="object">unarmed</attr>
<attr name="changedlife" type="script">
if (this.life > 999) {
this.life = 999
} else if (this.life <= 0) {
msg ("You were killed or you've died.")
msg ("GAME OVER")
finish
}
</attr>
<attr name="statusattributes" type="simplestringdictionary">life = Life: !; equipped = Weapon: !; damage = Damage: !</attr><attr name="life" type="int">500</attr>
<attr name="equipped" type="object">club</attr>
<attr name="displayverbs" type="simplestringlist">attack;loot</attr>
<attr name="attack" type="script">
if (this.dead) {
msg ("The " + this.name + " is already dead, silly.")
} else {
this.life = this.life - game.pov.equipped.damage
msg ("You attack the " + this.name + " for " + game.pov.equipped.damage + " damage, leaving the " + this.name + " with only " + this.life + " life left.")
game.pov.life = game.pov.life - this.equpped.damage
msg ("The " + this.name + " attacks you for " + this.equipped.damage + " damage, leaving you with only " + game.pov.life + " life left.")
invoke (this.attack)
}
</attr>
<attr name="loot" type="script">
if (this.dead and not this.equipped = unarmed) {
this.equipped.parent = game.pov
msg ("You loot the corpse of the dead " + this.name + ", finding a " + this.equipped.name + ", which you take and store away in your inventory.")
this.equipped = unarmed
} else if (this.dead) {
msg ("You search the corpse of the dead " + this.name + ", but find nothing of value.")
} else {
msg ("The " + this.name + " is still alive, and it's not going to let you just take its weapon, silly.")
}
</attr>
<attr name="changedlife" type="script">
if (<this.life <= 0) {
this.dead = true
msg ("You killed the " + this.name + "!")
}
</attr><attr name="parent" type="object">room</attr>
<attr name="displayverbs" type="simplestringlist">take</attr>
<attr name="inventoryverbs" type="simplestringlist">drop;equip</attr>
<attr name="equip" type="script">
</attr>
<attr name="unequip" type="script">
</attr><verb>
<property>attack</property>
<pattern>attack</pattern>
<defaultexpression>"You can't attack that!"</defaultexpression>
</verb><verb>
<property>loot</property>
<pattern>loot</pattern>
<defaultexpression>"You can't loot that!"</defaultexpression>
</verb>