Aller au contenu

Photo

Buttons & Levers (For Floors and Walls)


  • Veuillez vous connecter pour répondre
257 réponses à ce sujet

#176
4760

4760
  • Members
  • 1 207 messages

Thanks!

Check out my lines of code above. Only three lines of easy code to get what we need. :) This is all you need with x0_i0_position as an include:-
 

float fAngle = GetFacing(OBJECT_SELF) - 12.0;	// POSITION CREATED RELATIVE TO SELF
float fAngle2 = GetFacing(OBJECT_SELF) - 90.0;	// ORIENTATION OF OBJECT CREATED
location lWhere = GenerateNewLocation(OBJECT_SELF, 3.0, fAngle, fAngle2);	
Cheers,
Lance.

 

 

OK, fAngle2 correspond to fFacing in my code, 3.0 is the distance between the pivot of the statue and the pivot of the weapon placeable (was 2.98 in my calculations), and I suppose then that -12.0° is the rotation to apply to the pivot of the weapon placeable (I had 76.75°, but counting counter-clockwise from the usual origin axis [West-East if you prefer] so -12 [or -13.25] is the same counting clockwise from the North-South axis).

 

True, that's nicer, but does it work with scaled statues? (I tried with 0.4,0.4,0.4 and 1.5,1.5,1.5 with my current code, and the axe was created closer or farther, as expected).



#177
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

OK, fAngle2 correspond to fFacing in my code, 3.0 is the distance between the pivot of the statue and the pivot of the weapon placeable (was 2.98 in my calculations), and I suppose then that -12.0° is the rotation to apply to the pivot of the weapon placeable (I had 76.75°, but counting counter-clockwise from the usual origin axis [West-East if you prefer] so -12 [or -13.25] is the same counting clockwise from the North-South axis).
 
True, that's nicer, but does it work with scaled statues? (I tried with 0.4,0.4,0.4 and 1.5,1.5,1.5 with my current code, and the axe was created closer or farther, as expected).


Hi Thierry,

This version does not work with "scaled statues", as the "axe dropped" would need to scale with the one that ends up "created on the floor" as well. And any scaled axe would not really be useable (beyond its original scale of 1), as it should be said to be either too big or too small to wield ... if you see what I mean ... unless magical of course.

That said, if we are not concerned about the scale of the one dropped compared to the one that ends up on the floor, then (that aside), I imagine it should be easy enough to scale the drop distance accordingly. I will check to see if that scaling the drop distance works (based on the rescaled statue).

Back in a few minutes. :)

EDIT: OK, this code works and drops an axe at the correct distance, but does not (yet) rescale the dropped axe created at the spot. It assumes the builder is using the correct aspect ratio for the statue.

I assume you can see where this would go ...
 
// ANY SCALE REFERENCE SHOULD DO IF KEEPING ASPECT RATIO (BASE ON DISTANCE OF 3.0)
float fDistance = GetScale(OBJECT_SELF, SCALE_X);
fDistance = fDistance * 3.0;
location lWhere = GenerateNewLocation(OBJECT_SELF, fDistance, fAngle, fAngle2);
Lance.

EDIT: OK, Here is the FULL version that scales the axe on the floor as well .... BUT, we cannot avoid the fact that the one picked up will actually be a real size weapon with a scale of 1,1,1, even though it is either bigger or smaller on the floor prior to being picked up:-

#include "x0_i0_position"

// CREATE THE PLACEABLE OBJECT HERE
void ActionCreateObject(string sPlaceResRef, location lWhere, float fScale);
void ActionCreateObject(string sPlaceResRef, location lWhere, float fScale)
{	
	object oDropped = CreateObject(OBJECT_TYPE_PLACEABLE, sPlaceResRef, lWhere);
	SetScale(oDropped, fScale, fScale, fScale);	
	
	PlaySound("it_metalbluntlrg", TRUE);
}

