www.tombraiderforums.com  

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Next Generation Level Editor

Reply
 
Thread Tools
Old 13-11-21, 14:18   #15131
justin
Professor
 
Join Date: Aug 2001
Location: CT, USA
Posts: 4,460
Default

I didn't realize we could use > to return a line and use a comment on each of those lines. I could really clean up my script organization
__________________
Nothing is impossible, just impractical
justin is offline   Reply With Quote
Old 13-11-21, 14:22   #15132
jvry
Hobbyist
 
jvry's Avatar
 
Join Date: Aug 2021
Posts: 83
Default

Monday's stream, "cleaning my scripts"
jvry is offline   Reply With Quote
Old 13-11-21, 16:50   #15133
adngel
Historian
 
adngel's Avatar
 
Join Date: Jan 2004
Location: Surrey
Posts: 264
Default

Quote:
Originally Posted by Joey79100 View Post
Generally speaking, I treat constants as proper naming...
...I can edit the implementation more easily, without breaking the whole setup or forgetting some parts.
Highly appreciated input.

So you take all the global constants #DEFINES from all the subscripts and put them together in a kind of Headers collector? Using the prefix to identify their destiny use, clever.

Yeah, that could help to avoid the conflict between scripts.

Following your example I've change this scrpt

Before:
Code:
;Triggers Groups used: 10 (3-12)
;Global Triggers used: 4 (2-5)
;Parameters used: 3 (1-3)

;Requires: 
;02 = Plugin_AkyVMix01

;-------------------------------
;Finances
;-------------------------------
;Print the gold quantity when weapons are out.
Parameters= PARAM_PRINT_TEXT, 1, CL_GOLD, FT_SIZE_HALF_CHAR, IGNORE, IGNORE, 150, 55
GlobalTrigger= 2, IGNORE, GT_CONDITION_GROUP, IGNORE, 3, 4, 5
TriggerGroup = 3, $028000, 6, $A7 ;Condition Trigger: If there is any weapon in Lara's hand in <#> way: Any weapon (shooting or not)
TriggerGroup = 4, $2000,203,$0118 ;Print text NG line 24. (with variable Global Alfa 1) With Parametter Text 1
TriggerGroup = 5, $2000,204,$0018 ;Remove text NG line 24 from screen.


;Collecting Gold

Parameters= PARAM_PRINT_TEXT, 2, CL_GOLD, FT_SIZE_HALF_CHAR, IGNORE, 2, 50, 70

;Getting the pickup 1 (20 gold)
GlobalTrigger = 3, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 6, 7, IGNORE
TriggerGroup = 6, $8000,231,$0002 ;Condition trigger, if the Pickup1 is in the inventory.
TriggerGroup = 7, $2000 + TGROUP_SINGLE_SHOT_RESUMED, 47,$0038, >  ;Remove Object, and add gold. 
					$2000,203,$0219, $2000,231,$1E10 ;Add to Global SHort Alfa 1, the value of 20 // Print NG line with Parameter 2 Line 25
					
;Getting the pickup 1 (50 gold)
GlobalTrigger = 4, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 8, 9, IGNORE
TriggerGroup = 8, $8000,232,$0002 ;Condition trigger, if the Pickup1 is in the inventory.
TriggerGroup = 9, $2000 + TGROUP_SINGLE_SHOT_RESUMED, 47,$0039, >  ;Remove Object, and add gold. 
					$2000,203,$021A, $2000,231,$3210 ;Add to Global SHort Alfa 1, the value of 50 // Print NG line with Parameter 2 Line 26

;Getting the pickup 1 (100 gold)
GlobalTrigger = 5, FGT_SINGLE_SHOT_RESUMED, GT_CONDITION_GROUP, IGNORE, 10, 11, IGNORE
TriggerGroup = 10, $8000,233,$0002 ;Condition trigger, if the Pickup1 is in the inventory.
TriggerGroup = 11, $2000 + TGROUP_SINGLE_SHOT_RESUMED, 47,$003A, >  ;Remove Object, and add gold. 
					$2000,203,$021B, $2000,231,$6410 ;Add to Global SHort Alfa 1, the value of 100 // Print NG line with Parameter 2 Line 27


