Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
First off, you need a corpse object - which may or may not be a subimage of a basic enemy, but lets assume corpses are a unique object.
Corpse:Create alarm[0]=room_speed*60
This sets alarm[0] to 60 seconds in length regardless of your room speed.
Corpse:Alarm[0]
decay=true
Step:
If decay=true image_alpha=min(image_alpha, image_alpha-.1)
if image_alpha <0 instance_destroy()
when your corpse expires it begins to fade out until it is eventually destroyed.
On either your player character, or a separate control module
On Collision with Corpse:
if keyboard_check_pressed(ord("E")) {
if other.decay=false script_lootdialog(other)
}
I'll assume you have some sort of looting dialoge, what this does is only checks for the pressing of E when you are in collision with a corpse, and returns the ID of the corpse to the argument list of script_lootdialog. This means that the inventory of corpse becomes available for the lootdialog. This also means if 2 or more corpses occupy the same space you'll only get the ID of the most recent one.
It also checks if your monster isn't in the process of decaying at the time.
Click and Drag for your script_lootdialog will be up to you, I don't work with mice so I never tried this.
The inventory of the corpse is created when they die. to create a specific corpse (such as a goblin corpse or a generic skeleton for a goblin monster), in your Goblin's DEATH routine you would do something like
bop = instance_create(x,y,corpse)
with(bop){
switch(other.rank){
case 0: if irandom(100) >= 75 item[1] = "$5";break
case 2:
if irandom(100)>=50 item[4]="Metal"
case 1:
item[3]="$10"
item[2]="Silver"
if irandom(100)>=50 item[1]="$25";break
}
}
What this does is loads the id of the corpse with a variety of loot based on rank. other.rank is used, because in a with statement the caller becomes the other. If rank is 0, low rank, your money is dropped and stopped. Case 2 (boss) is above case 1 without a break - this is a heirarchy. This means a boss is also an advanced enemy and would also have a chance at dropping the high rank (1) items.
This loads an array called item[x] with a variety of trinkets. Notice I load my array in reverse (4, 3, 2, 1) - this speeds up the math as arrays need to be restructured if you expand them, starting with 4 means you don't need to expand down.
Afterwards, your corpse will have items[0~whatever] set. in your script_lootdialoge you would scan for corpse.item[x] to find if anything is NON-ZERO and add it to your inventory. I made all my items "Strings", which may not be applicable - use best judgement.