void main()
{      	
	int iDONE = GetLocalInt(OBJECT_SELF, "DONE");		
		
	// GET ITEM PLACEABLE CREATION DETAILS
	string sPlaceResRef = GetLocalString(OBJECT_SELF, "DropPlaceItem");	   
	
    if (!iDONE)
    {
		float fDuration = GetLocalFloat(OBJECT_SELF, "fDuration");		
		ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE, fDuration);
		
		if (sPlaceResRef != "")
		{
			// CALCULATE THE POSITION OF THE OBJECT FALL			
			float fAngle = GetFacing(OBJECT_SELF) - 12.0;	// POSITION CREATED RELATIVE TO SELF
			float fAngle2 = GetFacing(OBJECT_SELF) - 90.0;	// ORIENTATION OF OBJECT CREATED						
			
			//SendMessageToPC(GetFirstPC(),"ANG1> " + FloatToString(fAngle));
			//SendMessageToPC(GetFirstPC(),"ANG2> " + FloatToString(fAngle2));
			
			// ANY SCALE REFERENCE SHOULD DO IF KEEPING ASPECT RATIO (BASE ON DISTANCE OF 3.0)
			float fScale = GetScale(OBJECT_SELF, SCALE_X);
			float fDistance = fScale * 3.0;
			
			location lWhere = GenerateNewLocation(OBJECT_SELF, fDistance, fAngle, fAngle2);					
			DelayCommand(2.0, ActionCreateObject(sPlaceResRef, lWhere, fScale));
		}
	}
	
	// SET DONE
	SetLocalInt(OBJECT_SELF, "DONE", 1);
	SetUseableFlag(OBJECT_SELF, FALSE);
}


#178
4760

4760
  • Members
  • 1 207 messages

 

 

And any scaled axe would not really be useable (beyond its original scale of 1), as it should be said to be either too big or too small to wield

Actually, the placeable item would match the size of the statue, but of course the real weapon will be at scale 1. I was more thinking about the look of the area after the statue has been activated (bigger or smaller weapon, closer or farther from the statue, depending on the statue's size):

 

901-1-1400944769.jpg

 

901-2-1400944769.jpg

 

I know, it will only work before the axe is picked up (then it becomes a normal item, and loses all scaling), but there are short swords, longswords, great swords too in the stock items, so I guess it's better to be prepared.  ;)



#179
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Actually, the placeable item would match the size of the statue, but of course the real weapon will be at scale 1. I was more thinking about the look of the area after the statue has been activated (bigger or smaller weapon, closer or farther from the statue, depending on the statue's size):
 
I know, it will only work before the axe is picked up (then it becomes a normal item, and loses all scaling), but there are short swords, longswords, great swords too in the stock items, so I guess it's better to be prepared.  ;)


Hi Thierry,

In that case, *YES*, my last code *DOES* work as you wanted. :)

1) The weapon does drop at the correct distance.
2) The scale of the weapon on the floor is correctly matched with the one dropped. (Could tweak a little.)


Lance.

MY FULL CODE WITH REALTIME SCALING

#include "x0_i0_position"

// CREATE THE PLACEABLE OBJECT HERE
void ActionCreateObject(string sPlaceResRef, location lWhere, float fScale);
void ActionCreateObject(string sPlaceResRef, location lWhere, float fScale)
{	
	object oDropped = CreateObject(OBJECT_TYPE_PLACEABLE, sPlaceResRef, lWhere);
	
	// REALTIME SCALING
	float fScaleX = GetScale(oDropped, SCALE_X) * fScale;
	float fScaleY = GetScale(oDropped, SCALE_Y) * fScale;
	
	SetScale(oDropped, fScaleX, fScaleY, 1.0);	
	
	PlaySound("it_metalbluntlrg", TRUE);
}