;Print the gold quantity when money is spent. (money cost is in Local Alfa 1)
Parameters= PARAM_PRINT_TEXT, 3, CL_RED, FT_SIZE_HALF_CHAR, IGNORE, 3, 50, 100
TriggerGroup = 12, $2000,203,$032A ;Print text NG line 42. (with variable Local Alfa 1) With Parametter Text 3

After:
Code:
;-------------------------------
;Finances
;-------------------------------

;Requires: 
;02 = Plugin_AkyVMix01

;-----GLOBAL CONSTANTS

#DEFINE PMI_FIN_TEXT_HUD_GOLD 1
#DEFINE PMI_FIN_TEXT_ADD_GOLD 2
#DEFINE PMI_FIN_TEXT_SUB_GOLD 3

#DEFINE GT_FIN_DO_TRY_DRAW_GOLD_HUD 2
#DEFINE GT_FIN_OBJ_PICKUP_1 3
#DEFINE GT_FIN_OBJ_PICKUP_2 4
#DEFINE GT_FIN_OBJ_PICKUP_3 5

#DEFINE TG_FIN_CHECK_WEAPONS_DRAWN 3
#DEFINE TG_FIN_DO_DRAW_GOLD_HUD 4
#DEFINE TG_FIN_DO_HIDE_GOLD_HUD 5
#DEFINE TG_FIN_DO_PRINT_ADD_GOLD_TEXT 6
#DEFINE TG_FIN_DO_PRINT_SUB_GOLD_TEXT 7
#DEFINE TG_FIN_DO_ADD_GOLD 8
#DEFINE TG_FIN_DO_SUB_GOLD 9
#DEFINE TG_FIN_CHECK_INV_PICKUP_1 10
#DEFINE TG_FIN_DO_PICKUP_1 11
#DEFINE TG_FIN_CHECK_INV_PICKUP_2 12
#DEFINE TG_FIN_DO_PICKUP_2 13
#DEFINE TG_FIN_CHECK_INV_PICKUP_3 14
#DEFINE TG_FIN_DO_PICKUP_3 15


;-----LOCALS CONSTANTS
#DEFINE X_GOLD_HUD_TEXT 150
#DEFINE Y_GOLD_HUD_TEXT 55

#DEFINE DUR_TIME_GOLD_CHANGE_TEXT 2 ;In seconds
#DEFINE X_GOLD_CHANGE_TEXT 50
#DEFINE Y_GOLD_CHANGE_TEXT 100


;-----Gold HUD Text-----

;Prints the gold quantity when weapons are out.

Parameters= PARAM_PRINT_TEXT, PMI_FIN_TEXT_HUD_GOLD,>
	CL_GOLD, FT_SIZE_HALF_CHAR,>
	IGNORE, IGNORE,>
	X_GOLD_HUD_TEXT, Y_GOLD_HUD_TEXT

GlobalTrigger= GT_FIN_DO_TRY_DRAW_GOLD_HUD,>
	IGNORE, GT_CONDITION_GROUP, IGNORE,>
	TG_FIN_CHECK_WEAPONS_DRAWN, TG_FIN_DO_DRAW_GOLD_HUD, TG_FIN_DO_HIDE_GOLD_HUD
	
TriggerGroup = TG_FIN_CHECK_WEAPONS_DRAWN,>
	$028000, 6, $A7 				;C Condition: If there is any weapon in Lara's hands
	
TriggerGroup = TG_FIN_DO_DRAW_GOLD_HUD,>
	$2000,203,$010A 				;F203 Trigger: Prints the text NG line 10 using the Parametter Text 1
	
