Jump to content

Poltergeist Azarov

Resident
  • Posts

    94
  • Joined

  • Last visited

Everything posted by Poltergeist Azarov

  1. I am not planning to use bullets. Forgot to tell this important detail, sorry...
  2. Hello, after some discussions about llcastray limits, I decided to use a system that manually detects avatar positions at each bullet hits for my simple combat meter. Is this a good idea? If so, what is suggested to use? I was checking llGetAgentList for this operation earlier but not really sure if its gonna be fine to get agent list often. Any suggestions?
  3. Been trying to make some particle bullets and found some examples. The one I currently have seems to be too slow for a bullet. And the other problem is particles arent getting together with the center of screen when target is near. Center of the screen(target pointer/crossfire) and particles are only merging at around 200 meters away from particle source. Heres the sample script: EmitBullet() { float speed=100.0; vector vel =llRot2Fwd(llGetCameraRot()) * speed; llParticleSystem([ PSYS_PART_FLAGS, 259, PSYS_SRC_PATTERN, 1, PSYS_PART_START_ALPHA, 1.000000, PSYS_PART_END_ALPHA, 0.000000, PSYS_PART_START_COLOR, <1.000000, 1.000000, 1.000000>, PSYS_PART_END_COLOR, <1.000000, 1.000000, 1.000000>, PSYS_PART_START_SCALE, <1.000000, 1.000000, 0.00000>, PSYS_PART_END_SCALE, <0.100000, 0.100000, 0.100000>, PSYS_PART_MAX_AGE, 2.80000, PSYS_SRC_MAX_AGE, 0.10000, PSYS_SRC_ACCEL, vel, PSYS_SRC_ANGLE_BEGIN, 0.000000, PSYS_SRC_ANGLE_END, 0.000000, PSYS_SRC_BURST_PART_COUNT, 1, PSYS_SRC_BURST_RATE, 0.050000, PSYS_SRC_BURST_RADIUS, 0.000000, PSYS_SRC_BURST_SPEED_MIN, 100.000000, PSYS_SRC_BURST_SPEED_MAX, 100.500000, PSYS_SRC_OMEGA, <0.000000, 0.000000, 0.000000>, PSYS_SRC_TARGET_KEY,(key)"", PSYS_SRC_TEXTURE, ""]); } default { state_entry() { llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS|PERMISSION_TRACK_CAMERA); } run_time_permissions(integer perms) { if (perms & PERMISSION_TAKE_CONTROLS|PERMISSION_TRACK_CAMERA) { llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE); } } attach(key attached) { if (attached == NULL_KEY) // object has been detached { } else { llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS|PERMISSION_TRACK_CAMERA); } } control(key id, integer level, integer edge) { if (level & CONTROL_ML_LBUTTON && llGetAgentInfo(llGetOwner()) & AGENT_MOUSELOOK) { EmitBullet(); } } }
  4. Played alot with it and sadly failed to change between three colors :\ do you have a suggestion for that
  5. Thanks alot nova, that seems to be what I was looking for.
  6. I was trying to code something that can slightly change the color instead of changing at each %30 decrease of the health. For example this code below changes given color to black slighty: integer FTC=0;Uncolorize(vector color) { integer x; float CX=color.x; float CY=color.y; float CZ=color.z; for (x=1; x<=10; ++x) { if (CX>0.0) { CX-=0.1; } if (CY>0.0) { CY-=0.1; } if (CZ>0.0) { CZ-=0.1; } llSetLinkPrimitiveParamsFast(3,[PRIM_COLOR, FTC, <CX,CY,CZ>, 0.99]); llSleep(0.022); }} Another example of a slight color change to given color: Colorize(vector color) { vector NewColorVar=<1.0, 1.0, 0.0>; vector red= <1.0, 0.0, 0.0>; vector green= <0.0, 1.0, 0.0>; vector cyan= <0.0, 1.0, 1.0>; vector yellow= <1.0, 1.0, 0.0>; integer x; for (x=1; x<=10; ++x) { if (color==red) { NewColorVar+=<0.0,-0.1,0.0>; } if (color==green) { NewColorVar+=<-0.1,0.0,0.0>; } if (color==cyan) { NewColorVar+=<-0.1,0.0,0.1>; } llSetLinkPrimitiveParamsFast(3,[PRIM_COLOR, FTC, NewColorVar, 0.99]); llSleep(0.022); }} I've coded these both but now I am really stuck at changing between three colors slightly.
  7. Hello, I am making a combat meter and wanted its color of floating text to be changed depending on health ratio. There gonna be three main colors as green, yellow and red. As much as agent's energy gets low floating text color needs to be changed. I tried some ways to do and failed to code something compact for this operation. Any ideas? Edit: since colors are gonna be used depending on health ratio, color might seen as orange sometimes when agent's health is about %30. I failed coding it this perfect way.
  8. Thank you Rolig, it took about a day or more to find problem. Tested on two viewers so far: firestorm and singularity. Have a great day
  9. Finally I found the problem. When theres an active target omega on HUD, llAttachToAvatar() or llAttachToAvatarTemp() fails to display HUD on the screen. Thank you both alot...
  10. I also tried it Rolig, no positive response.
  11. Let me make this more clear. I tried to debug it by sending messages from HUD to myself. HUD is there, worn on center HUD but cant see it. Tried to move it to center by setting its pos to ZERO_VECTOR, nothing happend. I think the most important hint is the message color I got by llOwnerSay()... Its not really yellow; its a little dark yellow. This made me think that HUD is far away from the Avatar some ways even if its already worn on center HUD. There are no meshes on it by the way. Just regular prims... No no-trans pieces, no invisible faces and such.:matte-motes-stress:
  12. Hi, when I attach a HUD menu by TempAttach, HUD attaches but never appears. Any ideas?
  13. Thanks for the idea irihapeti. I will keep it in mind.
  14. Thank you for making me aware this was a bug... I dont have a perfect solution yet and gonna keep trying. For region changes, I dont have a perfect solution yet also. I will share here when I found something.
  15. Its totally a different script just coded for driver camera. Theres not even a sit target exists inside this script. Exact problem only occurs on 'unsits'... Cam Permission is not revoked when this happens but the camera params. What i understand so far is, server is forcing unsitters camera params to be resetted. I can understand that but why not only the unsitter. Why also sitting avatars forced their camera params to be resetted?
  16. As I realized today, whenever a passenger unsits from my vehicle, driver's scripted camera params are totally resetting to its default. So then driver keeps driving by default camera view... To avoid this issue, I decided to check link changes, so when a passenger unsits, I re-enter camera params for the driver. This seemed to be fine so far but camera moves to its default position and moves back to the desired position which is not really fine. Any better ideas? Thanks...
  17. this formule worked well, thanks alot Nova Also thanks both.
  18. Hello, Yesterday I been playing with rotations and positions between unlinked master and slave prim. My point was to make a simple rezzer or "rez-box" which only rezzes a single prim and moves it to desired position and rotates it. But as always, I had some trouble with calculating relative position by using a specified rotation. So when my master prim rezzes slave prim, moves it to different position than desired position. I am going to put here the scripts but to make this simpler, let me put the most important part of the script: if (RESPONSE=="SAVEPOS") { vector POSOFS=llGetPos()-POS; rotation RROT =llGetRot()/ROT; list x=["SAVEPOS_RESPONSE",":",POSOFS,":",RROT]; llRegionSay(UNIQUECHANCHILD,(string)x); }On this above part, master is calculating relative position offset and relative rot and sends it to slave.. Slave keeps these and sends them back in master to get desired positions depending on masters current position and rotation. //Master Script string OBJ_NAME ="Object"; vector RELPOSOFFSET=<2.0, 0.0, 1.0>; rotation RELROT =<0.707107, 0.0, 0.0, 0.707107>; integer StartParam =10; integer UNIQUECHANROOT; integer UNIQUECHANCHILD; integer LHANDLE; xListens() { UNIQUECHANROOT =((integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF; UNIQUECHANCHILD=(UNIQUECHANROOT+1); LHANDLE =llListen(UNIQUECHANROOT, "", "", ""); } default { state_entry() { xListens(); } on_rez(integer x){ xListens(); } touch_start(integer a) { vector OBJ_POS=llGetPos(); rotation OBJ_ROT=llGetRot(); vector REZ_POS=OBJ_POS+RELPOSOFFSET*OBJ_ROT; rotation REZ_ROT=RELROT*OBJ_ROT; llRezObject(OBJ_NAME, REZ_POS, ZERO_VECTOR, REZ_ROT, UNIQUECHANROOT); } listen(integer channel, string name, key id, string message) { if (channel==UNIQUECHANROOT) { list x =llParseString2List(message,[":"],[""]); rotation ROT=(rotation)llList2String(x,2); vector POS=(vector) llList2String(x,1); string RESPONSE=llList2String(x,0); if (RESPONSE=="SAVEPOS") { vector POSOFS=llGetPos()-POS; rotation RROT =llGetRot()/ROT; list x=["SAVEPOS_RESPONSE",":",POSOFS,":",RROT]; llRegionSay(UNIQUECHANCHILD,(string)x); } if (RESPONSE=="SETPOS") { vector OBJ_POS=llGetPos(); rotation OBJ_ROT=llGetRot(); vector REZ_POS=OBJ_POS+POS*OBJ_ROT; rotation REZ_ROT=ROT*OBJ_ROT; list x=["SETPOS_RESPONSE",":",REZ_POS,":",REZ_ROT]; llRegionSay(UNIQUECHANCHILD,(string)x); } } } } //Slave script which is in slave prim thats gonna be rezzed from master prims inventory OBJ_OPERATESETROTPOS() { llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,TARGETROT]); llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,TARGETPOS]); } integer ROOTCHANNEL; integer CHILDCHANNEL; integer LHANDLE; vector POSOFFSET; rotation ROTOFFSET; vector TARGETPOS; rotation TARGETROT; default { on_rez(integer x){ ROOTCHANNEL =x; CHILDCHANNEL=(x+1); LHANDLE =llListen(CHILDCHANNEL, "", "", ""); if (POSOFFSET!=ZERO_VECTOR) { list x=["SETPOS",":",POSOFFSET,":",ROTOFFSET]; llRegionSay(ROOTCHANNEL,(string)x); inc=FALSE; } else { llOwnerSay("No records found. Please save your desired POS-ROT just by clicking on this rezzed object."); } } timer() { if (++inc<20) { OBJ_OPERATESETROTPOS(); } else { llSetTimerEvent(0.0); } } touch_start(integer x) { llOwnerSay("Relative ROT-POS calculation started..."); list x=["SAVEPOS",":",llGetPos(),":",llGetRot()]; llRegionSay(ROOTCHANNEL,(string)x); } listen(integer channel, string name, key id, string message) { if (channel==CHILDCHANNEL) { list x =llParseString2List(message,[":"],[""]); rotation ROT =(rotation)llList2String(x,2); vector POS =(vector) llList2String(x,1); string RESPONSE=llList2String(x,0); if (RESPONSE=="SAVEPOS_RESPONSE") { POSOFFSET=POS; ROTOFFSET=ROT; llOwnerSay("Positions calculated."); } if (RESPONSE=="SETPOS_RESPONSE") { TARGETPOS=POS; TARGETROT=ROT; OBJ_OPERATESETROTPOS(); } } } }
  19. Today I been working on a wobbling effect which is based on key framed motions. So far, I made something which wobbles my vehicle as desired(at least it looks so inworld) but had to made it by 80 different motions which doesnt seem to be cool to me. Any ideas to make this simpler and better? (Thanks to Dora for main script btw :) float angle=0.02; float steps=20.0; float step=0.0; list KFMlist=[]; vector U; vector V; float angleU=0.0; float angleV; integer swing=TRUE; vector basePos; rotation baseRot; float Random(float min, float max) { return llFrand(max - min) + min; } default { state_entry() { //llSetMemoryLimit( llGetUsedMemory()+0x1000); llSetPrimitiveParams([PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_CONVEX]); basePos = llGetPos(); baseRot = llGetRot(); vector v1 = llGetScale(); float periode = TWO_PI*llSqrt( v1.z/9.81); float dT = periode/steps; dT = llRound(45.0*dT)/45.0; if ( dT < 0.11111111 ) dT = 0.11111111; v1.x = 0.0; v1.y = 0.0; v1 = -0.5*v1*llGetRot(); U = v1; integer inc=-1; float TN; while (++inc<4) { while (step < steps) { step += 1.0; angleV = angle*llCos( TWO_PI*step/steps + PI_BY_TWO); V = v1*llAxisAngle2Rot(llRot2Left(llGetRot()), angleV); if (inc==0) TN=(angleV-angleU)+0.002; if (inc==1) TN=(angleV-angleU)-0.002; if (inc==2) TN=(angleV-angleU)-0.001; if (inc==3) TN=(angleV-angleU)+0.001; KFMlist += [V-U, llEuler2Rot(<TN, angleV-angleU, 0.0>), 0.15]; angleU = angleV; U = V; } step=0.0; } llSetKeyframedMotion( [], []); llSleep(0.2); llSetPrimitiveParams([PRIM_POSITION, basePos, PRIM_ROTATION, baseRot]); llSetKeyframedMotion( KFMlist, [ KFM_MODE, KFM_LOOP]); } touch_start( integer n) { llSetKeyframedMotion( [], []); llSleep(0.2); llSetRot(llEuler2Rot(<0,0,0>)); } on_rez( integer n) { llResetScript(); } }
  20. The last version of it is this. I suggest you to give it a try when you are sat on the vehicle. Btw I sent you an offline message from inworld. Hope you'll like this version... llClearCameraParams(); params=[CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive CAMERA_BEHINDNESS_ANGLE, 0.0, // (0 to 180) degrees CAMERA_BEHINDNESS_LAG, 0.0, // (0 to 3) seconds CAMERA_DISTANCE, 5.0, // ( 0.5 to 10) meters //CAMERA_FOCUS, <0,0,0>, // region relative position CAMERA_FOCUS_LAG, 0.0 , // (0 to 3) seconds //CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE) CAMERA_FOCUS_THRESHOLD, 1.0, // (0 to 4) meters CAMERA_PITCH, 8.0, // (-45 to 80) degrees //CAMERA_POSITION, <0,0,0>, // region relative position CAMERA_POSITION_LAG, 0.0, // (0 to 3) seconds //CAMERA_POSITION_LOCKED, FALSE, // (TRUE or FALSE) CAMERA_POSITION_THRESHOLD, 0.0, // (0 to 4) meters CAMERA_FOCUS_OFFSET, <9.0, 0.7, 0.0> // <-10,-10,-10> to <10,10,10> meters ];
  21. Thanks alot Dora... However I made a front (dynamic) camera which stays on front of avatar right now during driving. So thank god I didnt have to use a static cam which works only when you sit on object. And also it was very simple(even if taken a day to figure it out). I am just going to improve it now and will try to make some other smiliar way of views. Parameters are as follows: CAMERA_FOCUS_OFFSET, <10,0,0>, CAMERA_ANGLE, 180, CAMERA_POSITION_LAG, 0
  22. Hi, I been playing with llSetCameraParams() to prepare various camera positions for my vehicle but wasnt really succeed at all. I have two of camera params of sets for back gear camera view and normal driving cam. I just want to place in my scripts two more cam options; one is in the front of the vehicle and the other one is above of driver. However I wasnt succeed by setting simple two camera positions by using llSetCameraParams() ... Any suggestions?
×
×
  • Create New...