void main()
{      	
	int iDONE = GetLocalInt(OBJECT_SELF, "DONE");		
		
	// GET ITEM PLACEABLE CREATION DETAILS
	string sPlaceResRef = GetLocalString(OBJECT_SELF, "DropPlaceItem");	   
	
    if (!iDONE)
    {
		float fDuration = GetLocalFloat(OBJECT_SELF, "fDuration");		
		ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE, fDuration);
		
		if (sPlaceResRef != "")
		{
			// CALCULATE THE POSITION OF THE OBJECT FALL			
			float fAngle = GetFacing(OBJECT_SELF) - 12.0;	// POSITION CREATED RELATIVE TO SELF
			float fAngle2 = GetFacing(OBJECT_SELF) - 90.0;	// ORIENTATION OF OBJECT CREATED						
			
			//SendMessageToPC(GetFirstPC(),"ANG1> " + FloatToString(fAngle));
			//SendMessageToPC(GetFirstPC(),"ANG2> " + FloatToString(fAngle2));
			
			// ANY SCALE REFERENCE SHOULD DO IF KEEPING ASPECT RATIO (BASE ON DISTANCE OF 3.0)
			float fScale = GetScale(OBJECT_SELF, SCALE_X);
			float fDistance = fScale * 3.0;
			
			location lWhere = GenerateNewLocation(OBJECT_SELF, fDistance, fAngle, fAngle2);					
			DelayCommand(2.0, ActionCreateObject(sPlaceResRef, lWhere, fScale));
		}
	}
	
	// SET DONE
	SetLocalInt(OBJECT_SELF, "DONE", 1);
	SetUseableFlag(OBJECT_SELF, FALSE);
}


#180
4760

4760
  • Members
  • 1 207 messages

So, I'd better look at the includes instead of doing some trigonometry! But that was nice to know I didn't forget.  :D

 

If you want to test the other statues while I'm finishing the normal textures (glow textures are done, at last!), check this out (I also included the blueprints, so you have the values for distance, heading, etc... for the various statues).



#181
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

So, I'd better look at the includes instead of doing some trigonometry! But that was nice to know I didn't forget.  :D


Hi Thierry,

Yes, I recall some trig myself. :D However, I find circular calculations (especially in NWN) turn me in circles (pun intended ;)) and prefer to let the main functions do the hard part of the work now ... and tweak them to my needs.

EDIT: Just noticed your edit. Will download and check out now. Thanks!

Cheers,
Lance.

#182
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

So, I'd better look at the includes instead of doing some trigonometry! But that was nice to know I didn't forget.  :D
 
If you want to test the other statues while I'm finishing the normal textures (glow textures are done, at last!), check this out (I also included the blueprints, so you have the values for distance, heading, etc... for the various statues).


Can you copy your new 2da lines for the new statues to this forum thread for me to update my own placeables.2da. :)

By the way, I am looking at your script, and I think I can make a few adjustments/assumptions about the code that I can alter for you .... just for you to see if it works for you as well. i.e. I will write a version of your script (which accounts for people not having Kivinen pack) as well as those that do. When I am done, take a look and see what you think. If you get the 2da lines to me in time, I will also check it my end prior to posting a copy here.

Cheers,
Lance.

#183
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi Thierry,

OK, I looked at your script and I think this will work fine.

All you need to do, is specify the ResRef in "DropPlaceItem" on the placeable statue, which can be either a Kivinen placeable item ResRef or simply the ResRef of an item (if you don't have Kivinen system). The script will determine what the ResRef refers to.

The script is untested, but I will test it on the other statues once I have your 2da lines. :)

Cheers,
Lance.

//::///////////////////////////////////////////////
//:: OnUse: activates the placeable, and sets a flag to prevent further uses
//:: plc_only_use_once
//:: Copyright (c) 2014 4760.
//:://////////////////////////////////////////////
/*

    Simple script to run the Activate animation of a placeable that supports it

    Placeables that are running this script will remain in their activated state after execution.

*/
//:://////////////////////////////////////////////
//:: Created By: Thierry Petitjean
//:: Created On: 29/04/2014
//:://////////////////////////////////////////////
// REWRITE BY LANCE BOTELLE.

#include "x0_i0_position"

