Getting hurt with passing time
Feluz
26 Nov 2018, 08:35Hi there, I'm quite new here. I'm looking for a way for a player to get hurt a bit every turn until he puts on a wearable item.
I'm working in the simple version of program btw. And I tried making a script using 'if', but I just can't get to it in any way.
hegemonkhan
26 Nov 2018, 09:14if you mean you're in/using the 'simple mode', then most of the features are disabled, as this is only a 'sandbox' mode for just playing with the most basic stuff of quest, so you may need to turn this off and/or create a new game with it selected/turned-off
see Turnscripts
these do their scripting every internal turn (typed in stuff into the text/command bar at the bottom and/or mouse clicks on hypertexts and/or the verb buttons)
when you put on the wearable item, in its scripting, you need to enable a turnscript, which you created and set up to do damage to you
a very quick simple (there's many different designs/methods, as your using the built-in wearables library stuff, so it'll be a bit more complex for you to implement it) example:
<asl version="550">
<game name="example">
</game>
<object name="room">
<inherit name="editor_room" />
<turnscript name="example_of_a_local_turnscript">
<!--
local turnscripts are contained within a Room Object, global turnscripts are NOT
-->
</turnscript>
</object>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="parent" type="object">room</attr>
<attr anme="weapon" type="object">unarmed</attr>
<attr name="current_life_integer_attribute" type="int">999</attr>
<statusattributes type="stringdictionary">
<item>
<key>current_life_integer_attribute</key>
<value>Current Life: !</value>
</item>
</statusattributes>
</object>
<object name="unarmed">
<inherit name="editor_object" />
</object>
<object name="cursed_sword">
<attr name="parent" type="object">room</attr>
<attr name="equip" type="script">
player.weapon = this
EnableTurnscript (poisoned_global_turnscript)
</attr>
<attr name="unequip" type="script">
player.weapon = unarmed
DisableTurnscript (poisoned_global_turnscript)
</attr>
</object>
<turnscript name="poisoned_global_turnscript">
<attr name="enabled" type="boolean">false</attr>
<script>
player.current_life_integer_attribute = player.current_life_integer_attribute - 50
</script>
</turnscript>
<verb>
<property>equip</property>
<pattern>equip</pattern>
<defaultexpression>You can't equip that!</defaultexpression>
</verb>
<verb>
<property>unequip</property>
<pattern>unequip</pattern>
<defaultexpression>You can't unequip that!</defaultexpression>
</verb>
</asl>

CheeseMyBaby
26 Nov 2018, 09:43If you have a health
attribute (for example) on the player object.
Put player.health = player.health - 1
and put that in a turnscript.
That way the player's health will drop 1 HP for every turn.
When you character wears the desired object, just disable the timescript.
(What HK said... just fewer words :))
Feluz
27 Nov 2018, 19:37Thank you Guys it really helped me :D