Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ingumc

Pages: [1]
1
Script / Re: Scripting Woes!!
« on: 2006-02-26, 03:33:59 PM »
Here's what I'm trying to accomplish. There are seven patrolling enemies in the game, that will chase the player if he comes within a certain range. The only way to "reset hate" is to use an item that can be picked up in the level. When the item is used on the enemy by changing the player sprite to an item use animation and defining the collision definition from that (use item sprite colliding with enemy sprite), the enemy will switch from the regular patrolling one to a sprite that shows that the item affected him (stays at the position of the collision) for 3 seconds. After the time has passed, the enemy will revert back to the original sprite and return to his path.
My issue is how to know which one of the seven enemies the player used the item on. This is so that after the item effect has passed, I will still have all seven enemies patrolling all the seven paths. Hope that helps?  :)
If I use Player_OnSpritesCollide, how do I access the two sprites involved in the collision?

Thanks!

2
Script / Scripting Woes!!
« on: 2006-02-26, 05:49:18 AM »
Hi, it's my first time posting here. Hope everyone's doing well. I'm working on a game, and am having some trouble with the VBS script. What I'm trying to do is for the player to use an item on an enemy sprite, and the enemy sprite will switch to another sprite for like 3 seconds, and then switch back to its original sprite. Problem I'm having difficulty with is how to let the game know which sprite was affected by the item. In this case, there are multiple patrolling enemies, and the intention is to have the affected enemy sprite return to its original path after the effect of the item wears off.

The approach I took is to compare all the active sprites in the layer, find the missing enemy sprite by number and then spawn him at the trigger location. Another problem is deleting a sprite by definition name, maybe it's just syntax (hopefully). It's certainly easier to just kill an enemy instead of all this, but that's not the direction I want to take.

Please help!

Thanks...



*******This takes place when the special function (TimerBlinded) is run to raise an event as indicated in item 2 above

If objSpecial.Name = "TimerBlinded" Then

           'Stores the position of the blinded guard
           MaceX = ProjectObj.GamePlayer.TriggerX
           MaceY = ProjectObj.GamePlayer.TriggerY

           'Sets the flag to start the BlindTimer
           BlindFlag = 1
        End If


*******This is part of the main code

If BlindFlag = 1 Then

       'Starts the timer for the blinded effect
       BlindTimer = BlindTimer + 1

       'Checks the timer for the blinded effect to wear off
       If BlindTimer > 180 Then

          With ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer

          'Do loop to check which guard was blinded
          Do While (BlindFlag = 1)

             Dim nIdx, GuardNum

             'For loop to check the sprites in the layer to see which guard was blinded
             For GuardNum = 1 to 7

                'Checks each sprite in the layer and if a guard # is found, exit the For loop and go to the next guard
                For nIdx = 0 to .SpriteCount - 1

--------------------I think there's a syntax error for the sprite compare here---------------------------

                   If .Sprite(nIdx) Is .Sprite = ("Guard" & CStr(GuardNum)) Then
                      nIdx = 0
                      Exit For
                   End If

                   'If the guard # isn't found after checking all the sprites, that's the guard affected and exit the Do loop
                   If nIdx = .SpriteCount -1 Then
                      Exit Do
                   End If

                Next

             Next

          Loop

          End With

----------------------This section is working, I tested with a set sprite and it spawns at the proper location--------------------------

          Dim GuardCheck, GuardSprMace

          'Stores which guard was blinded
          GuardCheck = ("Guard" & Cstr(GuardNum))

          'Switches back to the original guard sprite
          With ProjectObj.GamePlayer
          Set GuardSprMace = ProjectObj.GamePlayer.rMap.SpriteDefs(GuardCheck).MakeInstance
              .PlayerSprite.rDef.rLayer.AddSprite HostObj.AsObject(GuardSprMace)
              GuardSprMace.X = MaceX
              GuardSprMace.Y = MaceY

-----------------------Something wrong here, I can't seem to delete the sprite by definition name---------------------

          .rMap.RemoveSpriteDef("Blinded")

          End With

          'Resets the Blind flag and timer
          BlindFlag = 0
          BlindTimer = 0
       End If
    End If

Pages: [1]