Jump to content

Bug squeezing from my own mod


svj

Recommended Posts

After ending the CHAIN, you need a new action. You can't just have a state floating around unconnected; WeiDU doesn't know what dialogue file that's supposed to go into. From context, I think you want to add it to your already created "rqrugos" dialogue file, which would be an APPEND action.

Link to comment
IF
    See([ENEMY])
    Allegiance(Myself,ENEMY)
    Global("rqTurnedToWehrwolf","LOCALS",0)

THEN
    RESPONSE #100
        ForceSpellRES("SPCL644",Myself)  // Shapeshifts Greater Werewolf
        SetGlobal("rqTurnedToWehrwolf","LOCALS",1)
END

I would really like to know why this snipped will not turn NPC into Werewolf

Link to comment

[ENEMY], used as an object identifier, looks for anything with the ENEMY allegiance - that is, another creature hostile to the party. Which means it won't do anything if this creature is alone. I recommend using something like NearestEnemyOf(Myself) instead.

(Also, that extra empty line between the trigger block and action block is nonstandard. I don't think it does anything when this compiles, but it can't hurt to remove it.)

Also, as that's a player-usable ability you're using, beware interference from other mods. The Tweaks Anthology "Shapeshifter Rebalancing" component changes that spell to create a paw token that can be equipped to cause the transformation, for example - it no longer directly transforms the subject. If you want a spell that will definitely work, I recommend making a clone of the base spell yourself and including it with your mod.

Edited by jmerry
Link to comment
Why does weidu complain about it then?
[revan/baf/rqgrun5c.baf] PARSE ERROR at line 16 column 16-82
Near Text: )
[DisplayStringHead] argument [Pauden! Use the the horn! Use the horn!] was expected to be an integer

IF
See(NearestEnemyOf(Myself))
Allegiance(Myself,ENEMY)
//Global("rqcontract5battle","GLOBAL",1)
Global("rqUsedHorn","LOCALS",0)
THEN
RESPONSE #100
DisplayStringHead(Myself,"Pauden! Use the the horn! Use the horn!") // Pauden! Use the the horn! Use the horn!
SetGlobal("rqUsedHorn","LOCALS",1)
END
Link to comment
10 hours ago, svj said:

How does one append something to dialog tlk to be used in future for DisplayStringHead?

RESOLVE_STR_REF is suitable for this. It returns a number, which you save in a variable. Then in that script bit, you include that variable in %% signs and compile it with an EVALUATE_BUFFER.

Just in case this compile-time string-saving doesn't work out for you.

Link to comment
IF
	GlobalTimerExpired("rqHornOfWilderness","AR1900")
THEN
	RESPONSE #100
		SetGlobalTimer("rqHornOfWilderness","AR1900",20)
		DisplayStringHead(Myself,~Uses Horn of Wilderness~)  // Uses Horn of Wilderness
		PlaySound("rqhorn")
		ReallyForceSpellRES("rqwodbei",NearestEnemyOf(Myself)) // Summon Woodland Beings
		ReallyForceSpellRES("rqearele",NearestEnemyOf(Myself)) // Summon Earth Elemental
		ReallyForceSpellRES("rqfirele",NearestEnemyOf(Myself)) // Summon Fire Elemental
END
IF
	GlobalTimerExpired("ElectrifiedFloorTimer","AR6005")
THEN
	RESPONSE #100
		SetGlobalTimer("ElectrifiedFloorTimer","AR6005",21)
		DisplayString(Myself,72905)  // Abazigal Shockwave
		PlaySound("am6005e")
		ReallyForceSpell(Myself,ABAZIGAL_SHOCKWAVE)  // SPIN531.SPL (Abazigal Shockwave)
END

Why the code above does not work? Snippet below is from original game yet it in my testing the code above doesnt work at all.

Link to comment

I am trying to add area script in Area which has no script at least in vanilla game

How does one do such and how to do it in way so compatibility with other mods would be maintained?

// This is in my tp2 as of now will it work?

COPY_EXISTING ~ar5004.are~ ~override/ar5004.are~
WRITE_ASCII 0x94 ~ar5004~
EXTEND_TOP ~ar5004.bcs~ ~revan/baf/rqar5004.baf~

 

Link to comment

Areas may, under some circumstances, have scripts that don't match their resource ID. It's not usual, but it does happen; the four elemental rooms in Durlag's Tower all share the same script AR0507.BCS, for example.

Your best bet here:

- Open up the area file and read what's already there in the script field.

- This may be empty or not be a valid script. For example, AR0165 in BGEE (a generic tavern in the big city) has AR0165 in that field, but there is no AR0165.BCS script in the game. And I don't think EXTEND_TOP works on an empty script. So we run a FILE_EXISTS_IN_GAME check, and create a new blank script if the area doesn't already have a script; here's some code from a component of mine that does this:

 // The "script" variable is defined earlier by reading at 0x94.
 
 		PATCH_IF (NOT (FILE_EXISTS_IN_GAME ~%script%.BCS~)) BEGIN
			WRITE_ASCII 0x94 ~%areaID%~ #8
			SPRINT script ~%areaID%~
			INNER_ACTION BEGIN
				COPY ~jtweaks/resource/baf/empty.bcs~ ~override/%script%.bcs~
			END
		END // If no area script exists, create an empty one. Use area ID as resref.

WeiDU has a CREATE action, but it doesn't support BCS files. So I built an empty BCS file (6 bytes); I'll attach it to the post.

- Now that you have a script file - either one that already existed, or a new empty one - you run your EXTEND_TOP on it. Also note: when extending the top of a script with unknown contents, it is strongly recommended that you use Continue() in all blocks of your extension. Failing to do so will break any blocks using the OnCreation condition. Alternately, you could just extend the bottom of the script instead and not worry about this.

empty.BCS

Link to comment
1 hour ago, jmerry said:

I don't think EXTEND_TOP works on an empty script

EXTEND_TOP/BOTTOM acts as COMPILE if the target for extension doesn't exist. edit: For clarity, it compiles the script extension as the target file name.

Link to comment

So the empty step script is unnecessary; you can just run the EXTEND_ operation without checking for whether there's a script there already. But you should still read what's in that script field rather than blindly overwriting it.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...