Jump to content
  • 0

R> Treasure Chests on Random Fields Event


bob9497

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   1
  • Joined:  02/01/16
  • Last Seen:  

Hey guys!
I am looking for a script that spawns treasure chests on random maps (fields) in an array that when these chests are killed, I can execute a script.

 

To be more specific:
The 5 chests would spawn in random maps at a set interval (hourly).

They would spawn on random fields (Not all on same field, but random fields).

There would be no maximum to the chests spawned.

 

Then:

When killed there would be an announcement that "XXXX Found a treasure chest!"

When killed the player would receive event ticket item.

 

All I need is a skeleton of the script... I can do the rest such as add to an array all the maps that would be possible, etc.

 

 

Thank you!

- Kindest Regards -
 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

-	script	hourly_treasure	-1,{
OnMinute00:
OnStart:
//= Add your announce here.
	for(.@i = 0; .@i < .spawn_count; .@i++){
		monster .map_list$[rand(getarraysize(.map_list$)],0,0,"Treasure Chest",.treasure_mob_id,1,strnpcinfo(0)+"OnTreasureKill";
	}
	end;
	
OnTreasureKill:
	announce "[ System ] : " + strcharinfo(0) + " has found a Treasure Chest.";
	getitem .reward_id,.reward_amount;
	end;
	
OnInit:
	.spawn_count = 5;
	.treasure_mob_id = 1001;
	.reward_id = 501;
	.reward_amount = 50;
	setarray .map_list$,"prontera","izlude","geffen";
	end;
}

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   1
  • Joined:  02/01/16
  • Last Seen:  

Hey!

Thank you for the help!

I modified the script a bit to get it to work.

There were a few errors, but it cleaned up VERY nicely and works like a CHAMP!

Thank you very very very much for your help!

Here is the code I used minus the map array and changed the prize id.

 

-    script    Treasure_Chest    -1,{
//Prize And Amount
OnInit:
set .Prize,501;
set .Amount,1;
set .spawn_count,5;
set .treasure_mob_id,1955;
//Map Array
setarray .map_list$,"ama_fild01";

Goto OnSpawnChests;
end;

//Chest Spawn Function
OnMinute00:
OnSpawnChests:
    for(.@i = 0; .@i < .spawn_count; .@i++){
        monster .map_list$[rand(getarraysize(.map_list$))],0,0,"Treasure Chest",.treasure_mob_id,1,"Treasure_Chest::OnTreasureChestKilled";
    }
announce "5 Treasure Chests Have Spawned in the Fields!", bc_all;
end;

//Function for when a box is killed
OnTreasureChestKilled:
announce ""+strcharinfo(0)+" has found a Treasure Chest!", bc_all;
getitem .Prize,.Amount; // Prize Drop
end;

}

 

Again!  Thank you!

Edited by bob9497
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...