need help ' onUseItem '
need help ' onUseItem '
hi,
I'm trying to make a special item which create a teleporter when use it.
I tried and tried many different methods but I can't find how to...
I think I must use the onUseItem function in the defineObject but it don't works.... please help
I'm trying to make a special item which create a teleporter when use it.
I tried and tried many different methods but I can't find how to...
I think I must use the onUseItem function in the defineObject but it don't works.... please help
Re: need help ' onUseItem '
I think it should be something like:
onUseItem = function (self, champ)
party:setPosition(X, Y, F, L)
--where X and Y are the coordinates, F is facing, and L is the level.
return true
--return false if you don't want the item to be consumed after using it
end
EDIT: if it works it will be without the teleport graphical effects, if you want them I'll show you how to add them.
onUseItem = function (self, champ)
party:setPosition(X, Y, F, L)
--where X and Y are the coordinates, F is facing, and L is the level.
return true
--return false if you don't want the item to be consumed after using it
end
EDIT: if it works it will be without the teleport graphical effects, if you want them I'll show you how to add them.
Re: need help ' onUseItem '
setPosition does not press the pressure plate of the destination, and may have other side effects I don't know about, so make sure it works well enough for you. If it's not going to work you might need to spawn a teleporter and also spawn a short timer to later destroy the teleporter and destroy itself
Finished Dungeons - complete mods to play
Re: need help ' onUseItem '
I think setPosition is used for the teleport entity itself.
For the pressure plate that's not true, they will be pressed. But you''re right about the side effects (I know them well since I'm working on a co-op based dungeon and those problems gave me a lot of trouble at the beginning )
If a script with setPosition is used while falling or changing floor, it will glitch and teleport you up or down depends if you use them on stairs or while falling into a pit.
So if you are not confident, just do as Komag said.
For the pressure plate that's not true, they will be pressed. But you''re right about the side effects (I know them well since I'm working on a co-op based dungeon and those problems gave me a lot of trouble at the beginning )
If a script with setPosition is used while falling or changing floor, it will glitch and teleport you up or down depends if you use them on stairs or while falling into a pit.
So if you are not confident, just do as Komag said.
Re: need help ' onUseItem '
I could swear I recently tested setPosition onto a plate and it didn't get pressed until I first stepped off and then on again. Maybe I'm remembering wrong, or maybe there was some circumstance that affected it
Finished Dungeons - complete mods to play
Re: need help ' onUseItem '
Interesting, if there are some weird things regarding pressure plates I'd like to know it.
I bumped my head so hard to solve the stairs-pits glitch (I cannot figure out how to know when the party is changing level by falling/using stairs, so I had to do a walkaround)...
But I'm trying several times, there seems to be no problem regarding pressure plate, each time I'm swapping team, the plate is always pressed
I bumped my head so hard to solve the stairs-pits glitch (I cannot figure out how to know when the party is changing level by falling/using stairs, so I had to do a walkaround)...
But I'm trying several times, there seems to be no problem regarding pressure plate, each time I'm swapping team, the plate is always pressed
Re: need help ' onUseItem '
thanks for the answers, but my problem is not exactly how to spawn a teleporter or how to teleport the party...
The problem is more... more stupid I think....
I don't know how to make the onUseItem active.
I create an item like that :
But when I use it in game (right click) nothing at all happend....
The problem is more... more stupid I think....
I don't know how to make the onUseItem active.
I create an item like that :
Code: Select all
defineObject {
name = "chaos_staff",
class = "Item",
uiName = "Chaos staff",
model = "mod_assets/models/cs.fbx",
description = "The legendary Chaos staff. Only this staff can defeat the Dark Soul.",
gfxAtlas = "mod_assets/textures/cs.tga",
gfxIndex = 4,
weight = 6.66,
onUseItem = function(self, champion)
print ( "ok" )
playSound("consume_potion")
return true
end,
}
Re: need help ' onUseItem '
there shouldn't be a space after print and before the (
print("ok")
Also, you could try the party onUseItem version, and just require that the item.name be "chaos_staff" before it does the things
print("ok")
Also, you could try the party onUseItem version, and just require that the item.name be "chaos_staff" before it does the things
Finished Dungeons - complete mods to play
Re: need help ' onUseItem '
Try hudPrint instead. I think print only writes to the console?
Re: need help ' onUseItem '
That's ok, I found a solution
My chaos staff can create teleporters (which are not teleporters in fact, but I can't tell more)
Now I'm trying to create a timer by script (at the same time it creates a teleporter) to destroy this teleporter after few seconds...
hard brainworking......
My chaos staff can create teleporters (which are not teleporters in fact, but I can't tell more)
Now I'm trying to create a timer by script (at the same time it creates a teleporter) to destroy this teleporter after few seconds...
hard brainworking......