| View previous topic :: View next topic |
| Author |
Message |
Chainsaw Lumberjack


Joined: 20 Oct 2007 Age: 15 Posts: 2378 Location: Israel
|
Posted: Tue Oct 23, 2007 3:25 am Post subject: |
|
|
I found it, i only now noticed it's called "parseerr" and not "parseerror".
Here's what is says:
| Code: | import/temp0004.obj/script.txt - BumpTarget undefined
|
Here's the script i put together for the hog, seems to be working as planned except the hog can damage enemies from a distance if it's facing them, and this might be the problem.
I tried changing DamageTarget to BumpTarget, or add range specifications i found in the script, still no luck.
Edited parts are red.
| Code: | // ZZ> This function makes the character wanders around its enemy
IfSpawned
MakeCrushValid
SetTargetToWhoeverIsHolding
IfTargetIsAPlayer
SetOwnerToTarget
JoinTargetTeam
MakeNameKnown
IfGrabbed
MakeCrushInvalid
IfNameIsKnown
SetTargetToWhoeverIsHolding
IfTargetIsAPlayer
SetOldTarget
SetTargetToOwner
IfTargetIsOldTarget
tmpargument = 5
Else
tmpargument = 6
SendMessageNear
Else
SetTargetToWhoeverIsHolding
IfTargetIsAPlayer
SetOwnerToTarget
JoinTargetTeam
MakeNameKnown
tmpargument = 3
SendMessageNear
tmpargument = 4
SendMessageNear
SetTargetToSelf
SetTargetToTargetLeftHand
DropItems
tmpargument = 16
SendMessageNear
IfDropped
SetTargetToSelf
StopTargetMovement
UnkeepAction
IfUsed
SetTargetToWhoeverIsHolding
tmpargument = 25
SetTargetReloadTime
IfTargetIsAPlayer
// =Cuddles=
SetTargetToSelf
tmpargument = 7
SendMessageNear
// Level
tmpx = targetlevel
tmpy = 2
IfXIsMoreThanY
tmpx = 2
tmpargument = 8 + tmpx
SendMessageNear
// Stats
tmpx = targetlife > 9
tmpy = 2
IfXIsMoreThanY
tmpx = 3
tmpargument = 11 + tmpx
tmpx = selfstr > 8
tmpy = selfwis > 8
SendMessageNear
// Stats
tmpx = selfint > 8
tmpy = selfdex > 8
tmpdistance = targetexp
tmpargument = 15
SendMessageNear
IfCrushed
tmpx = selfx
tmpy = selfy
tmpdistance = selfz
tmpargument = 4
SpawnExactParticle
SpawnExactParticle
SpawnExactParticle
SpawnExactParticle
GoPoof
tmpargument = 2
SendMessageNear
IfCleanedUp // Respawn
IfTargetIsAlive // Make sure killer is away
tmpx = 1100 //
tmpy = targetdistance //
IfXIsLessThanY //
RespawnCharacter //
Else // Killer is far away
RespawnCharacter //
IfKilled // This reduces the height of the char
IfNameIsKnown
SetOldTarget
SetTargetToOwner
IfTargetIsAlive
tmpargument = 0
SendMessageNear
SetTargetToOldTarget
Else
tmpargument = 1
SendMessageNear
tmpargument = 30 // Dead height
SetBumpHeight //
tmpargument = 5 // Sound
tmpdistance = rand & 2047 + 12000 //
PlaySound //
IfAttacked // Don't take kindly to attackers
SetTargetToWhoeverAttacked //
IfFacingTarget
IfTargetIsOnHatedTeam
tmpx = targetdistance
tmpy = 20
IfTargetIsAlive
tmpargument = rand & 512 + 256
tmpdistance = DAMAGEPOKE
BumpTarget //
//Damage on bump
IfBumped
SetTargetToWhoeverBumped
IfFacingTarget
IfTargetIsOnHatedTeam
IfTargetIsAlive
tmpargument = rand & 512 + 256
tmpdistance = DAMAGEPOKE
DamageTarget
//This deals 1-3 poke damage to the bumper
ClearWaypoints
AddWaypoint
IfTimeOut // This is done every so often
// Do clucking
GetContent
tmpx = tmpargument
tmpy = 0
IfXIsMoreThanY
tmpargument = tmpargument - 1
SetContent
tmpargument = rand & 3
tmpdistance = rand & 2047 + 10000
PlaySound
tmpargument = 12
Else
tmpx = rand & 15
tmpy = 7
IfXIsMoreThanY
tmpargument = tmpx > 1
SetContent
tmpargument = rand & 15 + 30
SetTime
IfHeld
// Don't bother moving around if held
GetState
Else
SetTargetToOwner
IfTargetIsSelf
tmpx = rand & 1023 - 512 + selfspawnx
tmpy = rand & 1023 - 512 + selfspawny
Else
SetTargetToNearbyEnemy
tmpx = targetdistance
tmpy = 150
IfXIsLessThanY
IfFacingTarget
// Attack the enemy...
tmpx = targetdistance
tmpy = 20
tmpargument = rand & 512 + 256
tmpdistance = DAMAGEPOKE
DamageTarget
// Play the sound
tmpargument = 6
tmpdistance = rand & 1023 + 8000
PlaySound
tmpx = targetx
tmpy = targety
tmpturn = targetturnto
tmpdistance = 200
Compass
Else
// Is it carrying something?
SetTargetToSelf
SetTargetToTargetLeftHand
// Has an item, so bring it to owner
tmpx = rand & 511 - 256 + ownerx
tmpy = rand & 511 - 256 + ownery
Else
// No item, so find one
tmpargument = [ABCD]
tmpdistance = BLAHITEMS
SetTargetToNearestBlahID
// Don't grab kursed items
IfTargetIsKursed
GetState
Else
// Get closer?
tmpx = targetdistance
tmpy = 20
IfXIsLessThanY
// Pick up the item
tmpargument = LATCHALTLEFT
PressLatchButton
tmpx = targetx
tmpy = targety
tmpturn = targetturnto
tmpdistance = 200
Compass
Else
// The item is bad, so follow the owner
tmpx = ownerx
tmpy = ownery
Else
// No items around, so follow owner
tmpx = ownerx
tmpy = ownery
ClearWaypoints //
AddWaypoint //
End // Finished with this character
|
|
|
| Back to top |
|
 |