TriggerGroup = TG_FIN_DO_HIDE_GOLD_HUD,>
	$2000,204,$000A 				;F204 Trigger: Hides the text NG line 10 from screen.


;-----Gold Change Texts-----

Parameters= PARAM_PRINT_TEXT, PMI_FIN_TEXT_ADD_GOLD,>
	CL_GOLD, FT_SIZE_HALF_CHAR,> 			;Text Format
	IGNORE, DUR_TIME_GOLD_CHANGE_TEXT,> 		;Time values
	X_GOLD_CHANGE_TEXT, Y_GOLD_CHANGE_TEXT  	;X-Y Position

TriggerGroup = TG_FIN_DO_PRINT_ADD_GOLD_TEXT,>
	$2000,203,$020B 				;F203 Trigger: Prints text NG line 11 with the Parametter Text 2


Parameters= PARAM_PRINT_TEXT, PMI_FIN_TEXT_SUB_GOLD,>
	CL_RED, FT_SIZE_HALF_CHAR,> 			;Text Format
	IGNORE, DUR_TIME_GOLD_CHANGE_TEXT,> 		;Time values
	X_GOLD_CHANGE_TEXT, Y_GOLD_CHANGE_TEXT  	;X-Y Position

TriggerGroup = TG_FIN_DO_PRINT_SUB_GOLD_TEXT,>
	$2000,203,$030C 				;F203 Trigger: Prints text NG line 12 with the Parametter Text 3


;-----Gold Operations-----

;Add or Substract the value from Local Alfa Short [3-4] on Global Alfa Short [1-2]
;And then prints the Gold Change Text.

TriggerGroup = TG_FIN_DO_ADD_GOLD,>
	$2000,271,$0051,> 				;F271 Trigger: Current Value = Local Short Alfa 2
	$2000,285,$0010,> 				;F285 Trigger: Current Value = Current Value + Global Short Alfa 1
	$2000,272,$0010,> 				;F272 Trigger: Global Short Alfa 1 = Current Value
	$2000,371,TG_FIN_DO_PRINT_ADD_GOLD_TEXT		;F371 Trigger: Calls trigger in single way.
	
TriggerGroup = TG_FIN_DO_SUB_GOLD,>
	$2000,271,$0010,> 				;F271 Trigger: Current Value = Global Short Alfa 1
	$2000,286,$0051,> 				;F285 Trigger: Current Value = Current Value - Local Short Alfa 2
	$2000,272,$0010,> 				;F272 Trigger: Global Short Alfa 1 = Current Value
	$2000,371,TG_FIN_DO_PRINT_SUB_GOLD_TEXT		;F371 Trigger: Calls trigger in single way.


;-----PICKUPS-----

;When Lara collects them, the object must be removed from the inventory and the value added to the gold.
; Pickup 1 = 25g
; Pickup 2 = 50g
; Pickup 3 = 100g


;-----Pickup 1-----

GlobalTrigger = GT_FIN_OBJ_PICKUP_1,>
	FGT_SINGLE_SHOT_RESUMED,>
	GT_CONDITION_GROUP, IGNORE,>
	TG_FIN_CHECK_INV_PICKUP_1, TG_FIN_DO_PICKUP_1, IGNORE
	
TriggerGroup = TG_FIN_CHECK_INV_PICKUP_1,>
	$8000,231,$0002 				;C231 Condition: if the Pickup1 is in the inventory.

TriggerGroup = TG_FIN_DO_PICKUP_1,>
	$2000, 47,$0038,>				;F047 Trigger: Remove Pickup1 From inventory
	$2000,232,$1951,>				;F232 Trigger: Set the value 25 in Local Short Alfa 2.
	$2000,371,TG_FIN_DO_ADD_GOLD			;F371 Trigger: Calls trigger in single way.


;-----Pickup 2-----

