Var problem

Misdemonar
02 Feb 2009, 19:08
II have my var on my weapon, that when it's used on an object with the property "enemy" that it will decement the var "ehp" will decrease by the weapons "dmg", but when II use the weapon on the enemy, ehp does not go down, why?

Elexxorine
02 Feb 2009, 19:33
You need to describe what you've done in much more detail. It would be helpful if you post the game's asl, open the .asl file with a text editor and post it here or attach it to a post by clicking the 'upload attachment' below the box for typing in text when posting.

Misdemonar
02 Feb 2009, 23:12
For the weapon:
define object <Dual Revolvers>
look <Two eight chamberd revolvers.>
displaytype <Object>
article <it>
gender <it>
invisible
use on anything {
if property <#quest.use.object.name#; zombie> then {
msg <You attack a #quest.use.object.name# for %dmg%>
set numeric <zhp; #(quest.use.object.name):hitpoints#>
set numeric <zhp; %dmg%> }
}
properties <enemy>
action <equip> {
if flag <go> then msg <You cannot equip two guns.> else {
msg <You put on the Dual Revolvers.>
set <dmg; 2> }
flag on <go>
}
end define

end define



For the combat system
define room <test desert>
place <Choose Class>
script {
flag on <co>
set numeric <zombies; 0>
if here <zombie> then inc <zombies; 1>
if here <zombie2> then inc <zombies; 1>
}
afterturn {
if flag <co> and ( %zombies% = 1 ) then {
set <zhp; 5>
set <zdmg; 1>
msg <A zombie attacks you for %zdmg%>
dec <hp; %zdmg%>
if ( %zhp% <= 0 ) then {
msg <A zombie dies.>
dec <zombies; 1> } } else {
}
if ( %zombies% = 2 ) then {
set numeric <zhp; 10>
set numeric <zdmg; 2>
msg <2 Zombies attack you for %zdmg%>
dec <hp; %zdmg%>
if ( %zhp% <= 5 ) then {
msg <A zombie dies.>
dec <zombies; 1> } } else {
}
if ( %zombies% > 0 ) then msg <|cr There are %zombies% zombies here.>
}
type <new>

define object <zombie>
displaytype <Character>
article <him>
gender <he>
invisible
type <enemy>
properties <hitpoints=20; zombie>
action <hostile>
end define

define object <zombie2>
alias <zombie2>
displaytype <Character>
article <him>
gender <he>
invisible
type <enemy>
properties <hitpoints=20; enemy>
end define

end define

Thanatos
03 Feb 2009, 06:21
And by var I think he means Variable.

Elexxorine
03 Feb 2009, 12:27
define object <Dual Revolvers>
look <Two eight chamberd revolvers.>
displaytype <Object>
article <it>
gender <it>
invisible
use on anything {
if property <#quest.use.object.name#; enemy> then {
msg <You attack a #quest.use.object.name# for %dmg%>
set numeric <zhp; #(quest.use.object.name):hitpoints#>
dec <zhp; %dmg%>
property <#quest.use.object.name#; hitpoints=%zhp%>
}
}
properties <enemy>
action <equip> {
if flag <go> then msg <You cannot equip two guns.> else {
msg <You put on the Dual Revolvers.>
set <dmg; 2>
}
flag on <go>
}

end define
define room <test desert>
place <Choose Class>
afterturn {
for each object in <#quest.currentroom#> {
if property <#quest.thing#; enemy> then {
set numeric <enemyhp; #(quest.thing):hitpoints#>
if ( %enemyhp% > 0 ) then {
msg <$capfirst(#(quest.thing):alias#)$ attacks you for #(quest.thing):attack# damage.>
dec <hp; #(quest.thing):attack#>
}
else {
msg <$capfirst(#(quest.thing):alias#)$ dies.>
move <#quest.thing#; deadroom>
}
}
}
}
type <new>

define object <zombie>
displaytype <Character>
article <him>
gender <he>
invisible
type <enemy>
properties <hitpoints=20; enemy; attack=1>
action <hostile>
end define

define object <zombie2>
alias <zombie>
displaytype <Character>
article <him>
gender <he>
invisible
type <enemy>
properties <hitpoints=20; enemy; attack=1>
end define

end define
Here you go, cleaned it up, and made it work nice and smooth. Hope this helps, any more questions just ask.