Jump to content

Welcome to LoversLab
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

What's wrong with this script?


  • Please log in to reply
3 replies to this topic

#1
MorePrinniesDood

MorePrinniesDood

    Senior Member

  • Members
  • PipPipPipPip
  • 296 posts

So i'm calling this function 4 times, to replace an NPC's boots, gloves, body armor, and helmet with Nise's bikini armors:

function bikinify(actor caster, form oldarmor, formlist replacements)
   form newarmor = getrandompiece(replacements)
   if(newarmor != none)
      caster.unequipitem(oldarmor,false,true)
      caster.additem(newarmor,1,true)
      caster.equipitemex(newarmor,0,false,false)
      caster.removeitem(oldarmor,1,true)
    endif
endfunction

 
The expected result it that the NPC ends up with a piece of bikini armor for each old armor the function's called on.
 
The actual result is that the NPC ends up naked save for 1 piece of bikini armor, with the rest in inventory unequipped.

 
Any thoughts on why this is?

  • 0

AdBot

AdBot
  • Advert

#2
yatol

yatol

    Mega Poster

  • Members
  • PipPipPipPipPip
  • 2,853 posts

no idea

that one give and equip an item on npc without problem

 

function OnEffectStart(Actor akTarget, Actor akCaster)

    ((ShowPoseMenu as form) as uilistmenu).OnInit()
    armor gnd
    int max = armorlist.getsize() as int
    Int i = 0
    while i < max
        gnd=armorlist.Getat(i) as armor
        ((ShowPoseMenu as form) as uilistmenu).AddEntryItem(gnd.GetModelPath(true) as string, -1, -1, true)
        i += 1
    endWhile


    Int ret = ((ShowPoseMenu as form) as uilistmenu).OpenMenu(ClientForm, ClientForm)
    trace ("ret    " +ret)
    int resultInt = ((ShowPoseMenu as form) as uilistmenu).GetResultInt()
    trace("resultint    " + resultint)
    aktarget.additem(armorlist.getat(resultInt))
    aktarget.equipitem(armorlist.getat(resultInt))
    trace (armorlist.getat(resultInt))
endFunction

 

 


  • 0

#3
Varithina

Varithina

    Mega Poster

  • Members
  • PipPipPipPipPip
  • 1,062 posts

Not too sure, but I think you may need to specify which armour piece on each call of it, so it would do boots on the first call, helm on the second, etc, though to be honest the last significant coding I did was 20 years ago and was assembly code.

 

Though my nasty side of thinking on this makes me think you would need separate functions for each armour piece, and call them 1 by 1.


  • 0

#4
Andy14

Andy14

    Senior Member

  • Members
  • PipPipPipPip
  • 597 posts
I think it is a logic error - no thing of programming.
 
Where and when is variavle oldamor set?
 
4x Call the function and oldarmor is the armor of the last call - for example.
 
Only speculation. For more help, the whole code would be important - not just a function.

  • 0