Zefz Lead Designer


Joined: 16 Sep 2007 Posts: 2305 Location: Norway
|
Posted: Tue Oct 23, 2007 4:19 am Post subject: |
|
|
BumpTarget is not a script function. If you want your hog to move towards the enemy when he is attacked, it should look something like this:
| Code: |
IfAttacked
SetTargetToWhoeverAttacked
IfTargetIsOnHatedTeam
tmpx = targetdistance
tmpy = 400
IfXIsLessThanY
tmpx = targetx
tmpy = targety
tmpdistance = 75
ClearWaypoints
AddWaypoint
|
This will make the hog move towards the target so that he bumps it (And thus damages it). The hog will not charge enemies that are more than 400 distance away (Longranged or spells for example). _________________ http://egoboo.sourceforge.net
"The pen is mightier than the sword- IF it is sharpened, dipped in poison and thrown really really hard at your target. But seriously, you are better off with a sword." |
|
| Back to top |
|
 |
bgbirdsey Developer

Joined: 25 Sep 2007 Posts: 873 Location: Minnesota
|
Posted: Tue Oct 23, 2007 8:51 am Post subject: |
|
|
Here are a couple of suggestions
---- suggestion 1
I grabbed this from Brom's code. It is in the IfTimedOut section. This makes sure that he is closer than (in this case 200 units, which is about 1.5 tiles) from the target before he actually starts swinging.
| Code: |
tmpx = targetdistance // Close enough to attack?
tmpy = 200 //
IfXIsLessThanY //
tmpargument = LATCHRIGHT // Right Attack == 2
PressLatchButton //
|
I think you could make a new section IfAtLastWaypoint and put it there. Then, it would fire IMMEDIATELY when the hog gets within some nomber of units from the target waypoint (which you set to be the enemy location, previously).
---- suggestion 2
Also, you should change the waypoint calculation to be
| Code: |
tmpx = targetx + targetspeedx
tmpy = targety + targetspeedy
tmpdistance = 75
ClearWaypoints
AddWaypoint |
so that the hog is always pointed where it thinks the target is going to be next frame (i.e. the next time the script could possibly be evaluated). There is a calculation you could do to estimate the "best intercept", but math is a bit tricky in the scripts since everything is integer math and not floating point...
---- confusion 1
I don't know why bumping should necessarily damage the target? I think you should be able to cure that and force the hog to attack only when LATCHLEFT or LATCHRIGHT are being pressed. |
|
| Back to top |
|
 |
Maxaxle Elite Gamer


Joined: 06 Oct 2007 Age: 15 Posts: 2717 Location: San Diego
|
|
| Back to top |
|
 |
Zefz Lead Designer


Joined: 16 Sep 2007 Posts: 2305 Location: Norway
|
Posted: Tue Oct 23, 2007 9:55 pm Post subject: |
|
|
Grub bugs have to do damage trough bumping. They have no attack animation (And thus cannot use latches which means no damage).
| Code: |
tmpx = targetx + targetspeedx
tmpy = targety + targetspeedy
tmpdistance = 75
ClearWaypoints
AddWaypoint
|
Hey this was pretty smart... Thats kinda cool. Have to remember it for the next AI I script. _________________ http://egoboo.sourceforge.net
"The pen is mightier than the sword- IF it is sharpened, dipped in poison and thrown really really hard at your target. But seriously, you are better off with a sword." |
|
| Back to top |
|
 |
bgbirdsey Developer