// CREATE THE NEW PLACEABLE ITEM AND RESCALE TO ANY STATUE RESCALE
void ActionCreateObject(string sPlaceResRef, location lWhere, float fScale);
void ActionCreateObject(string sPlaceResRef, location lWhere, float fScale)
{
	object oWeapon = CreateObject(OBJECT_TYPE_PLACEABLE, sPlaceResRef, lWhere);
	
	// MAKE SURE OBJECT HAS BEEN CREATED, ELSE CREATE AN ITEM INSTEAD
	if(oWeapon == OBJECT_INVALID)
	{
		oWeapon = CreateObject(OBJECT_TYPE_ITEM, sPlaceResRef, lWhere);			
		return;
	}
	
	// OBJECT SCALING (ASSUMES ORIGINAL CORRECT ASPECT RATIO)
	float fScaleX = GetScale(oWeapon, SCALE_X) * fScale;
	float fScaleY = GetScale(oWeapon, SCALE_Y) * fScale;	
	SetScale(oWeapon, fScaleX, fScaleY, 1.0);	
	
	SetLocalString(oWeapon, "item_resref", sPlaceResRef);	
}

void main()
{
	// ACTIVATED ELSEWHERE	
	if (GetLocalInt(OBJECT_SELF, "IS_ACTIVATED_BY_OTHER_PLC") != 0)
	{
		string sMessage = (GetGlobalInt("nLangue")==0?"Nothing happens. There must be another way...":"Rien ne se passe. Il doit y avoir une autre méthode");
		SendMessageToPC(GetFirstPC(FALSE), sMessage);
		return;
	}
	
	// ONLY HAPPENS ONCE
	if(GetLocalInt(OBJECT_SELF, "DONE") == 1){return;}
		
	// PLAY ANY ASSOCIATED ANIMATION
	float fDuration = GetLocalFloat(OBJECT_SELF, "fDuration");		
	if(fDuration == 0.0){fDuration = 1.0;}
	ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE, fDuration);
	
	// ANYTHING BEING CREATED? (NB: CAN BE ITEM RESREF IF NOT A PLACEABLE ONE)
	string sPlaceResRef = GetLocalString(OBJECT_SELF, "DropPlaceItem");	
	
	if (sPlaceResRef != "")
	{
		// CALCULATE THE POSITION OF THE OBJECT FALL			
		float fAngle = GetFacing(OBJECT_SELF) - 12.0;	// POSITION CREATED RELATIVE TO SELF
		float fAngle2 = GetFacing(OBJECT_SELF) - 90.0;	// ORIENTATION OF OBJECT CREATED
		
		// ANY SCALE REFERENCE SHOULD DO IF KEEPING ASPECT RATIO (BASE ON DISTANCE OF 3.0)
		float fScale = GetScale(OBJECT_SELF, SCALE_X);
		float fDistance = fScale * 3.0;
		
		location lWhere = GenerateNewLocation(OBJECT_SELF, fDistance, fAngle, fAngle2);					
		DelayCommand(2.0, ActionCreateObject(sPlaceResRef, lWhere, fScale));
	}	
	
	// SET AS DONE
	SetLocalInt(OBJECT_SELF, "DONE", 1);
	SetUseableFlag(OBJECT_SELF, FALSE);
}


#184
4760

4760
  • Members
  • 1 207 messages

Hi Lance,

 

Here are the lines you need:

 

6044 Statue,(get_bow) **** 2 0 PLC_STATUE_BOW **** 0 PLC_STATUE_BOW PLC_STATUE_BOW_01 **** **** 0 RESERVED **** **** **** **** **** **** **** **** **** **** 0 ****

6045 Statue(bow) **** 0 0 PLC_MC_STATUE_BOW **** 0 **** **** **** **** 0 RESERVED **** **** **** **** **** **** **** **** **** **** 0 ****
6046 Statue,(get_sword) **** 2 0 PLC_STATUE_SWD **** 0 PLC_STATUE_SWD PLC_STATUE_SWD_?? **** **** 0 RESERVED **** **** **** **** **** **** **** **** **** **** 0 ****
6047 Statue(sword) **** 0 0 PLC_MC_STATUE_SWD **** 0 **** **** **** **** 0 RESERVED **** **** **** **** **** **** **** **** **** **** 0 ****

 

(get_weapon) is the active part, (weapon) is the main body, which you'd probably need to place first.

 

Back in a few minutes, time to test your script.  ;)



#185
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Hi Lance,
 
Here are the lines you need:
 
(get_weapon) is the active part, (weapon) is the main body, which you'd probably need to place first.
 
