Jump to content

Checking Position of WorldObjects and changing them


GodofAlcohol

Recommended Posts

Hi,

I´ve got a problem with a portable Chair I´m working on.

So basically you should be able to take this Chair with you or sit down on it (choice by messageBox).

If you take it, it´ll create a "Chair Item" in your inventory. If you drop and then activate the item a chair is created.

 

I have problems positioning the Chair when it´s created (It´s always created into the ground). Is there a way to check the groundLevel and positioning the chair there?

Another problem is the Animation of the chair. If I choose to sit on it, the player just stands in front of the Chair and does nothing. I think this may be caused bad bad positioning, but even if I place the Chair right on the floor in a cell, the animation gets screwed.

 

These are my scripts:

scn DropCampingChair
ref myObject
float xp
float yp
float zp

begin OnActivate
set myObject to PlaceAtMe GoACampingChair01F 1 0 0
Disable
MarkForDelete
showmessage CampingChairReadyMessage 
myObject.disable
myObject.moveTo myObject 0 0 20
myObject.enable
set xp to myObject.getPos x
set yp to myObject.getPos y
set zp to Player.getPos z+20 

myObject.setPos x xp
myObject.setPos y yp
myObject.setPos z zp
myObject.setAngle x 0
myObject.setAngle y -0
end

scn TakeCampingChair

short ChairActive
short Button

begin OnActivate
showMessage ActivateCampingChairMessage
set ChairActive to 1	
end

begin GameMode
set Button to GetButtonPressed
if(ChairActive == 1 && Button == 1)
	Disable
	MarkForDelete
	player.addItem CampingChairItem 1
else if(ChairActive == 1 && Button == 0)	
		Activate
endif

set ChairActive to 0

end

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...