diesound enabled for items

ABK

Well-known member
I have one suggestion/request because i really dont like how "get.wav" sample is shared across every item or weapon you will pickup so i think this would be good way to solve the problem and have custom get sound for items, if you have diesound specified then it wouldnt use get.wav but this diesound.
If i want to pick items that give health and pickup weapons then engine will play get.wav unless i replace the sample with blank wav file but then i dont have any sound when picking up health items.Its simple stuff bit its a big problem and requires script workarounds but it could be solved much easier with diesound support for items.
 
Great idea, and shouldn't be that hard to implement. Will see what I can do.

DC
 
@bWWd

This is the work around I've been using in my mods,

- Rename bbox to 'itembox'
- (make sure to remove subtype touch)

- add didhitscript to play sfx.
Code:
void main()
{
  void self = getlocalvar("self");
  void opponent = getentityproperty(self, "opponent");
  int iSnd = loadsample("data/sfx/dswpnup.wav");
  
  playsample(iSnd, 0, openborvariant("effectvol"), openborvariant("effectvol"), 120, 0); //Get Item SFX
}

It works really well and I kinda prefer it this way now, Also you can add other code here anytime you need too.


Code:
itembox {x} {y} {right} {down}

~An item box which can hit bboxes. This can only be used by 'item' entities.
~{x}, {y}, {right}, and {down} work exactly like in a bbox.
~If another entity touches this itembox, the item will be picked up by that entity.
~The entity who can touch or pick this item is determined by 'candamage'. See 'candamage' above.
 
I know about script workarounds but using already builtin features would be easier.
What could also work is items that could spawn items when collected, similar like when you kill enemy and he has item  money or whatever then he would spawn money after getting killed.
If item would be able to spawn other item when collected by using "item" command in stage txt file then it would be even better to customize special effects like sparks after getting some kind of magic items instead of items just disappearing, that would also help to create different sound effects and customize items more in stage txt file instead of making copies of same items to get different effects.
Items cant spawn items when killed/collected now so maybe it could be enabled  so items could even spawn enemies when collected etc, i think all entities should be able to use "item" so engine would spawn that item when entity is killed or collected/removed.
---
I solved this problem by using attack with noreflect in item, then item goes to follow1 animation and in follow animation i can spawn or dowhatever i want so currently this works for me.I replaced get.wav by blank wav.
No need for script workarounds.Here is how it looks like:
Code:
name	gem
health  10
type	item
shadow	0
gfxshadow  1
subject_to_platform 1
subject_to_wall 1
subject_to_hole 0
subject_to_obstacle 1
subject_to_gravity 1
offscreenkill 1200
alternatepal  data/sprites/gem2.gif
alternatepal  data/sprites/gem3.gif
 facing  1











anim	follow1
	loop	1 2
	delay	1
	offset	37 104
	subentity	spark
	spawnframe	0 60 0 60
	frame	data/sprites/0.gif
	delay	3
	itembox	-93 -29 268 136
	frame	data/sprites/0.gif
	frame	data/sprites/0.gif
	frame	data/sprites/0.gif
		
anim	idle
	loop	1
	delay	10
	offset	37 104
	hitfx	data/sounds/gem.wav
	attack	24 9 23 97 0 0 0 1
	noreflect	1
	jumpframe	0 3 0
	followanim	1
	drawmethod	tintmode 1
	drawmethod	tintcolor 150_150_150
	frame	data/sprites/gem.gif
	frame	data/sprites/gem.gif
	nodrawmethod	
	frame	data/sprites/gem.gif

Only downside to this method is that players running fast enough wont be able to pick the item when its in follow1 animation so itembox in follow1 animation needs to be quite big.
 
I agree 100%, I prefer built in features too.

There was a discussion on this before, I think the problem was items need code to for death routines or something, then script like this would work to make the followup effects.

Code:
@script
    void self = getlocalvar("self");

   if (frame == 0){
      changeentityproperty(self, "velocity", 0, 0, 0);
      changeentityproperty(self, "speed", 0);
   }
	@end_script

This was Bloodbane's trick for making projectiles play follow anim when they hit something.
 
I think the problem was items need code to for death routines or something

I agree with this. If item could perform DEATH animation after it is picked, we could save ourselves some trouble from making workarounds like this
 
Back
Top Bottom