Back in a few minutes, time to test your script.  ;)


Hi Thierry,

Thanks for these lines info.

I tested the script on these myself and discovered the "facing setting" is obviously off for these models by 180 degrees by the looks of it. i.e. They work, except that the weapons drop behind instead of in front.

I can adjust the code easily enough to accommodate these two statues, but is it a case that your "model" information needs correcting? ... i.e. Is there a "North" setting that models should have that the script functions work with? If this is the case, then it may be that you simply need to update this "North" info in your model information ... if you see what I mean?

EDIT: Or, the original statue needs changing to meet these ones? And then I can write script accordingly.


EDIT 2: Actually, I see that the model info is not standard due to the whereabouts the objects fall. Therefore, it would be easier to simply add "tweaks" to the code according to the statue it is operating on. I will play around with some tweaks and let you have the new script based on the models as they are.

EDIT 3: WHAT ABOUT THE SHIELD? :o Perhaps I can look at adding a shield via code too .... I'll come back to you. (I will assume just a basic "large" shield for now.) OK, I added a basic large round shield to drop as a placeable item for those with the item placeable add-on. NOTE: It is always the same shield for this code, but is easy enough to make different by adding a second variable holder to your statue placeable button and refer to that ResRes instead if need be.
 
And all works when placeables scaled too!

Cheers,
Lance.

EDIT:

DONE IT! HERE IS THE TWEAK CODE PART:-
 
if (sPlaceResRef != "")
	{
		// SPECIFIC STATUE TWEAKS
		string sResRef = GetResRef(OBJECT_SELF);		
		float fDistanceTweak = 3.0; float fAngleTweak = 0.0; float fAngle2Tweak = 90.0; float fScaleTweak = 1.0; 
		
		// SWORD STATUE TWEAKS
		if(sResRef == "plc_statue_swd"){fDistanceTweak = 1.5; fAngleTweak = 175.0; fAngle2Tweak = 270.0; fScaleTweak = 2.0;}
		// BOW STATUE TWEAKS
		if(sResRef == "plc_statue_bow"){fDistanceTweak = 0.8; fAngleTweak = 260.0; fAngle2Tweak = 280.0; fScaleTweak = 1.5;}
	
		// CALCULATE THE POSITION OF THE OBJECT FALL			
		float fAngle = GetFacing(OBJECT_SELF) - 12.0 - fAngleTweak;		// POSITION CREATED RELATIVE TO SELF
		float fAngle2 = GetFacing(OBJECT_SELF) - fAngle2Tweak;			// ORIENTATION OF OBJECT CREATED
		
		// ANY SCALE REFERENCE SHOULD DO IF KEEPING ASPECT RATIO (BASE ON DISTANCE OF 3.0)
		float fScale = GetScale(OBJECT_SELF, SCALE_X) * fScaleTweak;
		float fDistance = fScale * fDistanceTweak;
		
		location lWhere = GenerateNewLocation(OBJECT_SELF, fDistance, fAngle, fAngle2);					
		DelayCommand(2.0, ActionCreateObject(sPlaceResRef, lWhere, fScale));
	}	
OR, HERE IT IS IN YOUR CODE FORMAT:-

JUST MAKE SURE YOUR STATUE RESREFS ARE CORRECT! ;) NOW WITH SHIELD DROP!

And all works when placeables scaled too!
 
//::///////////////////////////////////////////////
//:: OnUse: activates the placeable, and sets a flag to prevent further uses
//:: plc_only_use_once
//:: Copyright (c) 2014 4760.
//:://////////////////////////////////////////////
/*

    Simple script to run the Activate animation of a placeable that supports it

    Placeables that are running this script will remain in their activated state after execution.

*/
//:://////////////////////////////////////////////
//:: Created By: Thierry Petitjean
//:: Created On: 29/04/2014
//:://////////////////////////////////////////////
// REWRITE BY LANCE BOTELLE.

#include "x0_i0_position"

