Duke4.net Forums: dropping sprites - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

dropping sprites

User is offline   11bush 

#1

Thanks again to the guys who helped me with a previous question related to this one (RPD Guy, and Trooper Dan.) I am trying to do a few things that leave sprites on the ground and I am having some trouble with it. I want my character to drop a clip on the ground after reloading the pistol as well as drop a sprite when using the medkit.

If anyone else is also so inclined I did the tutorial that made edible food and it got me thinking, if i could make a pickup of a pack of smokes I could make that give a health boost as well as add an animation lighting a smoke and then leaving a butt behind. I have the sprites made for that i just don't know how to implement it.

I have a lot more things I want to do but I am trying to slowly learn more about con editing and this forum has been a great help.

Thanks in advance for any help.
0

User is online   Danukem 

  • Duke Plus Developer

#2

The first thing you need to do is add the sprites you made to the game. Put them in an .art file or whatever method you want. Read the wiki and/or look at examples in mods of how content like that is added if you aren't sure. You should know how to use mapster well enough to browse through the game tiles and insert the tiles you added into a map to verify you added them to the game successfully. If you don't know how to do that, then stop what you are doing and learn mapster basics first.
0

User is offline   11bush 

#3

Thanks for the reply, I have all the sprites good to go, I created them and added them. I just want my character to drop a spent clip every time I reload. I have a fair bit of experience in mapping as well as making and adding sprites, coding is what I am really trying to improve at, and the tutorials available leave me with a lot of questions regarding what I actually want to accomplish.
0

User is online   Danukem 

  • Duke Plus Developer

#4

I would define a projectile for the clip, make it slow moving with 2 bounces and 0 damage, fire it from the player in the appropriate direction at the moment the clip is supposed to drop. Define it to spawn an actor that is the clip on the ground.
0

User is online   Danukem 

  • Duke Plus Developer

#5

I've got a few minutes and I'm not able to work on my projects at the moment, so I thought I would provide a few pointers.

To define a projectile, use this command: https://wiki.eduke32...efineprojectile

You can put it in your defs.con or in some other code location outside of any event or actor. The way it works is you start by defining on a tile, such as "define CLIP_PROJECTILE 6000", which would define your clip projectile as tile 6000. Use whatever tile has the art on it that you want to use.

Next, you want to set the WORKSLIKE on your projectile. You can click in to the workslike entry from the wiki page I linked above to learn more about that, but here's my suggestion:

defineprojectile CLIP_PROJECTILE PROJ_WORKSLIKE 4238


That will ensure that it moves at fixed velocity, bounces off of any sprite or wall that it hits, and does not aim at enemies.

Also:
defineprojectile CLIP_PROJECTILE PROJ_SPAWNS GROUNDCLIP


This assumes you have an actor already defined and coded as the GROUNDCLIP, which will sit on the ground and replace the falling clip.

Next:
defineprojectile CLIP_PROJECTILE PROJ_XREPEAT 32 // sets x size
defineprojectile CLIP_PROJECTILE PROJ_YREPEAT 32 // sets y size
defineprojectile CLIP_PROJECTILE PROJ_VEL 160 // a nice slow forward speed
defineprojectile CLIP_PROJECTILE PROJ_BOUNCES 2 // will bounce once, then come to rest on second contact
defineprojectile CLIP_PROJECTILE PROJ_EXTRA 0 // does zero damage if it hits something
defineprojectile CLIP_PROJECTILE PROJ_HITRADIUS 0 // no splash zone
defineprojectile CLIP_PROJECTILE PROJ_DROP -192 // will make it drop towards the ground after firing at a rate of 192


The numbers are just suggestions and you will need to adjust them as needed.

There's other things you can set, but that's enough for the functionality you need. I would recommend having a tumbling animation set in the .art file on the tile that the projectile is defined on. The next challenge is actually firing the projectile at the appropriate time, and giving it the correct height, directions, and vertical velocity.

Before getting to that, though, you want to verify that your projectile actually works at all. To test, find this code "actor APLAYER MAXPLAYERHEALTH" Go to the first line of the player code, and insert this:

ifcount 10 ifhitspace { shoot CLIP_PROJECTILE resetcount }


That will cause a stream of your clip projectile to fire from the player when you press the interact key. If you use F7 view mode in game, you can easily see the projectiles firing.
1

User is offline   11bush 

#6

Hey thanks a lot. Since I initially posted I did a ton of reading on the wiki and managed to get the medkit to drop when using a health pack as well as using defineprojectile to create a grenade launcher weapon that arcs and explodes on contact. Thanks again for all the help!

The one thing I have not been able to figure out is when to spawn it. I can make it spawn during an action but I can't find what the reload would be.

This post has been edited by 11bush: 26 October 2019 - 04:10 PM

0

User is online   Danukem 

  • Duke Plus Developer

#7

You could try this:

gamevar dropclip NO 1
gamevar angvar 0 0

actor APLAYER MAXPLAYERHEALTH PSTAND 0 0

ife dropclilp NO
  ife player[].reloading YES
    ife player[].curr_weapon PISTOL_WEAPON
{
    set dropclip YES
    ezshoot -512 CLIP_PROJECTILE
    getp[].ang angvar, sub angvar 512, seta[RETURN].ang angvar
}

ife dropclip YES
  ife player[].reloading NO
set dropclip NO


The idea is that dropclip is used as a flag for when the clip is dropped. It gets dropped the moment the player starts reloading, and when the reload is over the flag is reset. When you drop the clip, it's angle is changed to the player angle - 512 (90 degrees to the player's left).
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options