Joined: 25 Sep 2007 Posts: 873 Location: Minnesota
|
Posted: Tue Oct 23, 2007 11:16 pm Post subject: |
|
|
I think that the velocity corrections may not be important, since that AI timeout is so relatively short (1 or 2 frames...) Even after the frame rate is stabilized, I think that the AI timeout should be quite a bit longer, like 4 per second, or so.
This is quite consistent with what will be possible on network play (peer-to-peer or client/server, though LAN could be a lot faster). It would be good to make sure the scripts are either "frame-rate-independent" or can work well with longer times between timeouts.
I think I am becoming a big fan of using character stats to drive the AI speed, as well. We will have to make sure that handling game events (i.e. commands like IfBumped) do not have any "thinking" attached to them, and all the thinking is done in IfTimedOut. That way, stupid NPCs would be sluggish while smart NPCs would make decisions faster.
Though acting on instinct is pretty fast, too... |
|
| Back to top |
|
 |
Maxaxle Elite Gamer


Joined: 06 Oct 2007 Age: 15 Posts: 2717 Location: San Diego
|
Posted: Wed Oct 24, 2007 2:12 am Post subject: |
|
|
| Zefz wrote: | Grub bugs have to do damage trough bumping. They have no attack animation (And thus cannot use latches which means no damage).
| Code: |
tmpx = targetx + targetspeedx
tmpy = targety + targetspeedy
tmpdistance = 75
ClearWaypoints
AddWaypoint
|
Hey this was pretty smart... Thats kinda cool. Have to remember it for the next AI I script. |
a Jousting monster?  _________________ http://www.freewebs.com/maxaxle88/
Inventor class last updated: July 9, 2008
Download: https://sourceforge.net/projects/maxaxlesegoboos
FREE PIZZA TOMORROW |
|
| Back to top |
|
 |
Zefz Lead Designer


Joined: 16 Sep 2007 Posts: 2305 Location: Norway
|
Posted: Wed Oct 24, 2007 10:17 am Post subject: |
|
|
I also use monsters stats more in their AI script.
Intelligent monsters pick the spellcaster/healer first.
Dexteritous monsters attack, move and react faster.
Wise monsters don't do stupid things so often.
Strong monsters... just hit harder
Oh and I think that there is also a function something like TargetWaypoint. _________________ http://egoboo.sourceforge.net
"The pen is mightier than the sword- IF it is sharpened, dipped in poison and thrown really really hard at your target. But seriously, you are better off with a sword." |
|
| Back to top |
|
 |
bgbirdsey Developer

Joined: 25 Sep 2007 Posts: 873 Location: Minnesota
|
Posted: Wed Oct 24, 2007 10:21 pm Post subject: |
|
|
OK. I haven't payed hardly any attention to the scripting language. Spending all my time on source code . Scripts are really important, though. Explains why arakon spent all that time converting the scripting system to lua for zippy.
I would really like to see egoboo go that way again, but without all the silly C-like extensions to lua. That made things waaaay to complicated and I spent a month trying to get their code compatible with c++ before giving up.
But scripts and the good MD2 modeling really are the heart of this game. |
|
| Back to top |
|
 |
Zefz Lead Designer


Joined: 16 Sep 2007 Posts: 2305 Location: Norway
|
Posted: Wed Oct 24, 2007 10:42 pm Post subject: |
|
|
I find the current scripts quite easy and understandable. You only need one document with the list of all script functions to understand what's going on (aidocs.txt). _________________ http://egoboo.sourceforge.net
"The pen is mightier than the sword- IF it is sharpened, dipped in poison and thrown really really hard at your target. But seriously, you are better off with a sword." |
|
| Back to top |
|
 |
Maxaxle Elite Gamer


Joined: 06 Oct 2007 Age: 15 Posts: 2717 Location: San Diego
|
|
| Back to top |
|
 |
Agent of Dread lolwut?? (Moderator)


Joined: 23 Sep 2007 Age: 11 Posts: 4347 Location: FACEPLANT
|
Posted: Thu Oct 25, 2007 6:18 am Post subject: |
|
|
Yes. But I can't be bothered referencing to it every five seconds.  _________________ FACEPLANT |
|
| Back to top |
|
 |
Zefz Lead Designer


Joined: 16 Sep 2007 Posts: 2305 Location: Norway
|
Posted: Thu Oct 25, 2007 9:27 am Post subject: |
|
|
You can have it open and then run a search whenever you need it. _________________ http://egoboo.sourceforge.net
"The pen is mightier than the sword- IF it is sharpened, dipped in poison and thrown really really hard at your target. But seriously, you are better off with a sword." |
|
| Back to top |
|
 |
Agent of Dread lolwut?? (Moderator)


Joined: 23 Sep 2007 Age: 11 Posts: 4347 Location: FACEPLANT
|
Posted: Thu Oct 25, 2007 10:01 am Post subject: |
|
|
I mean that I can't be bothered doing what you are saying. I'm a skin and stat kind of guy. _________________ FACEPLANT |
|
| Back to top |
|
 |
Maxaxle Elite Gamer


Joined: 06 Oct 2007 Age: 15 Posts: 2717 Location: San Diego
|
|
| Back to top |
|
 |
|