Author Topic: WOW Help With Scripting, Please.  (Read 6829 times)

utkwes

  • Visitor
  • *
  • Posts: 13
  • SuperMarioRipoff-10% Development
    • ICQ Messenger - 150506923
    • MSN Messenger - a@utk.edu
    • AOL Instant Messenger - utkwes
    • View Profile
    • My Homepage
    • Email
WOW Help With Scripting, Please.
« on: 2006-04-12, 11:18:11 PM »
New to the forums and the SDK, I'm Wes, you'll probably see me a lot more...
Now that the formalities are out of the way...

I'm not new to scripting, I'm majoring in CompSci at UT@K but I can't grasp this "VisualBasic" as you call it.. lol
I'm trying to develop a Mario style side scroller for a class of mine and I like to think that I have gotten pretty far, but I definitely have a LONG LONG way to go.
Currently, I've got a fun, working level, but everything is held together by popsicle sticks.
I'm trying to stay away from VBS since I know nothing of it, but it seems inevitable.

I can't get XXXXXX working:
  • Double Jumps (Though not needed now, would be neat later on) (saw the other post, tried to copy/paste, no worky)
  • Shooting (saw the post, copy/paste = no worky)
  • Jump on Head enemies, run into = death/hurt
  • powerUps, downs (currently half-ass implemented with special functions, could use suggestions)
  • life status / game over start over level help (currently sequence of show text, teleport)
  • Other suggestions and spare code are MORE THAN WELCOME!
  • Interaction with non-moving sprites (ie Yoshi in the download, the interaction is sub-par [defined collision, other suggestion?] and you kind of get stuck in him with his message repeating... help?)

I have a DOWNLOAD of my current V0.0001b Game http://utkwes.googlepages.com/downloads
Try just playing it, and you'll see many problems, but still a pretty good first attempt.  The images are obviously grafted from the original game.  My psd's are even included in the DL.

Please feel free to give me suggestions (coding, special function implementation, etc, I figure you've all at least seen if not are in love with mario)
Thank you very much, awesome program Ben,
-Wes
« Last Edit: 2006-04-12, 11:24:16 PM by utkwes »
errrr... rtfm?
Things are impossible until they are not.

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: WOW Help With Scripting, Please.
« Reply #1 on: 2006-04-13, 07:37:39 AM »
 :o No way! We go to the same school!

As far as jumping on enemies, I've seen a Mario-style demo on the downloads page. From what I can gather, there was just a seperate sprite for the feet with the body sitting on top of it. As far as the rest of that, you'll just need to wait for the script masters to show up. That's not my department...

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: WOW Help With Scripting, Please.
« Reply #2 on: 2006-04-13, 07:13:03 PM »
I think you're going to have to be more specific if you want assistance.  What you're trying to do would require someone to write a full script for a working project in order to demonstrate how to do it without being provided with more of a starting point.  Few people have that kind of time to give to someone else's project.  Perhaps if you post small script blocks that you've tried and the specific results you got, someone could then tell you what needs to be changed or checked to try to fix it.

sam

  • Fanatic
  • ***
  • Posts: 303
  • This statement is false.
    • MSN Messenger - samlancashire@hotmail.com
    • View Profile
    • samlancashire.com
    • Email
Re: WOW Help With Scripting, Please.
« Reply #3 on: 2006-04-13, 10:05:51 PM »

I didn't download your project because I have dial-up but here are some suggestions:

For shooting: You need to have a sprite that has:
Initial Instance NOT checked,
Inert
Inertia=100
Then you need to use the scripting wizard.
Taken from the scripting wizard help.
Quote
To use the Scripting Wizard:
1. Select the "Firepower Wizard" tab
2. Select "Read Project..." from the File menu and locate your project's GDP
   file and load it.
3. For the Firepower Wizard:
   A. Click on a tab associated with the button you want to customize in the
      Firepower wizard.
   B. Select "Create sprite instance" or "Jump" to assign a function to the
      button, and fill in the required parameters.
   C. Repeat from step A for each button you want to customize.

For jumping on enemies: You can use one of two ways:
1)Two seperate sprites (like eric22222 said) or,
2)Have the player change to a different sprite when they push "up"

For 1) In the graphics editor: cut the feet off your sprite (hehe) and make each frame a new tile (see attached). Create a path on the map for the player, and a path right on top of it for the feet.
create a sprite for the player and a sprite for the feet (with different classes). Make sure both sprites have the same speed/inertia/gravity or the feet will "run away" or fall behind from the player sprite. Set up collisions for the player sprite and enemies (where the player dies or loses HP or whatever) and a collision for the feet and the enemy (where the enemy dies/whatever).

For 2) Have a player sprite and a jumping sprite.
On your map make a global function called "jump". It should be activated when the player presses the "up" arrow key (or whatever your jump button is). Make it so the player switches to the jump sprite.
Make a function called "land", make it so the player switches back to the normal sprite.
Make a tile category called ground. Include all the tiles that the player could land on when they hit solid tiles. Make a map interaction with "Initially" checked. It should be activated when the player touches a tile in the category "ground". It should activate the function "land".

If you go with the first way then there could be complicated stuff later on your game.
If you go with the second way, whenever the player lands they land in there left state (because when you switch to a new sprite it starts off at the left state of that sprite).
This way is used in the game Cinos ( gamedevprj.sf.net )

As for interaction with non-moving sprites: I would not even have sprites if they are not moving.Place a tile of the sprite on the map. Put a function over it in the map editor. Have the function display the message or whatever. Make sure you have "remove after use" checked. The function will only be able to display the message once though, then you will just pass by the tile.

