ID:158948
 
This is something for a game I've been working on for the past week. I'm having trouble with combat code and sentry spawning. This is what I have so far:

mob
RedSentry
name = "Red Sentry"
icon = 'Sentry.dmi'
Mhealth=100
density = 1

When player moves
If usr.team="Blue"
and they are 1-5 spaces in front of mob/RedSentry
trigger proc RedSentryAttack
else
Return()

mob
Engineer
Build Sentry()
If usr.Sentry=0
If usr is facing East
Set RedSentry_East
else
Set RedSentry_West
else
usr << "You already have a sentry."
Forgot to add in the following:

Repair – Engineer Only
When Engineer uses Wrench and they are using it on object RedSentry,
If Engineer = Red Engineer,
Add 10 HP to RedSentry
If Engineer’s Metal Bits is equal to or greater than 10,
Add 10 Bits to RedSentry.
Else
10 Damage to Red Sentry

Sentry
If RedSentry HP is greater than MaxHP, SentryHP=SentryMaxHP
If RedSentry EXP is greater than Level1MaxExp, set RedSentryLVL to 2.
If RedSentry EXP is greater than Level2MaxExp, set RedSentryLVL to 3.
If RedSentryLVL=2, set RedSentryIcon to RedSentry2
If RedSentryLVL=3, set RedSentryIcon to RedSentry3