// CREATE THE NEW PLACEABLE ITEM AND RESCALE TO ANY STATUE RESCALE
void ActionCreateObject(string sPlaceResRef, location lWhere, float fScale);
void ActionCreateObject(string sPlaceResRef, location lWhere, float fScale)
{
	object oWeapon = CreateObject(OBJECT_TYPE_PLACEABLE, sPlaceResRef, lWhere);
	
	// MAKE SURE OBJECT HAS BEEN CREATED, ELSE CREATE AN ITEM INSTEAD
	if(oWeapon == OBJECT_INVALID)
	{
		oWeapon = CreateObject(OBJECT_TYPE_ITEM, sPlaceResRef, lWhere);			
		return;
	}
	
	// OBJECT SCALING (ASSUMES ORIGINAL CORRECT ASPECT RATIO)
	float fScaleX = GetScale(oWeapon, SCALE_X) * fScale;
	float fScaleY = GetScale(oWeapon, SCALE_Y) * fScale;	
	SetScale(oWeapon, fScaleX, fScaleY, 1.0);	
	
	SetLocalString(oWeapon, "item_resref", sPlaceResRef);	
}

void main()
{
	// ACTIVATED ELSEWHERE	
	if (GetLocalInt(OBJECT_SELF, "IS_ACTIVATED_BY_OTHER_PLC") != 0)
	{
		string sMessage = (GetGlobalInt("nLangue")==0?"Nothing happens. There must be another way...":"Rien ne se passe. Il doit y avoir une autre méthode");
		SendMessageToPC(GetFirstPC(FALSE), sMessage);
		return;
	}
	
	// ONLY HAPPENS ONCE
	if(GetLocalInt(OBJECT_SELF, "DONE") == 1){return;}
		
	// PLAY ANY ASSOCIATED ANIMATION
	float fDuration = GetLocalFloat(OBJECT_SELF, "fDuration");		
	if(fDuration == 0.0){fDuration = 1.0;}
	ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE, fDuration);
	
	// ANYTHING BEING CREATED? (NB: CAN BE ITEM RESREF IF NOT A PLACEABLE ONE)
	string sPlaceResRef = GetLocalString(OBJECT_SELF, "DropPlaceItem");	
	
	if (sPlaceResRef != "")
	{
		// SPECIFIC STATUE TWEAKS
		string sResRef = GetResRef(OBJECT_SELF);		
		float fDistanceTweak = 3.0; float fAngleTweak = 0.0; float fAngle2Tweak = 90.0; float fScaleTweak = 1.0; 
		
		// SWORD STATUE TWEAKS
		if(sResRef == "plc_statue_swd"){fDistanceTweak = 1.5; fAngleTweak = 175.0; fAngle2Tweak = 270.0; fScaleTweak = 2.0;}
		// BOW STATUE TWEAKS
		if(sResRef == "plc_statue_bow"){fDistanceTweak = 0.8; fAngleTweak = 260.0; fAngle2Tweak = 280.0; fScaleTweak = 1.5;}
	
		// CALCULATE THE POSITION OF THE OBJECT FALL			
		float fAngle = GetFacing(OBJECT_SELF) - 12.0 - fAngleTweak;		// POSITION CREATED RELATIVE TO SELF
		float fAngle2 = GetFacing(OBJECT_SELF) - fAngle2Tweak;			// ORIENTATION OF OBJECT CREATED
		
		// ANY SCALE REFERENCE SHOULD DO IF KEEPING ASPECT RATIO (BASE ON DISTANCE OF 3.0)
		float fScale = GetScale(OBJECT_SELF, SCALE_X) * fScaleTweak;
		float fDistance = fScale * fDistanceTweak;
		
		location lWhere = GenerateNewLocation(OBJECT_SELF, fDistance, fAngle, fAngle2);					
		DelayCommand(2.0, ActionCreateObject(sPlaceResRef, lWhere, fScale));

// SWORD STATUE ALSO DROPS A SHIELD
		if(sResRef == "plc_statue_swd")
		{			
			fDistanceTweak = 0.8; fAngleTweak = 115.0; fAngle2Tweak = 270.0; fScaleTweak = 2.0;			
		
			// CALCULATE THE POSITION OF THE OBJECT FALL			
			float fAngle = GetFacing(OBJECT_SELF) - 12.0 - fAngleTweak;		// POSITION CREATED RELATIVE TO SELF
			float fAngle2 = GetFacing(OBJECT_SELF) - fAngle2Tweak;			// ORIENTATION OF OBJECT CREATED
			
			// ANY SCALE REFERENCE SHOULD DO IF KEEPING ASPECT RATIO (BASE ON DISTANCE OF 3.0)
			float fScale = GetScale(OBJECT_SELF, SCALE_X) * fScaleTweak;
			float fDistance = fScale * fDistanceTweak;
			
			location lWhere = GenerateNewLocation(OBJECT_SELF, fDistance, fAngle, fAngle2);					
			DelayCommand(2.0, ActionCreateObject("plc_fl_w_she_wood01", lWhere, fScale));
		}


	}	
	
	// SET AS DONE
	SetLocalInt(OBJECT_SELF, "DONE", 1);
	SetUseableFlag(OBJECT_SELF, FALSE);
}