Life Status: Not quite sure what you mean. If you mean HP then that's easy. Have an inventory item called HP with Max qty=100 initial qty=100. Have a function called lose HP. The function subtracts 5 hp each time it is activated. Have a collision between the player and the enemy that activates the function.

Hope this helps.

PS: If you know most of what I'm saying already then I'm sorry for sounding retarded. From your post it sounds like you're fairly new to SGDK.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: WOW Help With Scripting, Please.
« Reply #4 on: 2006-04-14, 05:39:45 AM »
Actually it should be possibly to use a "land" function without resetting the sprite to face left each time.  You just have to check two things:  1) Make sure the land function is set to "retain state" -- that means it will keep the sprite in the same state even though it's a different sprite,  2) Make sure the landed sprite has exactly the same number of states, and each state has the same number of frames as the jumping sprite.  If one of those is different, the "Retain State" option won't work.

sam

  • Fanatic
  • ***
  • Posts: 303
  • This statement is false.
    • MSN Messenger - samlancashire@hotmail.com
    • View Profile
    • samlancashire.com
    • Email
Re: WOW Help With Scripting, Please.
« Reply #5 on: 2006-04-14, 09:56:53 AM »
Oh cool that does work.
Then I guess that would be the best way to do jumping on enemies.

Bulbaboy

  • Regular
  • **
  • Posts: 36
    • View Profile
Re: WOW Help With Scripting, Please.
« Reply #6 on: 2006-04-14, 01:28:37 PM »
My guess as to why the two scripts you tried didn't work is that you forgot three crucial lines of code:

Code: [Select]
HostObj.SinkObjectEvents ProjectObj.GamePlayer, "Player"
HostObj.ConnectEventsNow()
ProjectObj.GamePlayer.Play 16

Those are required to make most games work, if I'm not mistaken (and it's only the first one that you might be able to replace, I think).  Stick those at the end of the file.

Aside from that, IMO, a good way to learn this kind of coding is just to figure out the very basics and then consult the documentation and whatever sample code is available.

utkwes

  • Visitor
  • *
  • Posts: 13
  • SuperMarioRipoff-10% Development
    • ICQ Messenger - 150506923
    • MSN Messenger - a@utk.edu
    • AOL Instant Messenger - utkwes
    • View Profile
    • My Homepage
    • Email
Re: WOW Help With Scripting, Please.
« Reply #7 on: 2006-04-15, 01:31:29 PM »
Wow, you guys have a lot of good suggestions and eveything helped me think about things alot.  I understand the feet/body sprite technique, but as for the 'jump' sprite what about contacting the enemy with the body while jumping?  Are you suggesting only creating the two sprites when jumping and having one sprite otherwise, and in that case, what about falling?

I don't really expect answers to those, they're just my random thoughts about how to fix this.  I think my game is coming along swell.  With some of the suggestions I've gotten, I should be able to move right along.  I'm got throwing fireballs haphazardly implemented.

Thanks to Sam for the in-depth help.

As far as the script writing expectations, I didn't think that you guys were gonna write anything for me, I was just looking for suggestions or if you had any sample code or if you could tell me what was wrong with my implementation of scripts in my game.  I have included those three lines in the script as I saw were necessary in another post and they were in the sample code, anyways.0

Thanks again,
Wes

PS eric22222: really? Weird.
errrr... rtfm?
Things are impossible until they are not.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: WOW Help With Scripting, Please.
« Reply #8 on: 2006-04-17, 06:12:45 AM »
The method of splitting the sprite to determine when the player is jumping on an emeny is kind of a hack in my opinion; just a way of going out of the way to implement this feature without script.  I think it's easier to do in script and then you don't have to worry about how to integrate it with making your sprite look different while jumping.  To handle the collision in script, create a "Sub Player_OnSpritesCollide(Name, ClsAIdx, ClsBIdx, ColDefIdx)" event handler and add code something like this:
Code: [Select]
If ColDefIdx = 0 Then ' Change 0 to the appropriate number
   With ProjectObj.GamePlayer
      If .PlayerSprite.rDef.rLayer.Sprite(ClsAIdx).Y < _
         .PlayerSprite.rDef.rLayer.Sprite(ClsBIdx).Y Then
         .ActivateFunction(.rMap.Specials("PlayerStomp"))
         .PlayerSprite.rDef.rLayer.RemoveSprite(ClsBIdx)
      Else
         .ActivateFunction(.rMap.Specials("PlayerHurt"))
      End If
   End With
End If

Define a collision definition between a player sprite and an enemy sprite where Class A is the player and Class B is the enemy.  That will force GameDev to check for collisions between these two classes of sprites.  The collision definition doesn't have to do anything; the script should handle the rest.  It will delete the enemy sprite if the top of the player sprite is higher than the top of the the enemy sprite (if you need to change that, it can easily be adjusted to, for example, require that the top of the player sprite be at least 4 pixels above the top of the enemy sprite).  It will also activate a function called "PlayerStomp" when the player kills an enemy by stomping on it, and activate a function called "PlayerHurt" if the player touches an enemy and should get hurt by it.

As usual I haven't tested this, but I think something along these lines would simplify the rest of your sprite designing so you don't have to split your sprite up.

tprime

  • Fanatic
  • ***
  • Posts: 395
    • View Profile
    • Email
Re: WOW Help With Scripting, Please.
« Reply #9 on: 2006-11-11, 10:06:17 PM »
I'm trying to develop a Mario style side scroller for a class of mine and I like to think that I have gotten pretty far, but I definitely have a LONG LONG way to go.

I tried to download that Mario game. But for some reason when I try to donwload it and extract it, it says there is no files. Do you know what the problem is? Are you able to help me Wes?