GlobalTrigger = GT_FIN_OBJ_PICKUP_2,>
	FGT_SINGLE_SHOT_RESUMED,>
	GT_CONDITION_GROUP, IGNORE,>
	TG_FIN_CHECK_INV_PICKUP_2, TG_FIN_DO_PICKUP_2, IGNORE
	
TriggerGroup = TG_FIN_CHECK_INV_PICKUP_2,>
	$8000,232,$0002 				;C231 Condition: if the Pickup2 is in the inventory.

TriggerGroup = TG_FIN_DO_PICKUP_2,>
	$2000, 47,$0039,>				;F047 Trigger: Remove Pickup2 From inventory
	$2000,232,$3251,>				;F232 Trigger: Set the value 50 in Local Short Alfa 2.
	$2000,371,TG_FIN_DO_ADD_GOLD			;F371 Trigger: Calls trigger in single way.


;-----Pickup 3-----

GlobalTrigger = GT_FIN_OBJ_PICKUP_3,>
	FGT_SINGLE_SHOT_RESUMED,>
	GT_CONDITION_GROUP, IGNORE,>
	TG_FIN_CHECK_INV_PICKUP_3, TG_FIN_DO_PICKUP_3, IGNORE
	
TriggerGroup = TG_FIN_CHECK_INV_PICKUP_3,>
	$8000,233,$0002 				;C231 Condition: if the Pickup3 is in the inventory.

TriggerGroup = TG_FIN_DO_PICKUP_3,>
	$2000, 47,$003A,>				;F047 Trigger: Remove Pickup3 From inventory
	$2000,232,$6451,>				;F232 Trigger: Set the value 100 in Local Short Alfa 2.
	$2000,371,TG_FIN_DO_ADD_GOLD			;F371 Trigger: Calls trigger in single way.
Still I have to take the GLOBAL CONSTANTS away, but generally I'm happy with the result.

Thank you, I'll try follow those advices.
__________________
Living and Left :)

Last edited by adngel; 13-11-21 at 17:04.
adngel is offline   Reply With Quote
Old 15-11-21, 20:54   #15134
Joey79100
Professor
 
Joey79100's Avatar
 
Join Date: Mar 2012
Location: France
Posts: 3,531
Default

Yes I have all the constants at the top of the file. It also helps finding quickly which IDs are used by a script file.

Although when I use a setup prefix, I put it at the very beginning, so they all start the same way and the rest is unchanged, such as HBE_TG_IDONTREMEMBERWHAT - but of course you do it the way you want, the important part is keeping it readable.

--------------------------------------------------------------------------

I have an issue that is making me pull my hair off my head.

I have several stacked rooms, and a PUZZLE_HOLE in the top one.
All the rooms are connected by vertical portals, and that PUZZLE_HOLE is on the edge of a portal (so Lara can interact with it, but still have it look like it is "above the pit").



At one point, I need it to lower to the ground level (ie. move it to the lowest room in the stack). With a flyby that focuses on it during the entire descent and everything.
The thing is, it doesn't work as excepted: it lowers, but after the original room is out of sight, it stops rendering. Also Lara just won't interact with it, while she was perfectly able to in the upper room.

I used to think A93 was meant to correct these kinds of issues:
Quote:
; Trigger for ActionNg
; <#> (266) PUZZLE_HOLE7, Room = Sanctuary Attic - Plant room, X = 4, Z = 3, Ocb = 0, Script ID = 248
; <&> Move. Update room for <#>Animating with (E)units of Y displacement (A93)
; <E> No displacement (keep original Y coordinate)
; Copy following values to your script:
; $5000,248,$005D
But it is the second time I try it, I even tried calling it every second until after it's down to the lowest room... and it just doesn't make any difference, both issues persist.

I've pinned down the issue to the fact that the object is technically not above the pit, but on the ground just before it. This is needed to allow Lara to interact with it. If I place it so it is on the sector actually above the pit, I have no issue at all.

Any idea how to properly fix these issues? Or do I absolutely have to resort to workarounds in order to achieve this?