#186
4760

4760
  • Members
  • 1 207 messages

I'd rather add 180 to the variable fAngle you can find in the blueprints (to account for the change of facing - these are not the only ones facing South instead of North) and slightly update the code:

	float fAngle = GetFacing(OBJECT_SELF) + GetLocalFloat(OBJECT_SELF, "fAngle") - 90; // POSITION CREATED RELATIVE TO SELF
	float fAngle2 = GetFacing(OBJECT_SELF) - GetLocalFloat(OBJECT_SELF, "fHeading"); // ORIENTATION OF OBJECT CREATED

Since we're back to parameters, I'd also change the line with the distance (it's not always 3.0, look at the bow for instance):

	float fDistance = fScale * GetLocalFloat(OBJECT_SELF, "fDistance");

By the way, it's certainly not noticeable, but each "call" to OBJECT_SELF consumes more processing power than reading the value stored in a variable, so I usually define a variable (object oSelf = OBJECT_SELF;).



#187
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

I'd rather add 180 to the variable fAngle you can find in the blueprints (to account for the change of facing - these are not the only ones facing South instead of North) and slightly update the code:






	float fAngle = GetFacing(OBJECT_SELF) + GetLocalFloat(OBJECT_SELF, "fAngle") - 90; // POSITION CREATED RELATIVE TO SELF
	float fAngle2 = GetFacing(OBJECT_SELF) - GetLocalFloat(OBJECT_SELF, "fHeading"); // ORIENTATION OF OBJECT CREATED
Since we're back to parameters, I'd also change the line with the distance (it's not always 3.0, look at the bow for instance):
	float fDistance = fScale * GetLocalFloat(OBJECT_SELF, "fDistance");
By the way, it's certainly not noticeable, but each "call" to OBJECT_SELF consumes more processing power than reading the value stored in a variable, so I usually define a variable (object oSelf = OBJECT_SELF;).


Hi Thierry,

I have already done all the parameters we need for those statues and added them to the script (above) for you. I also added the shield to drop as well. ;)

I always wondered why people defined the variable rather than use OBJECT_SELF. Now I know! :D OK, so we need to define the OBJECT_SELF again, but the rest works well. :) EDIT: Although, I don't think I am going to address every script I have like that now ... maybe as I come across them again as I make any changes or updates. ;)

CHECK OUT THE LAST POST (BY REFRESHING YOUR FORUM PAGE) IN CASE YOU HAVE NOT SEEN IT. ;)

Cheers,
Lance.

#188
4760

4760
  • Members
  • 1 207 messages

Ah, you probably edited your post while I was writing mine!

The method I propose (adding 180 for the statues facing South instead of North) allows for future statues ( ;) who knows?) without changing the script.



#189
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Ah, you probably edited your post while I was writing mine!
The method I propose (adding 180 for the statues facing South instead of North) allows for future statues ( ;) who knows?) without changing the script.


Yes ... I see the point about future proofing for new statues ... Are we going to get more then? ;)

Cheers,
Lance.

#190
4760

4760
  • Members
  • 1 207 messages

I have already done all the parameters we need for those statues and added them to the script (above) for you. I also added the shield to drop as well. ;)

Nice work!



