Vilehead's Recent Forum Activity

  • oh! so its just another variation of "round" expresion? O.o

    so... i can use my method but i just need to add round...?

    i just dont see whats wrong with my method (aside from the obvious - that it isnt working lol).

    i mean - why? i am just like a guy who was drinking coffee and sudenly his coffee mug explode.

    i am like - What The Hell?

    also... Tulamide. for some reason frame 11 (graphical 100%) is never shown. the value must get higher then 100% like 100,6% in order for it to be show. how can this be fixed? can it? i mean - i can live on never seeing totaly empty ShielBar but never seeing Maxed bar is rather depresing and anoying. this is mostly because of that weird XX.0989987% result i am getting from the proccesor - i know. hey is there a way command to round down or up (or something) variable? the only event options i know are add substract and compare. otherwise i will be forced to follow Arima advice and pass on 0.XX values aka adjuct the whole points system by adding two more zeros to any value (so 0.01 will be now 1). but thats hell of a job and will turn any numbers into massive values (weakest game shield being 10000 instead of 100)

    and well, i still dont know any method of capping a value. beside the obvious IF ShieldsCurrent is greater then ShieldsTotal substract -0.01.

    [quote:t20jw1o1]

    This is confusing more than helping.

    totaly agree no offence of course. i just think i need to "level up" few times and ill be able to get hold on this.

    anyway. thank you VERY KINDLY. all of you. this is an extreme convo and i learn alot.

    in fact, just using/learning Construct and talking with you guys is more brain-stimulating then 5 years of my high-school had been.

    PS:

    and please note that i am NOT using you as my freeware teechers who are just waiting for me to whistle to come runing in lust of serving my needs. i respect you, you time and your imput. no one pays you for what you do, and i am aware of this.

    but laso think how constructive and informative this thread is for any newbie like me who maybe have similiar problems.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • [quote:3u0a6okv]->sprite set frame to int(shields('health')/100)

    hold on, what do you mean by shields nad health?

    i mean which is Total and which is Current? and do i need to set it for every state or like tulamide?

    sorry. i still dont quit get what int expression really is. but this is more of english language problem rather then me being math-handycaped.

  • come on people - say something!

    you know you want it

  • [quote:1nsm11e8]

    Yes, they are, but isn't it much better to work on only one problem until it is solved, then go on to the next, instead of getting information overkill?

    hmm. i need to agree with you but not entirely. you see my values system is all based on "set" event. for example imagine 100 shields types all called with "call function" event. and within that event the changes made by shields switching are made by "set var" event.

    now imagine later when ill type all that engines, shields, weapons, reactors ect stats and ill find out that to have a buff/boost/bonus thing i must use something else then "set var" event. and now 2-3 days spent on rewriting all the "call functions".

    its not like i want to do everything at once, its just i am a well planer aka i always try to met an dead end and be forced to go allll the way baaack.

    thats why i want to know that before ill reach the "point of no return".

    here, today i would propably use few extra variables to get the total value. like total value = valueReactor + valueBonus1 + valueUpgrade1 + valueAllYourBaseBelongToUs. but i would need to reserve a space for such variable. hmmm thinking of it... maybe ill just make that emergency variable after all? so when i change the TotalValue count so all the totalValue scatered around "Call Functions" be get auto-fixed.

    [quote:1nsm11e8]It converts a string or a float to an integer by rounding down.

    string = text and float = ?

    but... oh man. this might be beyond my capabilities. thats sound like chinese to me. its like saying it converts Er'Zuhz or a De'ruhn to an Elhe'lion by rounding down (thats dwarfish btw).

    dont get me wrong, i am not jumping at you. i just look down, with pity, at my lack of understanding asking myself that horrible question - em i really sure i want to make a game with so less near to nothing programing knowledge. at this point i cant see how i am supposed to finish my game without some 2nd dev helping me out constantly(that wasnt any kind of suggestion, just my growing depresion).

    [quote:1nsm11e8]The formula I wrote down is designed to show the shield status 100% only, if EnergyCurrent matches exactly EnergyTotal. On the other hand it displays the 0% frame also up until a certain amount (when using 11 frames everything below 10%)

    If you want to tweak its behavior, just replace 'int' by 'round' or 'ceil'. Ceil rounds up to the next integer, and round rounds to the nearest integer [=> round(1.49) = 1, round(1.5) = 2]

    If you use 'ceil' instead of 'int', then the 0% frame is only shown, if EnergyCurrent is exactly 0, whereas the 100% frame will be shown for every value above 90%.

    <img src="http://1.bp.blogspot.com/_UME67yLANIY/SvMhgOzXSEI/AAAAAAAAATw/Ay8PDdHDVAU/s320/jawdrop1236883259.jpg">

    umm, so what? hold on. so okey umm and what if i want the opposite? i mean to have 0% be drawn when value is 0-9%? (+/-) or both? like 0% only when 0% and 100% only when 100%?

    i am so sorry Tulamide, you must be feeling like talking to a rock

    [quote:1nsm11e8]Just because I have a

    HUGE

    lead over you in programming. Just keep on doing and you will solve such problems by yourself with ease. Promised.

    there, fixed. and i am more interested "why" technicaly my doesnt work.

    like - all the ranges are being set, are conditions are being met. but it still doesnt aint working.

    100% = show frame 11 (100%)

    90-99% show frame 10 (90%)

    80-89% show frame 9 (80%)

    and so on. i dont understand why the engine cant get it and is either stuck on 1st frame or the 11th totaly ignoring everything betwen. and i am asking also because - not always the % splits we'll be the same. imagine a situation when i would want/need 10% frame be drawn on 20%, 20% be drawn at 60% and 30% be drawn on 90%. thats 3 diffrent jumps and the splits arent equal. with my method (if it would be working that is) i can easly adjuct any range(s) how i please when with your (even if its working) i am stuck with equal pieces.

    and well, in most case i am uncertain will it work or not. but in this case was was 100% sure this will work. the rain started falling, ive opened my umbrella but my head still gets wet. i want to know why. where are the holes in the umbrella and how can i fix them.

    EDIT:

    oh great, it apears i cant define Variable with a sum of variables. like variable 1 = variable a + variable b. at least not from variable manager. my only idea is to set a "always" event defining that var. shame the variable manager doesnt recognise expressions though.

  • thats wicked.

    and it almost works. and i dont know why.

    the problem is, last frame suppose to be 100% ShieldEnergy only, just the first frame 0% should be displayed only when ShieldsCurrent hits 0%. with this the last frame 100% is for some reason never played, or should i say - it is but if ShieldCurrent is about 100% (100,000001% for example).

    so anyway, two questions:

    why my method doesnt work and why your does.

    also - what the heck is int expression??? i never seen that before on both expresions and system expresions pages on wiki.

    and well... many my previous issues are left unasweared

    [quote:3th6hoph]That's because of rounding errors - floating point numbers like 1.2 can't be counted on to be calculated exactly. It's a limitation of processors. If you want exact numbers, stick to integers (whole numbers without decimals like 1).

    wow. everyday i learn something new. never knew about such thing. how weird is that O.o like - it can easly count 2 + 2 but have troubles with 0,2 + 0,2?

  • hmmm. somethings wrong but i dont know what. now it works partialy. so when Current = Total it displays the 100% value but stays at it and doesnt change.

    i triple checked the animation, its setting, constrollers, variables and all is okey.

    from what i have traced - for some reason ONLY the first condition

    IF global('Spaceship - EnergyTotal') * 1[/code:1cq7u4wl]
    is being exectuded. the rest is just ignored. 
    
    sample of the rest:
    <img src="http://img84.imageshack.us/img84/8453/14403168.png">
    
    so i presume they are to blame
  • What trigger once does is it runs the code the one tick where the condition became true and will only run again if the condition becomes false then true again. Without it the code would run every tick while the condition is true. It does not simply run once period.

    What you want to do for your second question is use global variables. When you change a global variable it'll be changed for the entire program. So for your example have a variable for you door and have it 0 when the door is closed and 1 when it has been opened and it'll stay opened/closed if you change layouts.

    Thank you kindly.

  • * off-topic *

    And here a description of the modulo operation:

      The percentage sign, when used outside of a string, is an operator, just like +, -, *, /, etc. And it does divide, but a modulo division, aka 'mod', giving the integer remainder of the division:
        13 % 5 = 3 -> can also be expressed by: 13 - floor(13 / 5) * 5 -> you can also do ((13 / 5) - floor(13 / 5)) * 5 -> it is just returning the decimal places of the division multiplied by the denominator
          13 / 5 = 2.6; 0.6 * 5 = 3
      Modulo is often used in programming to get a repeating list of ordered numbers. For example, the timer returns the milliseconds passed since start of the application. You want a sprite to constantly fade in and out repeatedly and every fade should last 1 second. But the sprite's opacity is expressed by a value ranging from 0 to 100. So what we need is converting the timer value in a way that we get a value repeatedly growing and shrinking between 0 and 100.
      • There are 1000 milliseconds in one second, but we need one second to be 100.
      • If doing 'timer % 100', the results returned will raise from 0 to 99, then immediatly fall back to 0 and raise again. [0, 1, 2, ..., 98, 99, 0, 1, 2, ...]
      The first issue is solved by floor-dividing timer by 10. The second issue is solved with two other tricks. First, we set the denominator to 201. This way the values returned will range from 0 to 200. Second, we make use of 'abs', which returns the absolute value of a number regardless of its sign (-4 and 4 both have the absolute value 4) The final expression now is: opacity = abs(100 - floor(Timer / 10) % 201) The returned values will be [100, 99, 98, ..., 2, 1, 0, 1, 2, ..., 98, 99, 100, 99, 98, ...] and every range 0-100 or 100-0 will last 1 second

    I just thought I explain it for those who are curious beginners. If it is inappropiate, I apologize.

    <img src="http://goteaminternet.com/img/docs/65991.jpg">

  • I think your over complicating things. Try getting rid of the Else's and put every condition as a separate condition.

    If that works, then you can go back and try to simplify it more.

    done and ready. still not working.

    New issue #1:

    another weird thing that i have just discovered is weird effect of "every X milisec's" contidion.

    for value regeneration i use plain "Each X miliseconds" conditions and offten my values are like 1.20 0.80 3.33 ect. my problem is on example of Shields Regeneration. it starts with

    0 value with 1.20 regen rate and goes all the way to 38 and then BLAM 40.7999999999999, and becomes even more and more messed up with each second. now how 1.2 value multiplyd by any round number can become 40.7999999999999??? O.o

    i know that i can fix at last the shown value by adding round() around the var but its just like pushing trash under the carpet instead of cleaning it.

    new Issue #2:

    Bonuses/buffs. in many games you have those. like a ring of power +9 to str, magic shield +10 to AC, skill that grants you a passive +10% to all dmg.

    now how can i do this in Construct? what sort of conditions i should use? the only i can think of is hell of a work to make the Total value be (var value + value bonuses) and opening another var names bonuses and then enlisting ALL kinds of bonuses i can have.

    on example of my game. i have variable EnergyTotal that is being set by the Reactor Function. but would like to also have like batteries, special perks, rare awards that add passive values to var EnergyTotal. and there would be no problem IF i would have just one type of reactor. i would just use var add value. but i have many types of reactors and i want the EnergyTotal value be always updated with the bonuses. like for example:

    Reactor 1 with TotalValue 100 and a bonus +15 to TotalValue. so the total value is 115.

    now i change Reactor 1 for a better one Reactor 2 which has value 200. so i want that bonus to be added as the last and combine with other bonuses. otherwise the previous TotalValue of ReactorValue + Bonus 1 will be overwrite with just the total value set by new Reactor 2, so instead of 215 ill get 200.

    any ideas?

  • Take it easy. It'll come

    Ampersand (&) is for strings(text), so that's really not where you want to go here.

    There's another page you might want to take a look at: system expressions.

    http://sourceforge.net/apps/mediawiki/construct/index.php?title=System_Expressions

    If you look there you'll find clamp:

    [quote:3ffo3wza]Clamp(Value, Lower bound, Upper bound)

    Returns Value if it is between Lower bound and Upper bound. Returns Lower bound if Value is less than Lower bound. Returns Upper bound if Value is greater than Upper bound

    So...

    clamp(variable,40,70)

    ih man i knew this most be something obvious right in front of my nose!

    Thank yiu for that link Newt. i did check the "espressions" page, didnt figure out theres another diffrent one hah

    now - many things became so simple

    [quote:3ffo3wza]In that case, it's always better to simply not allow that to happen.

    thats the problem. if the would be just couple of conditions that changes this var i would just turn them off by auto with conditions, but the problem is - theres lots of conndtidions that changes this one and its an ant-job to add off switch for all of them or even keep track of them.

    thank you very much for the cap mate

    EDIT:

    okey guys it seems i screwed up once again

    whats wrong with this?

    clamp(global('Spaceship - EnergyTotal'),global('Spaceship - EnergyTotal')*0.6,global('Spaceship - EnergyTotal')*0.69)[/code:3ffo3wza]
    
    <img src="http://img829.imageshack.us/img829/908/shit0.png">
  • actualy i was just an idiot and though that if i write % mark it would (just as using your calculator) divide. forgoten this obvious fact that 10% are in fact 0.10, and to get 10% of something i need it be multiply by 0.10.

  • [quote:1pwehmyb]To get 50% of a value just multiply by 0.5.

    now i feel like an retard lol. damn you elementary math!

    Thank you R0J0hound!

    so the condition would be IF global('ShieldsTotal') & = & (global('ShieldsTotal') & * & 0.5) ?

    even so - i still dont know how to form a range of values (e.g all betwen 40 and 70)

    and obviously i still havent figured out how to make a variable change its value to another variable value. if i use

    IF variable X = or > then variable Y

    then

    set variable X equal variable Y

    hell breaks loss and both variables becomes linked togather - so if i change any of them the second follows.

Vilehead's avatar

Vilehead

Member since 9 Nov, 2010

None one is following Vilehead yet!

Connect with Vilehead

Trophy Case

  • 14-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies