Jump to content

Weapon Script trpubble.


niteshadowthebiofreak

Recommended Posts

..Something tells me I was wrong...

(namely the fact ive been at this all day and come up with no progress)

 

I may need to rethink things a bit...

Thanks for all the help...but,

I fear Ive let you all down...

(I have a bad habit of trying to do things beyond my abilities)

.....boy do i feel like a jackass......

Scripting is tough, especially when you're trying to do something new or creative. Some us have literally spent several weeks working on a single script, trying different things from different ways only to realize that it isn't going to work how we want, and either revising what we want, or coming back to it in a few months when something else we're doing presents a solution.

 

I would imagine that most of your difficulty is coming just from being unfamiliar with some of the functions or blocktypes you are trying to use. I would suggest that you sit down and take a moment to think about where scripts are being run based on what they are attached to and what block types are used. For instance, scripts which are attached to items have scripting that runs on the item if a menumode or gamemode block is used, but runs on the actor if onequip, onadd, onunequip, onremove are used. Things using scripteffectstart scripteffectupdate and scripteffectfinish run on whatever is being hit by that spell or enchantment.

 

Based on that, then considder what sorts of blocks you are trying to use to get references, variables, and if they work within the blocktypes used, and if they will return the right information or do the right thing to whatever that part of the script is being run on. Some functions, such as getself do not work on inventory items.

 

Finally, considder that sometimes depending on what the script is attached to, and where or what thing is doing, that certain block types simply won't get run. For instance, although gamemode and menumode blocks can run on inventory items, they only run in specific instances. Gamemode blocks will only run when that item is dropped in the world, not when it is equipped. Menumode blocks will only run if the item is in the player's inventory.

 

On a sidenote, you might want to resize your signature to something a bit smaller, since at the moment it stretches the page for those of us with small browser windows.

Link to comment
Share on other sites

Scripting is tough, especially when you're trying to do something new or creative. Some us have literally spent several weeks working on a single script, trying different things from different ways only to realize that it isn't going to work how we want, and either revising what we want, or coming back to it in a few months when something else we're doing presents a solution.

 

I would imagine that most of your difficulty is coming just from being unfamiliar with some of the functions or blocktypes you are trying to use. I would suggest that you sit down and take a moment to think about where scripts are being run based on what they are attached to and what block types are used. For instance, scripts which are attached to items have scripting that runs on the item if a menumode or gamemode block is used, but runs on the actor if onequip, onadd, onunequip, onremove are used. Things using scripteffectstart scripteffectupdate and scripteffectfinish run on whatever is being hit by that spell or enchantment.

 

Based on that, then considder what sorts of blocks you are trying to use to get references, variables, and if they work within the blocktypes used, and if they will return the right information or do the right thing to whatever that part of the script is being run on. Some functions, such as getself do not work on inventory items.

 

Finally, considder that sometimes depending on what the script is attached to, and where or what thing is doing, that certain block types simply won't get run. For instance, although gamemode and menumode blocks can run on inventory items, they only run in specific instances. Gamemode blocks will only run when that item is dropped in the world, not when it is equipped. Menumode blocks will only run if the item is in the player's inventory.

 

On a sidenote, you might want to resize your signature to something a bit smaller, since at the moment it stretches the page for those of us with small browser windows.

 

I think i see what you are saying,

I admit it, Im a N00b Novice

Perhaps i just need to study things a bit more.

 

 

 

...The weapons,

Ive got them registered at the blocktype as dagger||shortsword||longsword||claymore

perhaps if i broke up the the script into several blocks..temporarily anyway, maybe I can get something working.

 

-------edit------

Sorry bout that last night,

Combination of things kinda made it hard to think.

Lack of sleep,

not enough coffee,

headache,

several distractions.

 

Im feeling much better today,

Link to comment
Share on other sites

You might do better by explaining what you are trying to do, without releasing too many specifics about your mod if you are uncomfortable doing so, what kinds of scripts you're using, what you're attaching them to, and what blocktypes you're using. Even something as simple as;

 

"I have a script on an enchantment that is applied to a weapon, the enchantment adds an item to whoever it hits, I'm using onscripteffectstart and onscripteffect finish blocks to add the item. The item is scripted with a onadd block to do something to the NPC.

 

My problem is that..."

 

Basically, the kinds of things which people might need in order to help you.

Link to comment
Share on other sites

Lets see if i can do this.

 

Im trying to make an evil blade that steals human souls.

Using the onhitwith blocktype.

I need it to detect who you just hit with a specific weapon set (there will actually be 4 weapons that will do this),

If you just killed them.

and, if they are humanoid,

If they are killed using the weapon and are humanoid, it needs to add an item to the players inventory.

 

 

...did i get that right?

Link to comment
Share on other sites

Lets see if i can do this.

 

Im trying to make an evil blade that steals human souls.

Using the onhitwith blocktype.

I need it to detect who you just hit with a specific weapon set (there will actually be 4 weapons that will do this),

If you just killed them.

and, if they are humanoid,

If they are killed using the weapon and are humanoid, it needs to add an item to the players inventory.

 

 

...did i get that right?

Yes. The main problem here is that any script with a onhitwith blocktype would need to be attached to every NPC that you want to detect for. Since this would likely mean attaching a script to every NPC in the game, this is not suggested. Essentially, you need to either use a block which runs on the actor being hit without attaching scripts to each actor (enchantment), or need to use a script which is constantly running (quest script) combined with OBSE for detecting what is at the crosshairs when the player attacks.

 

The enchantment method is the least complicated, basically, all you do is create an enchantment that has a scripted spell effect with a duration of 3-4 seconds. Within that script, onscripteffect end, use a condition to check if the target (what the script is running on) is dead, and if dead, adds an item to the player. You can have separate enchantments, one for each weapon, using the same scripted effect along with whatever other effects you want. Since you only want this to be done with 4 weapons, this is probably the best option.

 

The OBSE method requires making a quest script which will be constantly running in the background and performing checks on the player's current equipped weapon and whatever is in the player's crosshair. Essentially, start the script out with a condition based on if the player is currently pressing the attack button (GetMouseButtonPress). If true, checks to see if any of the weapons decided on are currently equipped. If true, sets a variable to 1 for 2 seconds (needs a timer within the script inside its own condition), if false does nothing. If that variable is 1, sets a reference to whatever GetCrosshairRef returns, then checks if that reference is dead. If that reference is dead before that variable switches back to 1, it gives the player the item, if not, nothing happens.

 

Basically

 

scn whateverweaponscriptingthingycheckerscript31

ref target
float timer
short docheck

begin gamemode
if getbuttonpress == 0
 if player.getequipped <weapon1id> == 1 || player.getequipped <weapon2id> == 1 || player.getequipped <weapon3id> == 1 || player.getequipped <weapon4id> == 1
setdocheck to 1
set timer to 3
 endif
endif
if docheck == 1
  if timer == 1
  set target to getcrosshairref
  if target.isactor == 1 && target.getdead == 1
	 player.additem <itemID> 1
	 set timer to 0
  endif
  elseif timer > 1
  set timer to timer - getsecondspassed
  endif
endif
end

 

Or something to that effect. Not too sure since I don't use OBSE or OBSE scripts, and havn't actually used these functions.

Link to comment
Share on other sites

and i set that as a quest script?

Ill need to give that a test later,

 

If its alright with you i would like to try swapping one of the commands for another.

getisplayablerace for isactor

 

Ive found that getisplayablerace to be a quick fix for figuring out monsters from humanoids.

dramora, dark seducers, golden saints, and sheogorath aside.

 

will that still work?

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...