I’m currently trying to make a VERY simple attack mechanic inspired by David Ratliffs “Armed”.
Although the code seems to compile fine i am getting this error:
*** Run-time problem P10: Since yourself is not allowed the property “damage dealt”, it is against the rules to try to use it.
Violence isn’t the answer to this one.
this is triggered by “me” trying to attack “me”, of course i would make a rule against that, but for testing purposes im leaving that out for now. I get the same error when i try to attack “trolls” or other “persons”.
My modified code of Ratliff’s “Armed” is here:
[code]A person has a number called melee. The melee of a person is usually 5.
Understand “Attack [something]” as attacking it. The attacking it action has a number called the damage dealt.
Setting action variables for an actor attacking something (called target):
if the target is a person begin;
now the damage dealt is a random number between 10 and the melee of the actor;
end if.
Carry out an actor attacking something (called the target):
if the target is a person begin;
decrease the present health of the target by the damage dealt;
if the target is not the player begin;
if the target is docile, now the target is hostile;
end if;
end if.
Report attacking something (called the target):
if the target is a person begin;
if the target is dead begin;
say “With some struggle you finally end the life of [the target].” instead;
end if;
say “You attack [The target]([The target][apostrophe]s health: [present health of the target])[line break]”;
end if.
After someone attacking something (called the target):
if the target is the player begin;
if the player is dead begin;
say “[The person asked] attacks you, and you drop to the ground, dead.”;
end the story saying “[We] [have] died.”;
end if;
end if;
continue the action.
Every turn (this is the fighting back rule):
repeat with madman running through people begin;
if madman is hostile begin;
if madman can see the player begin;
try madman attacking the player;
end if;
end if;
if madman is dead, now madman is docile;
end repeat.
[/code]
*edit: The forum post seems to ignore Tabs, so i dont really know how to show that