#191
4760

4760
  • Members
  • 1 207 messages

Are we going to get more then? ;)

 

Probably not right away (I also have my own campaign to work on!), but I figured that the breakable statue should in the end give two rocks and a stone head (could be proof of quest completed for the head, or the rocks and the head could be the weight needed to have a pressure plate open a door, you see the idea...)



#192
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Probably not right away (I also have my own campaign to work on!), but I figured that the breakable statue should in the end give two rocks and a stone head (could be proof of quest completed for the head, or the rocks and the head could be the weight needed to have a pressure plate open a door, you see the idea...)


Hi Thierry,

Just back from a break .... :) I like the sound of those ideas. :)

I probably won't be back until Monday now ... Catch you later.

EDIT: I did consider writing a little test feedback utility to help give feedback on the tweaks when placing items on the ground next to the placeable. But decided trial and error was probably just as quick. ;)

EDIT 2: If you make any more statues before release (and you want some help finding the tweaks), I can always help you find them and add them to the script before you release ... or we can simply slightly alter the code to allow tweak overrides via variables on the placeables ... similar to what you had in mind.

Cheers,
Lance.

#193
4760

4760
  • Members
  • 1 207 messages

EDIT: I did consider writing a little test feedback utility to help give feedback on the tweaks when placing items on the ground next to the placeable. But decided trial and error was probably just as quick. ;)

EDIT 2: If you make any more statues before release (and you want some help finding the tweaks), I can always help you find them and add them to the script before you release ... or we can simply slightly alter the code to allow tweak overrides via variables on the placeables ... similar to what you had in mind.

 

No need for trial and error: I built a small spreadsheet into which I put the coordinates of the statue and of the weapon, and just have to set the variables accordingly.

 

1) Center the statue at (120, 120, 0)

901-1-1401015351.png

 

2) Place the weapon you want where you want it to appear. Note the values: coordinates (119.3929, 118.0358, 0) and heading (-90)

901-2-1401015352.png

 

3) I then put the values in the spreadsheet and get directly fDistance, fAngle and fHeading

901-3-1401015352.png


  • Rolo Kipp aime ceci

#194
4760

4760
  • Members
  • 1 207 messages

Any update on when the glowing buttons might be available to download?

Sorry, the final test showed that half of the normal maps don't show well. I still have to figure out why.

 

Edit:

Found why. The texture I used which worked well for the carved in aspect was finally too "high" for the bumping out appearance.

It's better now...

 

without light:

901-3-1401050301.jpg

 

with nightvision on:

901-2-1401050359.jpg

 

with artificial light:

901-5-1401050301.jpg

 

Ah, yes, those are new symbols... For a better view, I activated the glowing effect below:

901-1-1401050300.jpg

 

Say two to three days to finish the textures, have a final test, and the release candidate should be ready.


  • Rolo Kipp aime ceci

#195
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi Thierry,

Nice spreadsheet work! That should save some work then. :)

And those buttons are looking good .... especially when they glow! Really neat! (I am colour blind and find it quite hard to see any changes in similar colours. Contrasts work best for me.)

Look forward to them.

Cheers,
Lance.

#196
rjshae

rjshae
  • Members
  • 4 491 messages

I happened upon another decent-looking trap door model at the OpenGameArt site:

 

trapdoor_render.png

 

Not sure if you have an interest.



#197
Tchos

Tchos
  • Members
  • 5 054 messages

The texture could be useful.  It says on the site that it's not made to open, so it's probably just a solid block model (aside from the bolts in the corners and the handle).



#198
4760

4760
  • Members
  • 1 207 messages

Sure, it does look nice! I don't have blender (I suppose that's where the .blend extension comes from) and so I cannot get the texture. I could install it, but not right now.



#199
rjshae

rjshae
  • Members
  • 4 491 messages

Sure, it does look nice! I don't have blender (I suppose that's where the .blend extension comes from) and so I cannot get the texture. I could install it, but not right now.

 

I'll try to get you a copy of the texture(s) tonight.



#200
rjshae

rjshae
  • Members
  • 4 491 messages

Here it is:

 

trapdoor.zip