Thanks in advance.
Joey79100 is offline   Reply With Quote
Old 15-11-21, 23:19   #15135
justin
Professor
 
Join Date: Aug 2001
Location: CT, USA
Posts: 4,460
Default

I have no idea how to fix the rendering issue, it feels like TE has a harder time than ngle rendering objects in other rooms or when they move rooms (which is weird, because i figured the editor used shouldn't make a difference when the same engine is used).

Either way, i usually end up moving my puzzle/key holes to Lara Srart Positions. Not sure if this survives an inter-room move, but you could try doing that at the end if the Action-move sequence to test it.
__________________
Nothing is impossible, just impractical
justin is offline   Reply With Quote
Old 16-11-21, 07:00   #15136
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 4,565
Default

Joey, what if you try with fake Animating holes (still with that A93?) and meshswap triggers?
Or not meshswap trigger, but killing the Animating when you don't need it any more (A14), and triggerring the invisible hole (not as a KEY now, but an OBJECT) to make it visible?
AkyV is offline   Reply With Quote
Old 16-11-21, 16:52   #15137
Joey79100
Professor
 
Joey79100's Avatar
 
Join Date: Mar 2012
Location: France
Posts: 3,531
Default

Yeah, that's what I was afraid of. If there is no way to simply update an item's room ID I'll use invisible puzzle objects instead.
Thanks anyway.
Joey79100 is offline   Reply With Quote
Old 21-11-21, 22:00   #15138
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 4,565
Exclamation

For TE users:

Do not use A43 or A26 triggers to activate items, placing them on the map.
Because the trigger always starts with a timer, which is, in a strange way, coming from the trigger ID, so the timer will be always +43 or +26. (Even if you don't want to time it.)
So these triggers (to activate) can be used only exported in a TriggerGroup - and then activate the TriggerGroup in the map.

TRNG problematic trigger codes won't be fixed nowadays in TE, so it cannot be considered as a TE bug reported for fixing now.
AkyV is offline   Reply With Quote
Old 30-11-21, 14:17   #15139
Heckler
Professor
 
Heckler's Avatar
 
Join Date: Feb 2008
Location: South Africa
Posts: 4,009
Default

Just a random thought, but after seeing how some titles utilize mesh-swapping for things like blinking, outfits and speech, I wonder if it would be possible if we could use it for injuries or wear & tear. Like have the mesh-swap be dependent on the health bar for blood. Sort of like TR1 Lara's textures when the T-rex kills her.
Could also be a cool little detail if it's triggered as you progress further into a level with damages and dirt.
I don't know if this has been done before.
__________________
Tread carefully.
Heckler is offline   Reply With Quote
Old 07-12-21, 04:32   #15140
adngel
Historian
 
adngel's Avatar
 
Join Date: Jan 2004
Location: Surrey
Posts: 264
Default

I don't know if it has been done on any level, but sure, it's clearly possible to do that too.

You would need a continuous global trigger that go checking Lara's life, and a local variable to check the current mesh status. If life decrease X quantity, change Lara's mesh and update the local variable (to don't go swapping them constantly).

/------------------/


Hi, I was doing the Paolone's plugin tutorial, now I've got the working robot cleaner and I was changing its speed. The issue is that if I change it with a constant value, it works, but if I try to put a variable from MyData structure, the level crashes on load. Anyone has experienced that?

My intention is put the speed (and rotation speed) as variable to can change them via scripting (a Customize operation or such), but still I don't know why the variable makes it crashes. O_



/-----/ EDIT, ISSUE SOLVED

It happens that it's not accepted to initialize the variables with its declaration as I was used to, they have to be declared in the MyData structure and initialized later somewhere else (in my case I initialized them in the Robot_Cleaner slot initializator).
__________________
Living and Left :)

Last edited by adngel; 07-12-21 at 05:00.
adngel is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 13:50.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.