ID:156676
 
Ok im just gonna post my how tos here so that i dont have to keep making a thread each time.

How to #1 Adding Weight
Ok how do i add weight to an item such as an iron dagger that weighs 3 pounds and then displays it along with the max weight (30lbs for example)

How to #2 Disabling movement
When you pick up to many items or are paralyzed by a spell you will not be able to move and a message will be sent to you


Well someone posted a message then deleted it so i cant comment on his code.

For weight id suggest you set up some variables inside your equip and unequip procs and have the mob have a maxweight var.

So each object has a weight and when they exceed it they cant move or w.e

mob/var/weight = 0
mob/var/canmove = 0

items
parent type = /obj //sets this so datums can be used. --http://www.byond.com/members/DreamMakers?command=view_post&post=35530--
Boogeyman
icon = 'pie.dmi'
icon_state ="chocolate"
weight = 5

mob/proc/equip(items/O)
src.weight += O.weight

mob/Move()
if(src.canmove)
return
else
..()
src.canmove = 1
if(src.weight >= 0 && src.weight <=20)
sleep(1) canmove = 0
if(src.weight >= 21 && src.weight <=50)
sleep(2) canmove = 0
if(src.weight >= 51 && src.weight <=100)
sleep(3) canmove = 0


meh i think i got that move thing right. prolly didnt though
You could use mob/Entered() and mob/Exited() to keep track of weight, but you'd have to remember to never set an items location directly.

obj/your_item_subtype/var/weight
mob
var/weight
var/max_weight=30

Entered(obj/your_item_subtype/item)
if(istype(item))
weight += item.weight

Exited(obj/your_item_subtype/item)
if(istype(item))
weight -= item.weight

Move()
if(weight<=max_weight)
..() // Calls the default move proc.

A formula for slowing might be nice too.
Ok thanks

How to #3 Stacking objects

How would i combine certain objects of the same type in my inventory such as arrows or gold

How to #4 stoping objects

How do i stop an arrow or magic from moving after a certain amount of spaces (20 spaces for example)
In response to Dusty99999
Make a amount var and name the obj "[name] x[amount] with the new proc". Add O.amount+=1 to get verb,etc.

look up the while proc.
var/distance=12
while(distance)
step
In response to RichardKW
Thanks
In response to Dusty99999
How To #5 Day and Night

How do i create day and night that switches every 12 min and displays a message


How to #6 Time Sensitive Events

How do i make it so a mob takes damage at certain times like a vampire in the sun
In response to Dusty99999
#5: Have a procedure defined that will change day to night and vice-versa every 12 minutes. Easy, no? Well, actually, it is that easy.

#6: Set up a procedure and call it when the day changes. You want to call it manually when the mob logs in as well!

world/New()  //  When the game starts
spawn(1)
Day_Night() // Spawn the procedure. Since this is called at /world/New(), it will be called once per runtime/restart.

var/day = 0 // 0 = night, 1 = day

proc/Day_Night()
for() // This is like while(1), an infinite loop
day = !day // Boolean trick. If day was 1, it is now 0 and vice versa
// For the following, the ? operator is like a mini-if(): X?Y:Z == if(X){Y}else{Z}
world << "It is now [day?"Day":"Night"]time!"
for(var/mob/M in world) // Loops through all /mobs
spawn() // So the procedure isn't halted due to M.DayEffect()
M.DayEffect() // Calls this procedure on a

sleep(12*60*10) // Delaying the loop for 12 minutes
// Assuming your world_tick is 1, that means sleep(1) delays for 1/10th of a second (aka 1 ds). 12 min * 60 s/min * 10 ds/s = Converts 12 min to ds
mob
proc
DayEffect()
if(day) // if day = 1 aka TRUE (boolean trick)
src.mood = "Awake"
else // if(!day), day = 0, aka FALSE
src.mood = "Sleepy"
// I could have done src.mood = day?"Awake":"Sleepy" but meh...
In response to GhostAnime
How to #8 Horses

how do i make it so that horses can be ridden and it increases speed and disables some all verbs except talk and get off
In response to Dusty99999
You need to get a start on things. Learn on your own, and present your ideas of how you feel you should program something with possibly a sample snippet. You shouldn't ask others to do all of the work for you! Else, you won't learn how to do work for yourself.

For a 'horse' to be ridden, you would simply delete the mob, add an horse underlay to the mob, and edit the 'set hidden' variable with verbs to show/hide them. For speed, you can just sleep(whatever) in move.
In response to OrangeWeapons
K thanks and im not asking others to do it im asking for examples of how others would do it